summaryrefslogtreecommitdiff
path: root/src/utilities/bindingManager.vala
diff options
context:
space:
mode:
Diffstat (limited to 'src/utilities/bindingManager.vala')
-rw-r--r--src/utilities/bindingManager.vala34
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);