diff options
author | Benjamin Otte <otte@redhat.com> | 2011-11-09 03:20:22 +0100 |
---|---|---|
committer | Benjamin Otte <otte@redhat.com> | 2011-11-09 03:23:43 +0100 |
commit | 8e4a45eb124088bd35cc4b28f6203a96cac801e2 (patch) | |
tree | c151dfa6332ca864645d8b7d9716fa187ddecb3c /examples | |
parent | 198a35fde50816580da70263bfd29b4bf03bb1c3 (diff) | |
download | gtk+-8e4a45eb124088bd35cc4b28f6203a96cac801e2.tar.gz |
exanmples: Don't use deprecated API
Diffstat (limited to 'examples')
-rw-r--r-- | examples/drawing.c | 22 |
1 files changed, 3 insertions, 19 deletions
diff --git a/examples/drawing.c b/examples/drawing.c index 28f291b8b8..1534b451bc 100644 --- a/examples/drawing.c +++ b/examples/drawing.c @@ -109,27 +109,12 @@ motion_notify_event_cb (GtkWidget *widget, GdkEventMotion *event, gpointer data) { - int x, y; - GdkModifierType state; - /* paranoia check, in case we haven't gotten a configure event */ if (surface == NULL) return FALSE; - /* This call is very important; it requests the next motion event. - * If you don't call gdk_window_get_pointer() you'll only get - * a single motion event. The reason is that we specified - * GDK_POINTER_MOTION_HINT_MASK to gtk_widget_set_events(). - * If we hadn't specified that, we could just use event->x, event->y - * as the pointer location. But we'd also get deluged in events. - * By requesting the next event as we handle the current one, - * we avoid getting a huge number of events faster than we - * can cope. - */ - gdk_window_get_pointer (event->window, &x, &y, &state); - - if (state & GDK_BUTTON1_MASK) - draw_brush (widget, x, y); + if (event->state & GDK_BUTTON1_MASK) + draw_brush (widget, event->x, event->y); /* We've handled it, stop processing */ return TRUE; @@ -189,8 +174,7 @@ main (int argc, */ gtk_widget_set_events (da, gtk_widget_get_events (da) | GDK_BUTTON_PRESS_MASK - | GDK_POINTER_MOTION_MASK - | GDK_POINTER_MOTION_HINT_MASK); + | GDK_POINTER_MOTION_MASK); gtk_widget_show_all (window); |