Prevent gnome-shell from re-enabling inhibited gestures

Resolves: #2013196
This commit is contained in:
Florian Müllner 2021-11-18 16:29:27 +01:00
parent 096c499eb8
commit b2e07465c9
2 changed files with 101 additions and 7 deletions

View File

@ -1,7 +1,7 @@
From e27d37b9efed5f1266c6b27520a4698e9eb9d453 Mon Sep 17 00:00:00 2001
From: rpm-build <rpm-build>
Date: Thu, 28 Jan 2021 00:06:12 +0100
Subject: [PATCH 1/3] Add gesture-inhibitor extension
Subject: [PATCH 1/5] Add gesture-inhibitor extension
This extension may disable default GNOME Shell gestures.
---
@ -182,13 +182,13 @@ index 78dee5b8..1bbda801 100644
'panel-favorites',
'systemMonitor',
--
2.32.0
2.33.1
From 40604aa25af5a12c976b0ccdbd872bf48c49fdcf Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Florian=20M=C3=BCllner?= <fmuellner@gnome.org>
Date: Wed, 20 Oct 2021 19:48:46 +0200
Subject: [PATCH 2/3] gesture-inhibitor: Fix up indentation
Subject: [PATCH 2/5] gesture-inhibitor: Fix up indentation
---
extensions/gesture-inhibitor/extension.js | 59 +++++++++++------------
@ -273,13 +273,13 @@ index e74ede2f..734d61cc 100644
}
--
2.32.0
2.33.1
From 57d53126e322b50f31de169f49bae6e3e01cca21 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Florian=20M=C3=BCllner?= <fmuellner@gnome.org>
Date: Wed, 20 Oct 2021 19:47:05 +0200
Subject: [PATCH 3/3] gesture-inhibitor: Adjust for GNOME 40 changes
Subject: [PATCH 3/5] gesture-inhibitor: Adjust for GNOME 40 changes
---
extensions/gesture-inhibitor/extension.js | 11 +++--------
@ -344,5 +344,95 @@ index 1d67dcc0..4bdf9260 100644
<default>true</default>
<summary>Show OSK gesture</summary>
--
2.32.0
2.33.1
From a771e6511ea8c9e4144a2417a63029524ae7cfb1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Florian=20M=C3=BCllner?= <fmuellner@gnome.org>
Date: Thu, 18 Nov 2021 15:54:23 +0100
Subject: [PATCH 4/5] gesture-inhibitor: Unbind setting on disable
---
extensions/gesture-inhibitor/extension.js | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/extensions/gesture-inhibitor/extension.js b/extensions/gesture-inhibitor/extension.js
index 13586108..02b34ec4 100644
--- a/extensions/gesture-inhibitor/extension.js
+++ b/extensions/gesture-inhibitor/extension.js
@@ -59,8 +59,10 @@ class Extension {
}
disable() {
- this._map.forEach(
- m => (m.action.enabled = true));
+ this._map.forEach(m => {
+ Gio.Settings.unbind(m.action, 'enabled');
+ m.action.enabled = true;
+ });
}
}
--
2.33.1
From b34018078a87bd52344b3a7cdef5eae1ac271d89 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Florian=20M=C3=BCllner?= <fmuellner@gnome.org>
Date: Thu, 18 Nov 2021 16:06:09 +0100
Subject: [PATCH 5/5] gesture-inhibitor: Override :enabled property
Otherwise gnome-shell can re-enable an inhibited gesture behind our
back.
---
extensions/gesture-inhibitor/extension.js | 23 ++++++++++++++++++++++-
1 file changed, 22 insertions(+), 1 deletion(-)
diff --git a/extensions/gesture-inhibitor/extension.js b/extensions/gesture-inhibitor/extension.js
index 02b34ec4..fb8a6dc0 100644
--- a/extensions/gesture-inhibitor/extension.js
+++ b/extensions/gesture-inhibitor/extension.js
@@ -49,18 +49,39 @@ class Extension {
{ setting: 'show-osk', action: this._showOsk },
{ setting: 'unfullscreen', action: this._unfullscreen },
];
+
+ this._enabledDesc = Object.getOwnPropertyDescriptor(
+ Clutter.ActorMeta.prototype, 'enabled');
+ }
+
+ _overrideEnabledSetter(obj, set) {
+ if (!(obj instanceof Clutter.ActorMeta))
+ return;
+
+ const desc = set
+ ? { ...this._enabledDesc, set }
+ : { ...this._enabledDesc };
+ Object.defineProperty(obj, 'enabled', desc);
}
enable() {
+ const settings = this._settings;
+
this._map.forEach(m => {
- this._settings.bind(m.setting, m.action, 'enabled',
+ settings.bind(m.setting, m.action, 'enabled',
Gio.SettingsBindFlags.DEFAULT);
+
+ this._overrideEnabledSetter(m.action, function (value) {
+ if (settings.get_boolean(m.setting))
+ this.set_enabled(value);
+ });
});
}
disable() {
this._map.forEach(m => {
Gio.Settings.unbind(m.action, 'enabled');
+ this._overrideEnabledSetter(m.action);
m.action.enabled = true;
});
}
--
2.33.1

View File

@ -7,7 +7,7 @@
Name: gnome-shell-extensions
Version: 40.4
Release: 6%{?dist}
Release: 7%{?dist}
Summary: Modify and extend GNOME Shell functionality and behavior
License: GPLv2+
@ -389,6 +389,10 @@ workspaces.
%changelog
* Thu Nov 18 2021 Florian Müllner <fmuellner@redhat.com> - 40.4-7
- Prevent gnome-shell from re-enabling inhibited gestures
Resolves: #2013196
* Mon Nov 08 2021 Jonas Ådahl <jadahl@redhat.com> - 40.4-6
- Fix stuck grab on desktop-icons
Resolves: #2019715