Blame SOURCES/0001-Add-gesture-inhibitor-extension.patch

b19d38
From e27d37b9efed5f1266c6b27520a4698e9eb9d453 Mon Sep 17 00:00:00 2001
b19d38
From: rpm-build <rpm-build>
b19d38
Date: Thu, 28 Jan 2021 00:06:12 +0100
b19d38
Subject: [PATCH 1/5] Add gesture-inhibitor extension
b19d38
b19d38
This extension may disable default GNOME Shell gestures.
b19d38
---
b19d38
 extensions/gesture-inhibitor/extension.js     | 75 +++++++++++++++++++
b19d38
 extensions/gesture-inhibitor/meson.build      |  8 ++
b19d38
 extensions/gesture-inhibitor/metadata.json.in | 12 +++
b19d38
 ...l.extensions.gesture-inhibitor.gschema.xml | 25 +++++++
b19d38
 extensions/gesture-inhibitor/stylesheet.css   |  1 +
b19d38
 meson.build                                   |  1 +
b19d38
 6 files changed, 122 insertions(+)
b19d38
 create mode 100644 extensions/gesture-inhibitor/extension.js
b19d38
 create mode 100644 extensions/gesture-inhibitor/meson.build
b19d38
 create mode 100644 extensions/gesture-inhibitor/metadata.json.in
b19d38
 create mode 100644 extensions/gesture-inhibitor/org.gnome.shell.extensions.gesture-inhibitor.gschema.xml
b19d38
 create mode 100644 extensions/gesture-inhibitor/stylesheet.css
b19d38
b19d38
diff --git a/extensions/gesture-inhibitor/extension.js b/extensions/gesture-inhibitor/extension.js
b19d38
new file mode 100644
b19d38
index 00000000..e74ede2f
b19d38
--- /dev/null
b19d38
+++ b/extensions/gesture-inhibitor/extension.js
b19d38
@@ -0,0 +1,75 @@
b19d38
+/* extension.js
b19d38
+ *
b19d38
+ * This program is free software: you can redistribute it and/or modify
b19d38
+ * it under the terms of the GNU General Public License as published by
b19d38
+ * the Free Software Foundation, either version 2 of the License, or
b19d38
+ * (at your option) any later version.
b19d38
+ *
b19d38
+ * This program is distributed in the hope that it will be useful,
b19d38
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
b19d38
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
b19d38
+ * GNU General Public License for more details.
b19d38
+ *
b19d38
+ * You should have received a copy of the GNU General Public License
b19d38
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
b19d38
+ *
b19d38
+ * SPDX-License-Identifier: GPL-2.0-or-later
b19d38
+ */
b19d38
+
b19d38
+/* exported init */
b19d38
+
b19d38
+const Clutter = imports.gi.Clutter;
b19d38
+const ExtensionUtils = imports.misc.extensionUtils;
b19d38
+const Me = ExtensionUtils.getCurrentExtension();
b19d38
+const ViewSelector = imports.ui.viewSelector;
b19d38
+const EdgeDragAction = imports.ui.edgeDragAction;
b19d38
+const WindowManager = imports.ui.windowManager;
b19d38
+const St = imports.gi.St;
b19d38
+const Gio = imports.gi.Gio;
b19d38
+
b19d38
+class Extension {
b19d38
+    constructor() {
b19d38
+	this._settings = ExtensionUtils.getSettings();
b19d38
+	let actions = global.stage.get_actions();
b19d38
+
b19d38
+	actions.forEach(a => {
b19d38
+	    if (a instanceof ViewSelector.ShowOverviewAction)
b19d38
+		this._showOverview = a;
b19d38
+	    else if (a instanceof WindowManager.AppSwitchAction)
b19d38
+		this._appSwitch = a;
b19d38
+	    else if (a instanceof EdgeDragAction.EdgeDragAction &&
b19d38
+		     a._side == St.Side.BOTTOM)
b19d38
+		this._showOsk = a;
b19d38
+	    else if (a instanceof EdgeDragAction.EdgeDragAction &&
b19d38
+		     a._side == St.Side.TOP)
b19d38
+		this._unfullscreen = a;
b19d38
+	    else if (a instanceof EdgeDragAction.EdgeDragAction)
b19d38
+		this._showAppGrid = a;
b19d38
+	});
b19d38
+
b19d38
+	this._map = [
b19d38
+	    { setting: 'overview', action: this._showOverview },
b19d38
+	    { setting: 'app-switch', action: this._appSwitch },
b19d38
+	    { setting: 'show-osk', action: this._showOsk },
b19d38
+	    { setting: 'unfullscreen', action: this._unfullscreen },
b19d38
+	    { setting: 'show-app-grid', action: this._showAppGrid }
b19d38
+	];
b19d38
+    }
b19d38
+
b19d38
+    enable() {
b19d38
+	this._map.forEach(m => {
b19d38
+	    this._settings.bind(m.setting, m.action, 'enabled',
b19d38
+				Gio.SettingsBindFlags.DEFAULT);
b19d38
+	});
b19d38
+    }
b19d38
+
b19d38
+    disable() {
b19d38
+	this._map.forEach(m => {
b19d38
+	    m.action.enabled = true;
b19d38
+	});
b19d38
+    }
b19d38
+}
b19d38
+
b19d38
+function init() {
b19d38
+    return new Extension();
b19d38
+}
b19d38
diff --git a/extensions/gesture-inhibitor/meson.build b/extensions/gesture-inhibitor/meson.build
b19d38
new file mode 100644
b19d38
index 00000000..fdad5cc8
b19d38
--- /dev/null
b19d38
+++ b/extensions/gesture-inhibitor/meson.build
b19d38
@@ -0,0 +1,8 @@
b19d38
+extension_data += configure_file(
b19d38
+  input: metadata_name + '.in',
b19d38
+  output: metadata_name,
b19d38
+  configuration: metadata_conf
b19d38
+)
b19d38
+
b19d38
+# extension_sources += files('prefs.js')
b19d38
+extension_schemas += files(metadata_conf.get('gschemaname') + '.gschema.xml')
b19d38
diff --git a/extensions/gesture-inhibitor/metadata.json.in b/extensions/gesture-inhibitor/metadata.json.in
b19d38
new file mode 100644
b19d38
index 00000000..37d6a117
b19d38
--- /dev/null
b19d38
+++ b/extensions/gesture-inhibitor/metadata.json.in
b19d38
@@ -0,0 +1,12 @@
b19d38
+{
b19d38
+ "uuid": "@uuid@",
b19d38
+ "extension-id": "@extension_id@",
b19d38
+ "settings-schema": "@gschemaname@",
b19d38
+ "gettext-domain": "@gettext_domain@",
b19d38
+ "name": "Gesture Inhibitor",
b19d38
+ "description": "Makes touchscreen gestures optional.",
b19d38
+ "shell-version": [ "@shell_current@" ],
b19d38
+ "original-authors": [ "cgarnach@redhat.com" ],
b19d38
+ "url": "@url@"
b19d38
+}
b19d38
+
b19d38
diff --git a/extensions/gesture-inhibitor/org.gnome.shell.extensions.gesture-inhibitor.gschema.xml b/extensions/gesture-inhibitor/org.gnome.shell.extensions.gesture-inhibitor.gschema.xml
b19d38
new file mode 100644
b19d38
index 00000000..1d67dcc0
b19d38
--- /dev/null
b19d38
+++ b/extensions/gesture-inhibitor/org.gnome.shell.extensions.gesture-inhibitor.gschema.xml
b19d38
@@ -0,0 +1,25 @@
b19d38
+<schemalist>
b19d38
+  <schema id="org.gnome.shell.extensions.gesture-inhibitor" path="/org/gnome/shell/extensions/gesture-inhibitor/">
b19d38
+    <key name="show-app-grid" type="b">
b19d38
+      <default>true</default>
b19d38
+      <summary>Show app grid gesture</summary>
b19d38
+    </key>
b19d38
+    <key name="show-osk" type="b">
b19d38
+      <default>true</default>
b19d38
+      <summary>Show OSK gesture</summary>
b19d38
+    </key>
b19d38
+    <key name="overview" type="b">
b19d38
+      <default>true</default>
b19d38
+      <summary>Show Overview gesture</summary>
b19d38
+    </key>
b19d38
+    <key name="app-switch" type="b">
b19d38
+      <default>true</default>
b19d38
+      <summary>Application switch gesture</summary>
b19d38
+    </key>
b19d38
+    <key name="unfullscreen" type="b">
b19d38
+      <default>true</default>
b19d38
+      <summary>Unfullscreen gesture</summary>
b19d38
+    </key>
b19d38
+  </schema>
b19d38
+</schemalist>
b19d38
+
b19d38
diff --git a/extensions/gesture-inhibitor/stylesheet.css b/extensions/gesture-inhibitor/stylesheet.css
b19d38
new file mode 100644
b19d38
index 00000000..37b93f21
b19d38
--- /dev/null
b19d38
+++ b/extensions/gesture-inhibitor/stylesheet.css
b19d38
@@ -0,0 +1 @@
b19d38
+/* Add your custom extension styling here */
b19d38
diff --git a/meson.build b/meson.build
b19d38
index 78dee5b8..1bbda801 100644
b19d38
--- a/meson.build
b19d38
+++ b/meson.build
b19d38
@@ -47,6 +47,7 @@ all_extensions = default_extensions
b19d38
 all_extensions += [
b19d38
   'auto-move-windows',
b19d38
   'dash-to-dock',
b19d38
+  'gesture-inhibitor',
b19d38
   'native-window-placement',
b19d38
   'panel-favorites',
b19d38
   'systemMonitor',
b19d38
-- 
b19d38
2.33.1
b19d38
b19d38
b19d38
From 40604aa25af5a12c976b0ccdbd872bf48c49fdcf Mon Sep 17 00:00:00 2001
b19d38
From: =?UTF-8?q?Florian=20M=C3=BCllner?= <fmuellner@gnome.org>
b19d38
Date: Wed, 20 Oct 2021 19:48:46 +0200
b19d38
Subject: [PATCH 2/5] gesture-inhibitor: Fix up indentation
b19d38
b19d38
---
b19d38
 extensions/gesture-inhibitor/extension.js | 59 +++++++++++------------
b19d38
 1 file changed, 29 insertions(+), 30 deletions(-)
b19d38
b19d38
diff --git a/extensions/gesture-inhibitor/extension.js b/extensions/gesture-inhibitor/extension.js
b19d38
index e74ede2f..734d61cc 100644
b19d38
--- a/extensions/gesture-inhibitor/extension.js
b19d38
+++ b/extensions/gesture-inhibitor/extension.js
b19d38
@@ -29,44 +29,43 @@ const Gio = imports.gi.Gio;
b19d38
 
b19d38
 class Extension {
b19d38
     constructor() {
b19d38
-	this._settings = ExtensionUtils.getSettings();
b19d38
-	let actions = global.stage.get_actions();
b19d38
+        this._settings = ExtensionUtils.getSettings();
b19d38
+        let actions = global.stage.get_actions();
b19d38
 
b19d38
-	actions.forEach(a => {
b19d38
-	    if (a instanceof ViewSelector.ShowOverviewAction)
b19d38
-		this._showOverview = a;
b19d38
-	    else if (a instanceof WindowManager.AppSwitchAction)
b19d38
-		this._appSwitch = a;
b19d38
-	    else if (a instanceof EdgeDragAction.EdgeDragAction &&
b19d38
-		     a._side == St.Side.BOTTOM)
b19d38
-		this._showOsk = a;
b19d38
-	    else if (a instanceof EdgeDragAction.EdgeDragAction &&
b19d38
-		     a._side == St.Side.TOP)
b19d38
-		this._unfullscreen = a;
b19d38
-	    else if (a instanceof EdgeDragAction.EdgeDragAction)
b19d38
-		this._showAppGrid = a;
b19d38
-	});
b19d38
+        actions.forEach(a => {
b19d38
+            if (a instanceof ViewSelector.ShowOverviewAction)
b19d38
+                this._showOverview = a;
b19d38
+            else if (a instanceof WindowManager.AppSwitchAction)
b19d38
+                this._appSwitch = a;
b19d38
+            else if (a instanceof EdgeDragAction.EdgeDragAction &&
b19d38
+                 a._side == St.Side.BOTTOM)
b19d38
+                this._showOsk = a;
b19d38
+            else if (a instanceof EdgeDragAction.EdgeDragAction &&
b19d38
+                 a._side == St.Side.TOP)
b19d38
+                this._unfullscreen = a;
b19d38
+            else if (a instanceof EdgeDragAction.EdgeDragAction)
b19d38
+                this._showAppGrid = a;
b19d38
+        });
b19d38
 
b19d38
-	this._map = [
b19d38
-	    { setting: 'overview', action: this._showOverview },
b19d38
-	    { setting: 'app-switch', action: this._appSwitch },
b19d38
-	    { setting: 'show-osk', action: this._showOsk },
b19d38
-	    { setting: 'unfullscreen', action: this._unfullscreen },
b19d38
-	    { setting: 'show-app-grid', action: this._showAppGrid }
b19d38
-	];
b19d38
+        this._map = [
b19d38
+            { setting: 'overview', action: this._showOverview },
b19d38
+            { setting: 'app-switch', action: this._appSwitch },
b19d38
+            { setting: 'show-osk', action: this._showOsk },
b19d38
+            { setting: 'unfullscreen', action: this._unfullscreen },
b19d38
+            { setting: 'show-app-grid', action: this._showAppGrid }
b19d38
+        ];
b19d38
     }
b19d38
 
b19d38
     enable() {
b19d38
-	this._map.forEach(m => {
b19d38
-	    this._settings.bind(m.setting, m.action, 'enabled',
b19d38
-				Gio.SettingsBindFlags.DEFAULT);
b19d38
-	});
b19d38
+        this._map.forEach(m => {
b19d38
+            this._settings.bind(m.setting, m.action, 'enabled',
b19d38
+                    Gio.SettingsBindFlags.DEFAULT);
b19d38
+        });
b19d38
     }
b19d38
 
b19d38
     disable() {
b19d38
-	this._map.forEach(m => {
b19d38
-	    m.action.enabled = true;
b19d38
-	});
b19d38
+        this._map.forEach(
b19d38
+            m => (m.action.enabled = true));
b19d38
     }
b19d38
 }
b19d38
 
b19d38
-- 
b19d38
2.33.1
b19d38
b19d38
b19d38
From 57d53126e322b50f31de169f49bae6e3e01cca21 Mon Sep 17 00:00:00 2001
b19d38
From: =?UTF-8?q?Florian=20M=C3=BCllner?= <fmuellner@gnome.org>
b19d38
Date: Wed, 20 Oct 2021 19:47:05 +0200
b19d38
Subject: [PATCH 3/5] gesture-inhibitor: Adjust for GNOME 40 changes
b19d38
b19d38
---
b19d38
 extensions/gesture-inhibitor/extension.js             | 11 +++--------
b19d38
 ...ome.shell.extensions.gesture-inhibitor.gschema.xml |  4 ----
b19d38
 2 files changed, 3 insertions(+), 12 deletions(-)
b19d38
b19d38
diff --git a/extensions/gesture-inhibitor/extension.js b/extensions/gesture-inhibitor/extension.js
b19d38
index 734d61cc..13586108 100644
b19d38
--- a/extensions/gesture-inhibitor/extension.js
b19d38
+++ b/extensions/gesture-inhibitor/extension.js
b19d38
@@ -21,8 +21,8 @@
b19d38
 const Clutter = imports.gi.Clutter;
b19d38
 const ExtensionUtils = imports.misc.extensionUtils;
b19d38
 const Me = ExtensionUtils.getCurrentExtension();
b19d38
-const ViewSelector = imports.ui.viewSelector;
b19d38
 const EdgeDragAction = imports.ui.edgeDragAction;
b19d38
+const Main = imports.ui.main;
b19d38
 const WindowManager = imports.ui.windowManager;
b19d38
 const St = imports.gi.St;
b19d38
 const Gio = imports.gi.Gio;
b19d38
@@ -33,9 +33,7 @@ class Extension {
b19d38
         let actions = global.stage.get_actions();
b19d38
 
b19d38
         actions.forEach(a => {
b19d38
-            if (a instanceof ViewSelector.ShowOverviewAction)
b19d38
-                this._showOverview = a;
b19d38
-            else if (a instanceof WindowManager.AppSwitchAction)
b19d38
+            if (a instanceof WindowManager.AppSwitchAction)
b19d38
                 this._appSwitch = a;
b19d38
             else if (a instanceof EdgeDragAction.EdgeDragAction &&
b19d38
                  a._side == St.Side.BOTTOM)
b19d38
@@ -43,16 +41,13 @@ class Extension {
b19d38
             else if (a instanceof EdgeDragAction.EdgeDragAction &&
b19d38
                  a._side == St.Side.TOP)
b19d38
                 this._unfullscreen = a;
b19d38
-            else if (a instanceof EdgeDragAction.EdgeDragAction)
b19d38
-                this._showAppGrid = a;
b19d38
         });
b19d38
 
b19d38
         this._map = [
b19d38
-            { setting: 'overview', action: this._showOverview },
b19d38
+            { setting: 'overview', action: Main.overview._swipeTracker },
b19d38
             { setting: 'app-switch', action: this._appSwitch },
b19d38
             { setting: 'show-osk', action: this._showOsk },
b19d38
             { setting: 'unfullscreen', action: this._unfullscreen },
b19d38
-            { setting: 'show-app-grid', action: this._showAppGrid }
b19d38
         ];
b19d38
     }
b19d38
 
b19d38
diff --git a/extensions/gesture-inhibitor/org.gnome.shell.extensions.gesture-inhibitor.gschema.xml b/extensions/gesture-inhibitor/org.gnome.shell.extensions.gesture-inhibitor.gschema.xml
b19d38
index 1d67dcc0..4bdf9260 100644
b19d38
--- a/extensions/gesture-inhibitor/org.gnome.shell.extensions.gesture-inhibitor.gschema.xml
b19d38
+++ b/extensions/gesture-inhibitor/org.gnome.shell.extensions.gesture-inhibitor.gschema.xml
b19d38
@@ -1,9 +1,5 @@
b19d38
 <schemalist>
b19d38
   <schema id="org.gnome.shell.extensions.gesture-inhibitor" path="/org/gnome/shell/extensions/gesture-inhibitor/">
b19d38
-    <key name="show-app-grid" type="b">
b19d38
-      <default>true</default>
b19d38
-      <summary>Show app grid gesture</summary>
b19d38
-    </key>
b19d38
     <key name="show-osk" type="b">
b19d38
       <default>true</default>
b19d38
       <summary>Show OSK gesture</summary>
b19d38
-- 
b19d38
2.33.1
b19d38
b19d38
b19d38
From a771e6511ea8c9e4144a2417a63029524ae7cfb1 Mon Sep 17 00:00:00 2001
b19d38
From: =?UTF-8?q?Florian=20M=C3=BCllner?= <fmuellner@gnome.org>
b19d38
Date: Thu, 18 Nov 2021 15:54:23 +0100
b19d38
Subject: [PATCH 4/5] gesture-inhibitor: Unbind setting on disable
b19d38
b19d38
---
b19d38
 extensions/gesture-inhibitor/extension.js | 6 ++++--
b19d38
 1 file changed, 4 insertions(+), 2 deletions(-)
b19d38
b19d38
diff --git a/extensions/gesture-inhibitor/extension.js b/extensions/gesture-inhibitor/extension.js
b19d38
index 13586108..02b34ec4 100644
b19d38
--- a/extensions/gesture-inhibitor/extension.js
b19d38
+++ b/extensions/gesture-inhibitor/extension.js
b19d38
@@ -59,8 +59,10 @@ class Extension {
b19d38
     }
b19d38
 
b19d38
     disable() {
b19d38
-        this._map.forEach(
b19d38
-            m => (m.action.enabled = true));
b19d38
+        this._map.forEach(m => {
b19d38
+            Gio.Settings.unbind(m.action, 'enabled');
b19d38
+            m.action.enabled = true;
b19d38
+        });
b19d38
     }
b19d38
 }
b19d38
 
b19d38
-- 
b19d38
2.33.1
b19d38
b19d38
b19d38
From b34018078a87bd52344b3a7cdef5eae1ac271d89 Mon Sep 17 00:00:00 2001
b19d38
From: =?UTF-8?q?Florian=20M=C3=BCllner?= <fmuellner@gnome.org>
b19d38
Date: Thu, 18 Nov 2021 16:06:09 +0100
b19d38
Subject: [PATCH 5/5] gesture-inhibitor: Override :enabled property
b19d38
b19d38
Otherwise gnome-shell can re-enable an inhibited gesture behind our
b19d38
back.
b19d38
---
b19d38
 extensions/gesture-inhibitor/extension.js | 23 ++++++++++++++++++++++-
b19d38
 1 file changed, 22 insertions(+), 1 deletion(-)
b19d38
b19d38
diff --git a/extensions/gesture-inhibitor/extension.js b/extensions/gesture-inhibitor/extension.js
b19d38
index 02b34ec4..fb8a6dc0 100644
b19d38
--- a/extensions/gesture-inhibitor/extension.js
b19d38
+++ b/extensions/gesture-inhibitor/extension.js
b19d38
@@ -49,18 +49,39 @@ class Extension {
b19d38
             { setting: 'show-osk', action: this._showOsk },
b19d38
             { setting: 'unfullscreen', action: this._unfullscreen },
b19d38
         ];
b19d38
+
b19d38
+        this._enabledDesc = Object.getOwnPropertyDescriptor(
b19d38
+            Clutter.ActorMeta.prototype, 'enabled');
b19d38
+    }
b19d38
+
b19d38
+    _overrideEnabledSetter(obj, set) {
b19d38
+        if (!(obj instanceof Clutter.ActorMeta))
b19d38
+            return;
b19d38
+
b19d38
+        const desc = set
b19d38
+            ? { ...this._enabledDesc, set }
b19d38
+            : { ...this._enabledDesc };
b19d38
+        Object.defineProperty(obj, 'enabled', desc);
b19d38
     }
b19d38
 
b19d38
     enable() {
b19d38
+        const settings = this._settings;
b19d38
+
b19d38
         this._map.forEach(m => {
b19d38
-            this._settings.bind(m.setting, m.action, 'enabled',
b19d38
+            settings.bind(m.setting, m.action, 'enabled',
b19d38
                     Gio.SettingsBindFlags.DEFAULT);
b19d38
+
b19d38
+            this._overrideEnabledSetter(m.action, function (value) {
b19d38
+                if (settings.get_boolean(m.setting))
b19d38
+                    this.set_enabled(value);
b19d38
+            });
b19d38
         });
b19d38
     }
b19d38
 
b19d38
     disable() {
b19d38
         this._map.forEach(m => {
b19d38
             Gio.Settings.unbind(m.action, 'enabled');
b19d38
+            this._overrideEnabledSetter(m.action);
b19d38
             m.action.enabled = true;
b19d38
         });
b19d38
     }
b19d38
-- 
b19d38
2.33.1
b19d38