[gnome-shell/benzea/accelerator-api-improvements] shellDBus: Add UngrabAccelerators
- From: Benjamin Berg <bberg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/benzea/accelerator-api-improvements] shellDBus: Add UngrabAccelerators
- Date: Sat, 2 Mar 2019 16:02:30 +0000 (UTC)
commit fb207dfa7b5434ef64b1e29e27665307082696f8
Author: Benjamin Berg <bberg redhat com>
Date: Sat Mar 2 16:49:55 2019 +0100
shellDBus: Add UngrabAccelerators
While it is possible to register accelerators in-bulk, there is no
proper way to unregister them again. This adds the corresponding call
for UngrabAccelerator to allow ungrabbing multiple accelerators at the
same time.
The idea is that g-s-d can use this in the future to simplify the
keybinding reload logic.
https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/429
data/dbus-interfaces/org.gnome.Shell.xml | 4 ++++
js/ui/shellDBus.js | 18 ++++++++++++++++++
2 files changed, 22 insertions(+)
---
diff --git a/data/dbus-interfaces/org.gnome.Shell.xml b/data/dbus-interfaces/org.gnome.Shell.xml
index b5b44af7a..91284a7b2 100644
--- a/data/dbus-interfaces/org.gnome.Shell.xml
+++ b/data/dbus-interfaces/org.gnome.Shell.xml
@@ -34,6 +34,10 @@
<arg type="u" direction="in" name="action"/>
<arg type="b" direction="out" name="success"/>
</method>
+ <method name="UngrabAccelerators">
+ <arg type="au" direction="in" name="action"/>
+ <arg type="ab" direction="out" name="success"/>
+ </method>
<signal name="AcceleratorActivated">
<arg name="action" type="u"/>
<arg name="parameters" type="a{sv}"/>
diff --git a/js/ui/shellDBus.js b/js/ui/shellDBus.js
index 9238b7c35..ea5583ac1 100644
--- a/js/ui/shellDBus.js
+++ b/js/ui/shellDBus.js
@@ -133,6 +133,24 @@ var GnomeShell = class {
this._grabbedAccelerators.delete(action);
return invocation.return_value(GLib.Variant.new('(b)', [ungrabSucceeded]));
}
+ UngrabAcceleratorsAsync(params, invocation) {
+ let [actions] = params;
+ let sender = invocation.get_sender();
+ let ungrabSucceeded = []
+ for (let i = 0; i < actions.length; i++) {
+ let grabbedBy = this._grabbedAccelerators.get(actions[i]);
+ if (sender != grabbedBy) {
+ ungrabSucceeded.push(false);
+ continue;
+ }
+
+ let success = global.display.ungrab_accelerator(actions[i]);
+ if (success)
+ this._grabbedAccelerators.delete(actions[i]);
+ ungrabSucceeded.push(success);
+ }
+ return invocation.return_value(GLib.Variant.new('(ab)', [ungrabSucceeded]));
+ }
_emitAcceleratorActivated(action, deviceid, timestamp) {
let destination = this._grabbedAccelerators.get(action);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]