diff options
author | Carlos Garnacho <carlosg@gnome.org> | 2010-06-09 17:52:14 +0200 |
---|---|---|
committer | Carlos Garnacho <carlosg@gnome.org> | 2010-06-24 02:30:54 +0200 |
commit | 604beadbcd8c28326f5f8fbffb28a19b04a7dba0 (patch) | |
tree | 326d121858cb74c45daac9bd7d4bc601fb707d72 /tests/testinput.c | |
parent | 882fdfab78b3b07905c84786bac44767c32c42bd (diff) | |
download | gtk+-604beadbcd8c28326f5f8fbffb28a19b04a7dba0.tar.gz |
testinput: Do not use deprecated API.
Diffstat (limited to 'tests/testinput.c')
-rw-r--r-- | tests/testinput.c | 39 |
1 files changed, 27 insertions, 12 deletions
diff --git a/tests/testinput.c b/tests/testinput.c index 58cded9605..3bd3167c6a 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); |