diff options
author | Matthias Clasen <mclasen@redhat.com> | 2017-08-26 10:56:25 -0400 |
---|---|---|
committer | Carlos Garnacho <carlosg@gnome.org> | 2017-09-19 18:39:03 +0200 |
commit | 75b16ac855654b9b932a3fa29c523218163b3c04 (patch) | |
tree | 23073dda1bf7ba14585f1f7f99b4cbaa803e05ee /gtk | |
parent | ebc66eefa8ad3e6e2d6ed83a202c78e5faab27b8 (diff) | |
download | gtk+-75b16ac855654b9b932a3fa29c523218163b3c04.tar.gz |
pad controller: Use GdkEvent API
Diffstat (limited to 'gtk')
-rw-r--r-- | gtk/gtkpadcontroller.c | 26 |
1 files changed, 10 insertions, 16 deletions
diff --git a/gtk/gtkpadcontroller.c b/gtk/gtkpadcontroller.c index 2d420e0256..ad4457a4bf 100644 --- a/gtk/gtkpadcontroller.c +++ b/gtk/gtkpadcontroller.c @@ -235,14 +235,16 @@ gtk_pad_controller_handle_event (GtkEventController *controller, GdkEventType event_type = gdk_event_get_event_type (event); const GtkPadActionEntry *entry; GtkPadActionType type; - gint index, mode; + guint index, mode, group; + gdouble value = 0; + gdk_event_get_pad_group_mode (event, &group, &mode); if (event_type == GDK_PAD_GROUP_MODE) { gtk_pad_controller_handle_mode_switch (pad_controller, gdk_event_get_source_device (event), - event->pad_group_mode.group, - event->pad_group_mode.mode); + group, + mode); return GDK_EVENT_PROPAGATE; } @@ -250,15 +252,13 @@ gtk_pad_controller_handle_event (GtkEventController *controller, { case GDK_PAD_BUTTON_PRESS: type = GTK_PAD_ACTION_BUTTON; - index = event->pad_button.button; - mode = event->pad_button.mode; + gdk_event_get_pad_button (event, &index); break; case GDK_PAD_RING: case GDK_PAD_STRIP: type = event_type == GDK_PAD_RING ? GTK_PAD_ACTION_RING : GTK_PAD_ACTION_STRIP; - index = event->pad_axis.index; - mode = event->pad_axis.mode; + gdk_event_get_pad_axis_value (event, &index, &value); break; default: return GDK_EVENT_PROPAGATE; @@ -269,16 +269,10 @@ gtk_pad_controller_handle_event (GtkEventController *controller, if (!entry) return GDK_EVENT_PROPAGATE; - if (event_type == GDK_PAD_RING || - event_type == GDK_PAD_STRIP) - { - gtk_pad_controller_activate_action_with_axis (pad_controller, entry, - event->pad_axis.value); - } + if (event_type == GDK_PAD_RING || event_type == GDK_PAD_STRIP) + gtk_pad_controller_activate_action_with_axis (pad_controller, entry, value); else - { - gtk_pad_controller_activate_action (pad_controller, entry); - } + gtk_pad_controller_activate_action (pad_controller, entry); return GDK_EVENT_STOP; } |