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
This commit is contained in:
Andrea Azzarone 2018-07-18 20:26:44 +02:00 committed by Andrea Azzarone
parent be06101e9a
commit f3168d22a6
2 changed files with 10 additions and 9 deletions

View File

@ -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">

View File

@ -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);