on xenial help sign in
make the edge drag area width configurable Fixes: #1559512

Approved by: Albert Astals Cid

commit863244cc76dadf14377b156532b0afae471d4a6f authorMichael Zanetti <michael.zanetti@canonical.com> dateThu 14 Apr 2016, 21:20 (11 years ago) parenta28a119432358a
4 files changed+48−1
data/com.canonical.Unity8.gschema.xml+5 qml/Shell.qml+1−1 tests/mocks/GSettings.1.0/fake_gsettings.cpp+33 tests/mocks/GSettings.1.0/fake_gsettings.h+9
data/com.canonical.Unity8.gschema.xml+5
@@ -27,6 +27,11 @@
2727 <summary>Maximum push needed to overcome edge barrier</summary>
2828 <description>How much you have to push (in grid units) the mouse against an edge barrier when sensibility is 1.</description>
2929 </key>
30+ <key type="u" name="edge-drag-width">
31+ <default>2</default>
32+ <summary>The width of the edge drag areas</summary>
33+ <description>How big (in grid units) the edge-drag sensitive area should be.</description>
34+ </key>
3035 <key type="b" name="autohide-launcher">
3136 <default>true</default>
3237 <summary>Autohide the launcher</summary>
qml/Shell.qml+1−1
@@ -109,7 +109,7 @@ Item {
109109 // the greeter or launcher until we know whether the session is locked.
110110 enabled: greeter && !greeter.waiting
111111
112− property real edgeSize: units.gu(2)
112+ property real edgeSize: units.gu(settings.edgeDragWidth)
113113
114114 WallpaperResolver {
115115 id: wallpaperResolver
tests/mocks/GSettings.1.0/fake_gsettings.cpp+33
@@ -25,6 +25,7 @@ GSettingsControllerQml::GSettingsControllerQml()
2525 , m_usageMode("Staged")
2626 , m_autohideLauncher(false)
2727 , m_launcherWidth(8)
28+ , m_edgeDragWidth(2)
2829{
2930}
3031
@@ -130,6 +131,19 @@ void GSettingsControllerQml::setLauncherWidth(int launcherWidth)
130131 }
131132}
132133
134+uint GSettingsControllerQml::edgeDragWidth() const
135+{
136+ return m_edgeDragWidth;
137+}
138+
139+void GSettingsControllerQml::setEdgeDragWidth(uint edgeDragWidth)
140+{
141+ if (m_edgeDragWidth != edgeDragWidth) {
142+ m_edgeDragWidth = edgeDragWidth;
143+ Q_EMIT edgeDragWidthChanged(edgeDragWidth);
144+ }
145+}
146+
133147GSettingsSchemaQml::GSettingsSchemaQml(QObject *parent): QObject(parent) {
134148}
135149
@@ -192,6 +206,8 @@ void GSettingsQml::componentComplete()
192206 this, &GSettingsQml::autohideLauncherChanged);
193207 connect(GSettingsControllerQml::instance(), &GSettingsControllerQml::launcherWidthChanged,
194208 this, &GSettingsQml::launcherWidthChanged);
209+ connect(GSettingsControllerQml::instance(), &GSettingsControllerQml::edgeDragWidthChanged,
210+ this, &GSettingsQml::edgeDragWidthChanged);
195211
196212 Q_EMIT disableHeightChanged();
197213 Q_EMIT pictureUriChanged();
@@ -200,6 +216,7 @@ void GSettingsQml::componentComplete()
200216 Q_EMIT lifecycleExemptAppidsChanged();
201217 Q_EMIT autohideLauncherChanged();
202218 Q_EMIT launcherWidthChanged();
219+ Q_EMIT edgeDragWidthChanged();
203220}
204221
205222GSettingsSchemaQml * GSettingsQml::schema() const {
@@ -297,6 +314,15 @@ QVariant GSettingsQml::launcherWidth() const
297314 }
298315}
299316
317+QVariant GSettingsQml::edgeDragWidth() const
318+{
319+ if (m_valid && m_schema->id() == "com.canonical.Unity8") {
320+ return GSettingsControllerQml::instance()->edgeDragWidth();
321+ } else {
322+ return QVariant();
323+ }
324+}
325+
300326void GSettingsQml::setLifecycleExemptAppids(const QVariant &appIds)
301327{
302328 if (m_valid && m_schema->id() == "com.canonical.qtmir") {
@@ -317,3 +343,10 @@ void GSettingsQml::setLauncherWidth(const QVariant &launcherWidth)
317343 GSettingsControllerQml::instance()->setLauncherWidth(launcherWidth.toInt());
318344 }
319345}
346+
347+void GSettingsQml::setEdgeDragWidth(const QVariant &edgeDragWidth)
348+{
349+ if (m_valid && m_schema->id() == "com.canonical.Unity8") {
350+ GSettingsControllerQml::instance()->setEdgeDragWidth(edgeDragWidth.toUInt());
351+ }
352+}
tests/mocks/GSettings.1.0/fake_gsettings.h+9
@@ -56,6 +56,7 @@ class GSettingsQml: public QObject, public QQmlParserStatus
5656 Q_PROPERTY(QVariant lifecycleExemptAppids READ lifecycleExemptAppids WRITE setLifecycleExemptAppids NOTIFY lifecycleExemptAppidsChanged)
5757 Q_PROPERTY(QVariant autohideLauncher READ autohideLauncher WRITE setAutohideLauncher NOTIFY autohideLauncherChanged)
5858 Q_PROPERTY(QVariant launcherWidth READ launcherWidth WRITE setLauncherWidth NOTIFY launcherWidthChanged)
59+ Q_PROPERTY(QVariant edgeDragWidth READ edgeDragWidth WRITE setEdgeDragWidth NOTIFY edgeDragWidthChanged)
5960
6061public:
6162 GSettingsQml(QObject *parent = nullptr);
@@ -71,6 +72,7 @@ public:
7172 QVariant lifecycleExemptAppids() const;
7273 QVariant autohideLauncher() const;
7374 QVariant launcherWidth() const;
75+ QVariant edgeDragWidth() const;
7476
7577 void setDisableHeight(const QVariant &val);
7678 void setPictureUri(const QVariant &str);
@@ -79,6 +81,7 @@ public:
7981 void setLifecycleExemptAppids(const QVariant &appIds);
8082 void setAutohideLauncher(const QVariant &autohideLauncher);
8183 void setLauncherWidth(const QVariant &launcherWidth);
84+ void setEdgeDragWidth(const QVariant &edgeDragWidth);
8285
8386Q_SIGNALS:
8487 void disableHeightChanged();
@@ -89,6 +92,7 @@ Q_SIGNALS:
8992 void lifecycleExemptAppidsChanged();
9093 void autohideLauncherChanged();
9194 void launcherWidthChanged();
95+ void edgeDragWidthChanged();
9296
9397private:
9498 GSettingsSchemaQml* m_schema;
@@ -126,6 +130,9 @@ public:
126130 int launcherWidth() const;
127131 Q_INVOKABLE void setLauncherWidth(int launcherWidth);
128132
133+ uint edgeDragWidth() const;
134+ Q_INVOKABLE void setEdgeDragWidth(uint edgeDragWidth);
135+
129136Q_SIGNALS:
130137 void disableHeightChanged();
131138 void pictureUriChanged(const QString&);
@@ -134,6 +141,7 @@ Q_SIGNALS:
134141 void lifecycleExemptAppidsChanged(const QStringList&);
135142 void autohideLauncherChanged(bool autohideLauncher);
136143 void launcherWidthChanged(int launcherWidth);
144+ void edgeDragWidthChanged(uint edgeDragWidth);
137145
138146private:
139147 GSettingsControllerQml();
@@ -145,6 +153,7 @@ private:
145153 QStringList m_lifecycleExemptAppids;
146154 bool m_autohideLauncher;
147155 int m_launcherWidth;
156+ uint m_edgeDragWidth;
148157
149158 static GSettingsControllerQml* s_controllerInstance;
150159 QList<GSettingsQml *> m_registeredGSettings;