From 60560a030fda3c539ff9dc1563b9926414a193da Mon Sep 17 00:00:00 2001 From: Alessandro Ghedini Date: Sat, 21 Jan 2012 19:07:09 +0100 Subject: Imported Upstream version 0.4.0 --- src/utilities/bindingManager.vala | 34 ++++++++++++++++++++++++++-------- 1 file changed, 26 insertions(+), 8 deletions(-) (limited to 'src/utilities/bindingManager.vala') 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 remove_bindings = new Gee.ArrayList(); foreach(var binding in bindings) { if(id == binding.id) { @@ -184,6 +189,20 @@ public class BindingManager : GLib.Object { return false; } + ///////////////////////////////////////////////////////////////////// + /// 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); -- cgit v1.2.3