Merge lp:~albertomilone/unity/unity-dconf-for-gestures into lp:unity

Proposed by Alberto Milone
Status: Merged
Approved by: Marco Trevisan (Treviño)
Approved revision: no longer in the source branch.
Merged at revision: 4129
Proposed branch: lp:~albertomilone/unity/unity-dconf-for-gestures
Merge into: lp:unity
Diff against target: 176 lines (+55/-4)
5 files modified
com.canonical.Unity.gschema.xml (+19/-0)
plugins/unityshell/src/unityshell.cpp (+11/-4)
plugins/unityshell/src/unityshell.h (+1/-0)
unity-shared/UnitySettings.cpp (+20/-0)
unity-shared/UnitySettings.h (+4/-0)
To merge this branch: bzr merge lp:~albertomilone/unity/unity-dconf-for-gestures
Reviewer Review Type Date Requested Status
Marco Trevisan (Treviño) Approve
Review via email: mp+296559@code.launchpad.net

Commit message

UnitySettings: Add dconf keys for disabling multitouch gestures

Description of the change

While not an actual solution to LP: #1264795, it provide a rather easy way for users to disable gestures in dconf (as per LP: #1589520).

To post a comment you must log in.
Revision history for this message
Marco Trevisan (Treviño) (3v1n0) wrote :

Thanks!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'com.canonical.Unity.gschema.xml'
--- com.canonical.Unity.gschema.xml 2016-05-30 18:05:51 +0000
+++ com.canonical.Unity.gschema.xml 2016-06-06 14:22:43 +0000
@@ -220,4 +220,23 @@
220 when clicking over unfocused menu entries</description>220 when clicking over unfocused menu entries</description>
221 </key>221 </key>
222 </schema>222 </schema>
223 <schema path="/com/canonical/unity/gestures/" id="com.canonical.Unity.Gestures" gettext-domain="unity">
224 <key type="b" name="launcher-drag">
225 <default>true</default>
226 <summary>Multi-touch gesture to reveal the launcher.</summary>
227 <description>When this is enabled, a 4 finger swipe from left to right will reveal launcher,
228 provided that the launcher is set to auto-hide.</description>
229 </key>
230 <key type="b" name="dash-tap">
231 <default>true</default>
232 <summary>Multi-touch gesture to open the dash.</summary>
233 <description>When this is enabled, a 4 finger tap will open the dash.</description>
234 </key>
235 <key type="b" name="windows-drag-pinch">
236 <default>true</default>
237 <summary>Multi-touch gestures to manage the windows.</summary>
238 <description>When this is enabled, 3 finger gestures such as drag, and pinch, will
239 help manage the windows.</description>
240 </key>
241 </schema>
223</schemalist>242</schemalist>
224243
=== modified file 'plugins/unityshell/src/unityshell.cpp'
--- plugins/unityshell/src/unityshell.cpp 2016-05-31 11:54:01 +0000
+++ plugins/unityshell/src/unityshell.cpp 2016-06-06 14:22:43 +0000
@@ -446,6 +446,7 @@
446 auto init_plugins_cb = sigc::mem_fun(this, &UnityScreen::InitPluginActions);446 auto init_plugins_cb = sigc::mem_fun(this, &UnityScreen::InitPluginActions);
447 sources_.Add(std::make_shared<glib::Idle>(init_plugins_cb, glib::Source::Priority::DEFAULT));447 sources_.Add(std::make_shared<glib::Idle>(init_plugins_cb, glib::Source::Priority::DEFAULT));
448448
449 Settings::Instance().gestures_changed.connect(sigc::mem_fun(this, &UnityScreen::UpdateGesturesSupport));
449 InitGesturesSupport();450 InitGesturesSupport();
450451
451 LoadPanelShadowTexture();452 LoadPanelShadowTexture();
@@ -4189,22 +4190,26 @@
4189 return lockscreen_controller_;4190 return lockscreen_controller_;
4190}4191}
41914192
4193void UnityScreen::UpdateGesturesSupport()
4194{
4195 Settings::Instance().gestures_launcher_drag() ? gestures_sub_launcher_->Activate() : gestures_sub_launcher_->Deactivate();
4196 Settings::Instance().gestures_dash_tap() ? gestures_sub_dash_->Activate() : gestures_sub_dash_->Deactivate();
4197 Settings::Instance().gestures_windows_drag_pinch() ? gestures_sub_windows_->Activate() : gestures_sub_windows_->Deactivate();
4198}
4199
4192void UnityScreen::InitGesturesSupport()4200void UnityScreen::InitGesturesSupport()
4193{4201{
4194 std::unique_ptr<nux::GestureBroker> gesture_broker(new UnityGestureBroker);4202 std::unique_ptr<nux::GestureBroker> gesture_broker(new UnityGestureBroker);
4195 wt->GetWindowCompositor().SetGestureBroker(std::move(gesture_broker));4203 wt->GetWindowCompositor().SetGestureBroker(std::move(gesture_broker));
4196
4197 gestures_sub_launcher_.reset(new nux::GesturesSubscription);4204 gestures_sub_launcher_.reset(new nux::GesturesSubscription);
4198 gestures_sub_launcher_->SetGestureClasses(nux::DRAG_GESTURE);4205 gestures_sub_launcher_->SetGestureClasses(nux::DRAG_GESTURE);
4199 gestures_sub_launcher_->SetNumTouches(4);4206 gestures_sub_launcher_->SetNumTouches(4);
4200 gestures_sub_launcher_->SetWindowId(GDK_ROOT_WINDOW());4207 gestures_sub_launcher_->SetWindowId(GDK_ROOT_WINDOW());
4201 gestures_sub_launcher_->Activate();
42024208
4203 gestures_sub_dash_.reset(new nux::GesturesSubscription);4209 gestures_sub_dash_.reset(new nux::GesturesSubscription);
4204 gestures_sub_dash_->SetGestureClasses(nux::TAP_GESTURE);4210 gestures_sub_dash_->SetGestureClasses(nux::TAP_GESTURE);
4205 gestures_sub_dash_->SetNumTouches(4);4211 gestures_sub_dash_->SetNumTouches(4);
4206 gestures_sub_dash_->SetWindowId(GDK_ROOT_WINDOW());4212 gestures_sub_dash_->SetWindowId(GDK_ROOT_WINDOW());
4207 gestures_sub_dash_->Activate();
42084213
4209 gestures_sub_windows_.reset(new nux::GesturesSubscription);4214 gestures_sub_windows_.reset(new nux::GesturesSubscription);
4210 gestures_sub_windows_->SetGestureClasses(nux::TOUCH_GESTURE4215 gestures_sub_windows_->SetGestureClasses(nux::TOUCH_GESTURE
@@ -4212,7 +4217,9 @@
4212 | nux::PINCH_GESTURE);4217 | nux::PINCH_GESTURE);
4213 gestures_sub_windows_->SetNumTouches(3);4218 gestures_sub_windows_->SetNumTouches(3);
4214 gestures_sub_windows_->SetWindowId(GDK_ROOT_WINDOW());4219 gestures_sub_windows_->SetWindowId(GDK_ROOT_WINDOW());
4215 gestures_sub_windows_->Activate();4220
4221 // Apply the user's settings
4222 UpdateGesturesSupport();
4216}4223}
42174224
4218CompAction::Vector& UnityScreen::getActions()4225CompAction::Vector& UnityScreen::getActions()
42194226
=== modified file 'plugins/unityshell/src/unityshell.h'
--- plugins/unityshell/src/unityshell.h 2016-05-31 11:54:01 +0000
+++ plugins/unityshell/src/unityshell.h 2016-06-06 14:22:43 +0000
@@ -282,6 +282,7 @@
282 void OnDecorationStyleChanged();282 void OnDecorationStyleChanged();
283283
284 void InitGesturesSupport();284 void InitGesturesSupport();
285 void UpdateGesturesSupport();
285286
286 void DrawPanelUnderDash();287 void DrawPanelUnderDash();
287288
288289
=== modified file 'unity-shared/UnitySettings.cpp'
--- unity-shared/UnitySettings.cpp 2016-03-18 01:47:08 +0000
+++ unity-shared/UnitySettings.cpp 2016-06-06 14:22:43 +0000
@@ -66,6 +66,11 @@
66const std::string REMOTE_CONTENT_SETTINGS = "com.canonical.Unity.Lenses";66const std::string REMOTE_CONTENT_SETTINGS = "com.canonical.Unity.Lenses";
67const std::string REMOTE_CONTENT_KEY = "remote-content-search";67const std::string REMOTE_CONTENT_KEY = "remote-content-search";
6868
69const std::string GESTURES_SETTINGS = "com.canonical.Unity.Gestures";
70const std::string LAUNCHER_DRAG = "launcher-drag";
71const std::string DASH_TAP = "dash-tap";
72const std::string WINDOWS_DRAG_PINCH = "windows-drag-pinch";
73
69const int DEFAULT_LAUNCHER_SIZE = 64;74const int DEFAULT_LAUNCHER_SIZE = 64;
70const int MINIMUM_DESKTOP_HEIGHT = 800;75const int MINIMUM_DESKTOP_HEIGHT = 800;
71const int GNOME_SETTINGS_CHANGED_WAIT_SECONDS = 1;76const int GNOME_SETTINGS_CHANGED_WAIT_SECONDS = 1;
@@ -83,6 +88,7 @@
83 , usettings_(g_settings_new(SETTINGS_NAME.c_str()))88 , usettings_(g_settings_new(SETTINGS_NAME.c_str()))
84 , launcher_settings_(g_settings_new(LAUNCHER_SETTINGS.c_str()))89 , launcher_settings_(g_settings_new(LAUNCHER_SETTINGS.c_str()))
85 , lim_settings_(g_settings_new(LIM_SETTINGS.c_str()))90 , lim_settings_(g_settings_new(LIM_SETTINGS.c_str()))
91 , gestures_settings_(g_settings_new(GESTURES_SETTINGS.c_str()))
86 , ui_settings_(g_settings_new(UI_SETTINGS.c_str()))92 , ui_settings_(g_settings_new(UI_SETTINGS.c_str()))
87 , ubuntu_ui_settings_(g_settings_new(UBUNTU_UI_SETTINGS.c_str()))93 , ubuntu_ui_settings_(g_settings_new(UBUNTU_UI_SETTINGS.c_str()))
88 , gnome_ui_settings_(g_settings_new(GNOME_UI_SETTINGS.c_str()))94 , gnome_ui_settings_(g_settings_new(GNOME_UI_SETTINGS.c_str()))
@@ -160,6 +166,10 @@
160 UpdateLimSetting();166 UpdateLimSetting();
161 });167 });
162168
169 signals_.Add<void, GSettings*, const gchar*>(gestures_settings_, "changed", [this] (GSettings*, const gchar*) {
170 UpdateGesturesSetting();
171 });
172
163 signals_.Add<void, GSettings*, const gchar*>(remote_content_settings_, "changed::" + REMOTE_CONTENT_KEY, [this] (GSettings*, const gchar* t) {173 signals_.Add<void, GSettings*, const gchar*>(remote_content_settings_, "changed::" + REMOTE_CONTENT_KEY, [this] (GSettings*, const gchar* t) {
164 UpdateRemoteContentSearch();174 UpdateRemoteContentSearch();
165 });175 });
@@ -168,6 +178,7 @@
168178
169 // The order is important here, DPI is the last thing to be updated179 // The order is important here, DPI is the last thing to be updated
170 UpdateLimSetting();180 UpdateLimSetting();
181 UpdateGesturesSetting();
171 UpdateTextScaleFactor();182 UpdateTextScaleFactor();
172 UpdateCursorScaleFactor();183 UpdateCursorScaleFactor();
173 UpdateFontSize();184 UpdateFontSize();
@@ -222,6 +233,14 @@
222 parent_->lim_unfocused_popup = g_settings_get_boolean(lim_settings_, UNFOCUSED_MENU_POPUP.c_str());233 parent_->lim_unfocused_popup = g_settings_get_boolean(lim_settings_, UNFOCUSED_MENU_POPUP.c_str());
223 }234 }
224235
236 void UpdateGesturesSetting()
237 {
238 parent_->gestures_launcher_drag = g_settings_get_boolean(gestures_settings_, LAUNCHER_DRAG.c_str());
239 parent_->gestures_dash_tap = g_settings_get_boolean(gestures_settings_, DASH_TAP.c_str());
240 parent_->gestures_windows_drag_pinch = g_settings_get_boolean(gestures_settings_, WINDOWS_DRAG_PINCH.c_str());
241 parent_->gestures_changed.emit();
242 }
243
225 FormFactor GetFormFactor() const244 FormFactor GetFormFactor() const
226 {245 {
227 return cached_form_factor_;246 return cached_form_factor_;
@@ -384,6 +403,7 @@
384 glib::Object<GSettings> usettings_;403 glib::Object<GSettings> usettings_;
385 glib::Object<GSettings> launcher_settings_;404 glib::Object<GSettings> launcher_settings_;
386 glib::Object<GSettings> lim_settings_;405 glib::Object<GSettings> lim_settings_;
406 glib::Object<GSettings> gestures_settings_;
387 glib::Object<GSettings> ui_settings_;407 glib::Object<GSettings> ui_settings_;
388 glib::Object<GSettings> ubuntu_ui_settings_;408 glib::Object<GSettings> ubuntu_ui_settings_;
389 glib::Object<GSettings> gnome_ui_settings_;409 glib::Object<GSettings> gnome_ui_settings_;
390410
=== modified file 'unity-shared/UnitySettings.h'
--- unity-shared/UnitySettings.h 2016-03-18 01:47:08 +0000
+++ unity-shared/UnitySettings.h 2016-06-06 14:22:43 +0000
@@ -71,9 +71,13 @@
71 nux::Property<double> font_scaling;71 nux::Property<double> font_scaling;
72 nux::ROProperty<bool> remote_content;72 nux::ROProperty<bool> remote_content;
73 nux::RWProperty<LauncherPosition> launcher_position;73 nux::RWProperty<LauncherPosition> launcher_position;
74 nux::Property<bool> gestures_launcher_drag;
75 nux::Property<bool> gestures_dash_tap;
76 nux::Property<bool> gestures_windows_drag_pinch;
7477
75 sigc::signal<void> dpi_changed;78 sigc::signal<void> dpi_changed;
76 sigc::signal<void> low_gfx_changed;79 sigc::signal<void> low_gfx_changed;
80 sigc::signal<void> gestures_changed;
7781
78private:82private:
79 class Impl;83 class Impl;