[gtk+] demos: Modify "Change display" demo to use seat grabs



commit 2c0446917d3a606fd9336e444a6241f9a02f5b03
Author: Carlos Garnacho <carlosg gnome org>
Date:   Thu Jan 28 12:04:13 2016 +0100

    demos: Modify "Change display" demo to use seat grabs
    
    The window picking feature was done through a pointer grab, replace
    it by a seat grab on pointing devices.

 demos/gtk-demo/changedisplay.c |   13 ++++++-------
 1 files changed, 6 insertions(+), 7 deletions(-)
---
diff --git a/demos/gtk-demo/changedisplay.c b/demos/gtk-demo/changedisplay.c
index f51d091..37c364f 100644
--- a/demos/gtk-demo/changedisplay.c
+++ b/demos/gtk-demo/changedisplay.c
@@ -108,6 +108,7 @@ query_for_toplevel (GdkScreen  *screen,
   GtkWidget *popup, *label, *frame;
   GdkCursor *cursor;
   GtkWidget *toplevel = NULL;
+  GdkDevice *device;
 
   popup = gtk_window_new (GTK_WINDOW_POPUP);
   gtk_window_set_screen (GTK_WINDOW (popup), screen);
@@ -124,14 +125,12 @@ query_for_toplevel (GdkScreen  *screen,
 
   gtk_widget_show_all (popup);
   cursor = gdk_cursor_new_from_name (display, "crosshair");
+  device = gtk_get_current_event_device ();
 
-  if (gdk_device_grab (gtk_get_current_event_device (),
-                       gtk_widget_get_window (popup),
-                       GDK_OWNERSHIP_NONE,
-                       FALSE,
-                       GDK_BUTTON_RELEASE_MASK,
-                       cursor,
-                       GDK_CURRENT_TIME) == GDK_GRAB_SUCCESS)
+  if (gdk_seat_grab (gdk_device_get_seat (device),
+                     gtk_widget_get_window (popup),
+                     GDK_SEAT_CAPABILITY_ALL_POINTING,
+                     FALSE, cursor, NULL, NULL, NULL) == GDK_GRAB_SUCCESS)
     {
       gboolean clicked = FALSE;
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]