Re: Keybinding changes in 3.8?



Thanks for clarifyfication Florian.

If I got it wright, it's enough to check if Main.wm.addKeybinding exist and
and otherwise use the 3.6.x version  e.g.

    if (Main.wm.addKeybinding) {  // 3.8
        Main.wm.addKeybinding(key,
            this._utils.getSettingsObject(), Meta.KeyBindingFlags.NONE,
Shell.KeyBindingMode.NORMAL | Shell.KeyBindingMode.MESSAGE_TRAY,
            handler
        );
    } else { // 3.6
        global.display.add_keybinding(
            key,
            this._utils.getSettingsObject(),
            Meta.KeyBindingFlags.NONE,
            handler
        );
    }

Only thing that's still unclear for me is what Meta.KeyBindingFlags and
Shell.KeyBindingMode do. I can not find real information about this on
https://developer.gnome.org/shell/3.8/. Would be great if you can tell us :)

Am 22.05.2013 13:53, schrieb Florian Müllner:
On Wed, May 22, 2013 at 1:15 PM, Clemens <clemens lab21 org> wrote:
global.display.add_keybinding is no longer availabe in 3.8.
That is wrong, the function still exists and is unchanged with regard
to previous versions. The issue here is that it is no longer
enough[0], you are also expected to specify when the keybinding should
be allowed - the easiest way is to use Main.wm.addKeybinding(), which
is a convenience wrapper around global.display.add_keybinding() and
Main.wm.allowKeybinding().


     if (Main.wm.addKeybinding && Shell.KeyBindingMode) { // introduced in
3.7.5
  [...]
     } else if (Main.wm.addKeybinding && Main.KeybindingMode) { // introduced
in 3.7.2
  [...]
     } else {
Up to you of course, but I don't think it is worth supporting old
unstable releases - I doubt there are actual users who run those
versions after a stable release, so you are probably cluttering your
code for nothing.


[0] Technically that's not true - global.display.add_keybinding() does
register the binding as it did before, but it will always be filtered
out unless Main.wm.allowKeybinding() has been called as well for it.


--
00:56 <soreau> Maybe Canonical is just a division of Microsoft hired to try and take down Linux
00:56 <RAOF> Our secret is out!!!!!111111



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