[gnome-shell] shellDBus: Add grabFlags parameter



commit f3168d22a690a89dd28991a492f02f746788e769
Author: Andrea Azzarone <azzaronea gmail com>
Date:   Wed Jul 18 20:26:44 2018 +0200

    shellDBus: Add grabFlags parameter
    
    Add an grabFlags parameter to the GrabAccelerator and GrabAccelerators dbus
    methods. This will allow e.g. Gnome Settings Daemon to create shortcuts that
    should discard key-repeated events.
    
    https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/156
    
    Fixes: https://gitlab.gnome.org/GNOME/gnome-settings-daemon/issues/68

 data/dbus-interfaces/org.gnome.Shell.xml |  5 +++--
 js/ui/shellDBus.js                       | 14 +++++++-------
 2 files changed, 10 insertions(+), 9 deletions(-)
---
diff --git a/data/dbus-interfaces/org.gnome.Shell.xml b/data/dbus-interfaces/org.gnome.Shell.xml
index 233c5e105..b5b44af7a 100644
--- a/data/dbus-interfaces/org.gnome.Shell.xml
+++ b/data/dbus-interfaces/org.gnome.Shell.xml
@@ -22,11 +22,12 @@
     <method name="ShowApplications"/>
     <method name="GrabAccelerator">
       <arg type="s" direction="in" name="accelerator"/>
-      <arg type="u" direction="in" name="flags"/>
+      <arg type="u" direction="in" name="modeFlags"/>
+      <arg type="u" direction="in" name="grabFlags"/>
       <arg type="u" direction="out" name="action"/>
     </method>
     <method name="GrabAccelerators">
-      <arg type="a(su)" direction="in" name="accelerators"/>
+      <arg type="a(suu)" direction="in" name="accelerators"/>
       <arg type="au" direction="out" name="actions"/>
     </method>
     <method name="UngrabAccelerator">
diff --git a/js/ui/shellDBus.js b/js/ui/shellDBus.js
index 73d74becf..9238b7c35 100644
--- a/js/ui/shellDBus.js
+++ b/js/ui/shellDBus.js
@@ -105,9 +105,9 @@ var GnomeShell = class {
     }
 
     GrabAcceleratorAsync(params, invocation) {
-        let [accel, flags] = params;
+        let [accel, modeFlags, grabFlags] = params;
         let sender = invocation.get_sender();
-        let bindingAction = this._grabAcceleratorForSender(accel, flags, sender);
+        let bindingAction = this._grabAcceleratorForSender(accel, modeFlags, grabFlags, sender);
         return invocation.return_value(GLib.Variant.new('(u)', [bindingAction]));
     }
 
@@ -116,8 +116,8 @@ var GnomeShell = class {
         let sender = invocation.get_sender();
         let bindingActions = [];
         for (let i = 0; i < accels.length; i++) {
-            let [accel, flags] = accels[i];
-            bindingActions.push(this._grabAcceleratorForSender(accel, flags, sender));
+            let [accel, modeFlags, grabFlags] = accels[i];
+            bindingActions.push(this._grabAcceleratorForSender(accel, modeFlags, grabFlags, sender));
         }
         return invocation.return_value(GLib.Variant.new('(au)', [bindingActions]));
     }
@@ -151,13 +151,13 @@ var GnomeShell = class {
                                GLib.Variant.new('(ua{sv})', [action, params]));
     }
 
-    _grabAcceleratorForSender(accelerator, flags, sender) {
-        let bindingAction = global.display.grab_accelerator(accelerator);
+    _grabAcceleratorForSender(accelerator, modeFlags, grabFlags, sender) {
+        let bindingAction = global.display.grab_accelerator(accelerator, grabFlags);
         if (bindingAction == Meta.KeyBindingAction.NONE)
             return Meta.KeyBindingAction.NONE;
 
         let bindingName = Meta.external_binding_name_for_action(bindingAction);
-        Main.wm.allowKeybinding(bindingName, flags);
+        Main.wm.allowKeybinding(bindingName, modeFlags);
 
         this._grabbedAccelerators.set(bindingAction, sender);
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]