[gtk+] testinput: Do not use deprecated API.



commit 604beadbcd8c28326f5f8fbffb28a19b04a7dba0
Author: Carlos Garnacho <carlosg gnome org>
Date:   Wed Jun 9 17:52:14 2010 +0200

    testinput: Do not use deprecated API.

 tests/testinput.c |   39 +++++++++++++++++++++++++++------------
 1 files changed, 27 insertions(+), 12 deletions(-)
---
diff --git a/tests/testinput.c b/tests/testinput.c
index 58cded9..3bd3167 100644
--- a/tests/testinput.c
+++ b/tests/testinput.c
@@ -277,6 +277,9 @@ quit (void)
 int
 main (int argc, char *argv[])
 {
+  GdkDeviceManager *device_manager;
+  GList *devices, *d;
+  GdkEventMask event_mask;
   GtkWidget *window;
   GtkWidget *drawing_area;
   GtkWidget *vbox;
@@ -285,7 +288,8 @@ main (int argc, char *argv[])
 
   gtk_init (&argc, &argv);
 
-  current_device = gdk_device_get_core_pointer ();
+  device_manager = gdk_display_get_device_manager (gdk_display_get_default ());
+  current_device = gdk_device_manager_get_client_pointer (device_manager);
 
   window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
   gtk_widget_set_name (window, "Test Input");
@@ -326,17 +330,28 @@ main (int argc, char *argv[])
   g_signal_connect (drawing_area, "proximity_out_event",
 		    G_CALLBACK (proximity_out_event), NULL);
 
-  gtk_widget_set_events (drawing_area, GDK_EXPOSURE_MASK
-			 | GDK_LEAVE_NOTIFY_MASK
-			 | GDK_BUTTON_PRESS_MASK
-			 | GDK_KEY_PRESS_MASK
-			 | GDK_POINTER_MOTION_MASK
-			 | GDK_POINTER_MOTION_HINT_MASK
-			 | GDK_PROXIMITY_OUT_MASK);
-
-  /* The following call enables tracking and processing of extension
-     events for the drawing area */
-  gtk_widget_set_extension_events (drawing_area, GDK_EXTENSION_EVENTS_ALL);
+  event_mask = GDK_EXPOSURE_MASK |
+    GDK_LEAVE_NOTIFY_MASK |
+    GDK_BUTTON_PRESS_MASK |
+    GDK_KEY_PRESS_MASK |
+    GDK_POINTER_MOTION_MASK |
+    GDK_POINTER_MOTION_HINT_MASK |
+    GDK_PROXIMITY_OUT_MASK;
+
+  gtk_widget_set_events (drawing_area, event_mask);
+
+  devices = gdk_device_manager_list_devices (device_manager, GDK_DEVICE_TYPE_FLOATING);
+
+  for (d = devices; d; d = d->next)
+    {
+      GdkDevice *device;
+
+      device = d->data;
+      gtk_widget_set_device_events (drawing_area, device, event_mask);
+      gdk_device_set_mode (device, GDK_MODE_SCREEN);
+    }
+
+  g_list_free (devices);
 
   gtk_widget_set_can_focus (drawing_area, TRUE);
   gtk_widget_grab_focus (drawing_area);



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