summaryrefslogtreecommitdiff
diff options
authorAlberto Milone <alberto.milone@canonical.com>2016-06-06 16:05:18 +0200
committerAlberto Milone <alberto.milone@canonical.com>2016-06-06 16:05:18 +0200
commitfd8bd6aebd962c5b30a986f3d50c72e01548a7ee (patch)
tree190f7e04f7baa418d72e1836702a494ec6ccad96
parentb4abdf57f50cf44e34dcd882d9ff5ce902d6197e (diff)
Add dconf keys for disabling multitouch gestures. (LP: #1589520)
(bzr r4126.1.1)
-rw-r--r--com.canonical.Unity.gschema.xml19
-rw-r--r--plugins/unityshell/src/unityshell.cpp11
-rw-r--r--plugins/unityshell/src/unityshell.h1
-rw-r--r--unity-shared/UnitySettings.cpp20
-rw-r--r--unity-shared/UnitySettings.h4
5 files changed, 54 insertions, 1 deletions
diff --git a/com.canonical.Unity.gschema.xml b/com.canonical.Unity.gschema.xml
index 893d87cea..01123274a 100644
--- a/com.canonical.Unity.gschema.xml
+++ b/com.canonical.Unity.gschema.xml
@@ -220,4 +220,23 @@
when clicking over unfocused menu entries</description>
</key>
</schema>
+ <schema path="/com/canonical/unity/gestures/" id="com.canonical.Unity.Gestures" gettext-domain="unity">
+ <key type="b" name="launcher-drag">
+ <default>true</default>
+ <summary>Multi-touch gesture to reveal the launcher.</summary>
+ <description>When this is enabled, a 4 finger swipe from left to right will reveal launcher,
+ provided that the launcher is set to auto-hide.</description>
+ </key>
+ <key type="b" name="dash-tap">
+ <default>true</default>
+ <summary>Multi-touch gesture to open the dash.</summary>
+ <description>When this is enabled, a 4 finger tap will open the dash.</description>
+ </key>
+ <key type="b" name="windows-drag-pinch">
+ <default>true</default>
+ <summary>Multi-touch gestures to manage the windows.</summary>
+ <description>When this is enabled, 3 finger gestures such as drag, and pinch, will
+ help manage the windows.</description>
+ </key>
+ </schema>
</schemalist>
diff --git a/plugins/unityshell/src/unityshell.cpp b/plugins/unityshell/src/unityshell.cpp
index 9cc93bae1..93e182909 100644
--- a/plugins/unityshell/src/unityshell.cpp
+++ b/plugins/unityshell/src/unityshell.cpp
@@ -446,6 +446,7 @@ UnityScreen::UnityScreen(CompScreen* screen)
auto init_plugins_cb = sigc::mem_fun(this, &UnityScreen::InitPluginActions);
sources_.Add(std::make_shared<glib::Idle>(init_plugins_cb, glib::Source::Priority::DEFAULT));
+ Settings::Instance().gestures_changed.connect(sigc::mem_fun(this, &UnityScreen::UpdateGesturesSupport));
InitGesturesSupport();
LoadPanelShadowTexture();
@@ -4189,11 +4190,17 @@ lockscreen::Controller::Ptr UnityScreen::lockscreen_controller()
return lockscreen_controller_;
}
+void UnityScreen::UpdateGesturesSupport()
+{
+ Settings::Instance().gestures_launcher_drag() ? gestures_sub_launcher_->Activate() : gestures_sub_launcher_->Deactivate();
+ Settings::Instance().gestures_dash_tap() ? gestures_sub_dash_->Activate() : gestures_sub_dash_->Deactivate();
+ Settings::Instance().gestures_windows_drag_pinch() ? gestures_sub_windows_->Activate() : gestures_sub_windows_->Deactivate();
+}
+
void UnityScreen::InitGesturesSupport()
{
std::unique_ptr<nux::GestureBroker> gesture_broker(new UnityGestureBroker);
wt->GetWindowCompositor().SetGestureBroker(std::move(gesture_broker));
-
gestures_sub_launcher_.reset(new nux::GesturesSubscription);
gestures_sub_launcher_->SetGestureClasses(nux::DRAG_GESTURE);
gestures_sub_launcher_->SetNumTouches(4);
@@ -4213,6 +4220,8 @@ void UnityScreen::InitGesturesSupport()
gestures_sub_windows_->SetNumTouches(3);
gestures_sub_windows_->SetWindowId(GDK_ROOT_WINDOW());
gestures_sub_windows_->Activate();
+ // Apply the user's settings
+ UpdateGesturesSupport();
}
CompAction::Vector& UnityScreen::getActions()
diff --git a/plugins/unityshell/src/unityshell.h b/plugins/unityshell/src/unityshell.h
index 202654d2b..b1dfda5b0 100644
--- a/plugins/unityshell/src/unityshell.h
+++ b/plugins/unityshell/src/unityshell.h
@@ -282,6 +282,7 @@ private:
void OnDecorationStyleChanged();
void InitGesturesSupport();
+ void UpdateGesturesSupport();
void DrawPanelUnderDash();
diff --git a/unity-shared/UnitySettings.cpp b/unity-shared/UnitySettings.cpp
index 7109ebdf3..ec4d1374f 100644
--- a/unity-shared/UnitySettings.cpp
+++ b/unity-shared/UnitySettings.cpp
@@ -66,6 +66,11 @@ const std::string GNOME_TEXT_SCALE_FACTOR = "text-scaling-factor";
const std::string REMOTE_CONTENT_SETTINGS = "com.canonical.Unity.Lenses";
const std::string REMOTE_CONTENT_KEY = "remote-content-search";
+const std::string GESTURES_SETTINGS = "com.canonical.Unity.Gestures";
+const std::string LAUNCHER_DRAG = "launcher-drag";
+const std::string DASH_TAP = "dash-tap";
+const std::string WINDOWS_DRAG_PINCH = "windows-drag-pinch";
+
const int DEFAULT_LAUNCHER_SIZE = 64;
const int MINIMUM_DESKTOP_HEIGHT = 800;
const int GNOME_SETTINGS_CHANGED_WAIT_SECONDS = 1;
@@ -83,6 +88,7 @@ public:
, usettings_(g_settings_new(SETTINGS_NAME.c_str()))
, launcher_settings_(g_settings_new(LAUNCHER_SETTINGS.c_str()))
, lim_settings_(g_settings_new(LIM_SETTINGS.c_str()))
+ , gestures_settings_(g_settings_new(GESTURES_SETTINGS.c_str()))
, ui_settings_(g_settings_new(UI_SETTINGS.c_str()))
, ubuntu_ui_settings_(g_settings_new(UBUNTU_UI_SETTINGS.c_str()))
, gnome_ui_settings_(g_settings_new(GNOME_UI_SETTINGS.c_str()))
@@ -160,6 +166,10 @@ public:
UpdateLimSetting();
});
+ signals_.Add<void, GSettings*, const gchar*>(gestures_settings_, "changed", [this] (GSettings*, const gchar*) {
+ UpdateGesturesSetting();
+ });
+
signals_.Add<void, GSettings*, const gchar*>(remote_content_settings_, "changed::" + REMOTE_CONTENT_KEY, [this] (GSettings*, const gchar* t) {
UpdateRemoteContentSearch();
});
@@ -168,6 +178,7 @@ public:
// The order is important here, DPI is the last thing to be updated
UpdateLimSetting();
+ UpdateGesturesSetting();
UpdateTextScaleFactor();
UpdateCursorScaleFactor();
UpdateFontSize();
@@ -222,6 +233,14 @@ public:
parent_->lim_unfocused_popup = g_settings_get_boolean(lim_settings_, UNFOCUSED_MENU_POPUP.c_str());
}
+ void UpdateGesturesSetting()
+ {
+ parent_->gestures_launcher_drag = g_settings_get_boolean(gestures_settings_, LAUNCHER_DRAG.c_str());
+ parent_->gestures_dash_tap = g_settings_get_boolean(gestures_settings_, DASH_TAP.c_str());
+ parent_->gestures_windows_drag_pinch = g_settings_get_boolean(gestures_settings_, WINDOWS_DRAG_PINCH.c_str());
+ parent_->gestures_changed.emit();
+ }
+
FormFactor GetFormFactor() const
{
return cached_form_factor_;
@@ -384,6 +403,7 @@ public:
glib::Object<GSettings> usettings_;
glib::Object<GSettings> launcher_settings_;
glib::Object<GSettings> lim_settings_;
+ glib::Object<GSettings> gestures_settings_;
glib::Object<GSettings> ui_settings_;
glib::Object<GSettings> ubuntu_ui_settings_;
glib::Object<GSettings> gnome_ui_settings_;
diff --git a/unity-shared/UnitySettings.h b/unity-shared/UnitySettings.h
index 268cf3474..1081fef57 100644
--- a/unity-shared/UnitySettings.h
+++ b/unity-shared/UnitySettings.h
@@ -71,9 +71,13 @@ public:
nux::Property<double> font_scaling;
nux::ROProperty<bool> remote_content;
nux::RWProperty<LauncherPosition> launcher_position;
+ nux::Property<bool> gestures_launcher_drag;
+ nux::Property<bool> gestures_dash_tap;
+ nux::Property<bool> gestures_windows_drag_pinch;
sigc::signal<void> dpi_changed;
sigc::signal<void> low_gfx_changed;
+ sigc::signal<void> gestures_changed;
private:
class Impl;