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

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