diff options
author | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2016-08-26 16:35:54 +0200 |
---|---|---|
committer | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2016-08-26 16:35:54 +0200 |
commit | 4b19e75939c5b7122d1429f6f258d4b83cd90dde (patch) | |
tree | c1af105b3b9f98326bb59a7c0a5f516f15b9f1f4 /src/utilities/bindingManager.vala | |
parent | d9c48b3d78430c190a8077f0ec1fb65de1fc8b09 (diff) |
Imported Upstream version 0.6.9upstream/0.6.9
Diffstat (limited to 'src/utilities/bindingManager.vala')
-rw-r--r-- | src/utilities/bindingManager.vala | 39 |
1 files changed, 27 insertions, 12 deletions
diff --git a/src/utilities/bindingManager.vala b/src/utilities/bindingManager.vala index ac5a8fb..38ae1e0 100644 --- a/src/utilities/bindingManager.vala +++ b/src/utilities/bindingManager.vala @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////// -// Copyright (c) 2011-2015 by Simon Schneegans +// Copyright (c) 2011-2016 by Simon Schneegans // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -32,6 +32,12 @@ public class BindingManager : GLib.Object { public signal void on_press(string id); ///////////////////////////////////////////////////////////////////// + /// Called when a previously pressed binding is released again. + ///////////////////////////////////////////////////////////////////// + + public signal void on_release(uint32 time_stamp); + + ///////////////////////////////////////////////////////////////////// /// A list storing bindings, which are invoked even if Gnome-Pie /// doesn't have the current focus ///////////////////////////////////////////////////////////////////// @@ -303,6 +309,12 @@ public class BindingManager : GLib.Object { mods = mods & ~ Gdk.ModifierType.SUPER_MASK; } + mods &= ~(Gdk.ModifierType.BUTTON1_MASK + | Gdk.ModifierType.BUTTON2_MASK + | Gdk.ModifierType.BUTTON3_MASK + | Gdk.ModifierType.BUTTON4_MASK + | Gdk.ModifierType.BUTTON5_MASK); + return mods & ~lock_modifiers[7]; } @@ -319,13 +331,16 @@ public class BindingManager : GLib.Object { X.Event* xevent = (X.Event*) pointer; #endif - if(xevent->type == X.EventType.KeyPress) { - foreach(var binding in bindings) { - // remove NumLock, CapsLock and ScrollLock from key state - var event_mods = prepare_modifiers((Gdk.ModifierType)xevent.xkey.state); - var bound_mods = prepare_modifiers(binding.trigger.modifiers); + if (xevent->type == X.EventType.KeyRelease) { + on_release((uint32)xevent.xkey.time); + } else if (xevent->type == X.EventType.KeyPress) { + // remove NumLock, CapsLock and ScrollLock from key state + var event_mods = prepare_modifiers((Gdk.ModifierType)xevent.xkey.state); + + foreach(var binding in bindings) { + var bound_mods = prepare_modifiers(binding.trigger.modifiers); if(xevent->xkey.keycode == binding.trigger.key_code && event_mods == bound_mods) { @@ -336,14 +351,14 @@ public class BindingManager : GLib.Object { } } } - } - else if(xevent->type == X.EventType.ButtonPress) { - foreach(var binding in bindings) { + } else if(xevent->type == X.EventType.ButtonRelease) { + on_release((uint32)xevent.xkey.time); + } else if(xevent->type == X.EventType.ButtonPress) { + // remove NumLock, CapsLock and ScrollLock from key state + var event_mods = prepare_modifiers((Gdk.ModifierType)xevent.xbutton.state); - // remove NumLock, CapsLock and ScrollLock from key state - var event_mods = prepare_modifiers((Gdk.ModifierType)xevent.xbutton.state); + foreach(var binding in bindings) { var bound_mods = prepare_modifiers(binding.trigger.modifiers); - if(xevent->xbutton.button == binding.trigger.key_code && event_mods == bound_mods) { |