Guest User

Untitled

a guest
Oct 29th, 2017
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Vala 0.71 KB | None | 0 0
  1.     /* Code from Gnome-Do */
  2.     private static bool try_grab_window (Gtk.Window window)
  3.     {
  4.       uint time = Gtk.get_current_event_time();
  5.       if (Gdk.pointer_grab (window.get_window(),
  6.             true,
  7.             Gdk.EventMask.BUTTON_PRESS_MASK |
  8.             Gdk.EventMask.BUTTON_RELEASE_MASK |
  9.             Gdk.EventMask.POINTER_MOTION_MASK,
  10.             null,
  11.             null,
  12.             time) == Gdk.GrabStatus.SUCCESS)
  13.       {
  14.         if (Gdk.keyboard_grab (window.get_window(), true, time) == Gdk.GrabStatus.SUCCESS) {
  15.           Gtk.grab_add (window);
  16.           return true;
  17.         } else {
  18.           Gdk.pointer_ungrab (time);
  19.           return false;
  20.         }
  21.       }
  22.       return false;
  23.     }
Add Comment
Please, Sign In to add comment