diff options
author | Alessandro Ghedini <al3xbio@gmail.com> | 2012-01-21 19:14:06 +0100 |
---|---|---|
committer | Alessandro Ghedini <al3xbio@gmail.com> | 2012-01-21 19:19:46 +0100 |
commit | c05883f47c498be4e11893e5178c5bc37ffd9f4a (patch) | |
tree | dbd3cd7ad3d7771405ad63af2f1e9d14d4ae5a35 /src/utilities/bindingManager.vala | |
parent | 31539042f11bc210a29e923f45586779c3ad46b2 (diff) | |
parent | 60560a030fda3c539ff9dc1563b9926414a193da (diff) |
Merge commit 'upstream/0.4.0'
Diffstat (limited to 'src/utilities/bindingManager.vala')
-rw-r--r-- | src/utilities/bindingManager.vala | 34 |
1 files changed, 26 insertions, 8 deletions
diff --git a/src/utilities/bindingManager.vala b/src/utilities/bindingManager.vala index 437f4c1..5a4548e 100644 --- a/src/utilities/bindingManager.vala +++ b/src/utilities/bindingManager.vala @@ -54,6 +54,12 @@ public class BindingManager : GLib.Object { Gdk.ModifierType.MOD2_MASK|Gdk.ModifierType.LOCK_MASK|Gdk.ModifierType.MOD5_MASK }; + ///////////////////////////////////////////////////////////////////// + /// Some variables to remember which delayed binding was delayed. + /// When the delay passes without another event indicating that the + /// Trigger was released, the stored binding will be activated. + ///////////////////////////////////////////////////////////////////// + private uint32 delayed_count = 0; private X.Event? delayed_event = null; private Keybinding? delayed_binding = null; @@ -91,9 +97,8 @@ public class BindingManager : GLib.Object { public void bind(Trigger trigger, string id) { if(trigger.key_code != 0) { - Gdk.Window rootwin = Gdk.get_default_root_window(); - X.Display display = Gdk.x11_drawable_get_xdisplay(rootwin); - X.ID xid = Gdk.x11_drawable_get_xid(rootwin); + X.Display display = Gdk.x11_get_default_xdisplay(); + X.ID xid = Gdk.x11_get_default_root_xwindow(); Gdk.error_trap_push(); @@ -121,9 +126,9 @@ public class BindingManager : GLib.Object { ///////////////////////////////////////////////////////////////////// public void unbind(string id) { - Gdk.Window rootwin = Gdk.get_default_root_window(); - X.Display display = Gdk.x11_drawable_get_xdisplay(rootwin); - X.ID xid = Gdk.x11_drawable_get_xid(rootwin); + X.Display display = Gdk.x11_get_default_xdisplay(); + X.ID xid = Gdk.x11_get_default_root_xwindow(); + Gee.List<Keybinding> remove_bindings = new Gee.ArrayList<Keybinding>(); foreach(var binding in bindings) { if(id == binding.id) { @@ -185,6 +190,20 @@ public class BindingManager : GLib.Object { } ///////////////////////////////////////////////////////////////////// + /// Returns whether the pie with the given ID opens centered. + ///////////////////////////////////////////////////////////////////// + + public bool get_is_centered(string id) { + foreach (var binding in bindings) { + if (binding.id == id) { + return binding.trigger.centered; + } + } + + return false; + } + + ///////////////////////////////////////////////////////////////////// /// Returns the name ID of the Pie bound to the given Trigger. /// Returns "" if there is nothing bound to this trigger. ///////////////////////////////////////////////////////////////////// @@ -258,8 +277,7 @@ public class BindingManager : GLib.Object { // if the trigger is released and an event is currently waiting // simulate that the trigger has been pressed without any inter- // ference of Gnome-Pie - Gdk.Window rootwin = Gdk.get_default_root_window(); - X.Display display = Gdk.x11_drawable_get_xdisplay(rootwin); + X.Display display = Gdk.x11_get_default_xdisplay(); // unbind the trigger, else we'll capture that event again ;) unbind(delayed_binding.id); |