From a4440b718d17dccf9a7def882b42bb2f976510e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=85dahl?= Date: Wed, 18 Sep 2013 21:56:06 +0200 Subject: [PATCH] wayland: Keep track of button modifier state MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Keep track of the button modifier mask state in ClutterInputDeviceWayland and push its state to new button events going out. Signed-off-by: Jonas Ã…dahl https://bugzilla.gnome.org/show_bug.cgi?id=708781 --- clutter/wayland/clutter-input-device-wayland.c | 14 ++++++++++++++ clutter/wayland/clutter-input-device-wayland.h | 1 + 2 files changed, 15 insertions(+) diff --git a/clutter/wayland/clutter-input-device-wayland.c b/clutter/wayland/clutter-input-device-wayland.c index 94a818698..1dc6c7c39 100644 --- a/clutter/wayland/clutter-input-device-wayland.c +++ b/clutter/wayland/clutter-input-device-wayland.c @@ -107,6 +107,7 @@ clutter_wayland_handle_button (void *data, ClutterStageCogl *stage_cogl; ClutterEvent *event; ClutterEventType type; + ClutterModifierType modifier_mask = 0; if (!device->pointer_focus) return; @@ -130,15 +131,28 @@ clutter_wayland_handle_button (void *data, switch (button) { case 272: event->button.button = 1; + modifier_mask = CLUTTER_BUTTON1_MASK; break; case 273: event->button.button = 3; + modifier_mask = CLUTTER_BUTTON2_MASK; break; case 274: event->button.button = 2; + modifier_mask = CLUTTER_BUTTON3_MASK; break; } + if (modifier_mask) + { + if (state) + device->button_modifier_state |= modifier_mask; + else + device->button_modifier_state &= ~modifier_mask; + } + + event->button.modifier_state = device->button_modifier_state; + _clutter_event_push (event, FALSE); } diff --git a/clutter/wayland/clutter-input-device-wayland.h b/clutter/wayland/clutter-input-device-wayland.h index 22de8b1cf..d242ac41c 100644 --- a/clutter/wayland/clutter-input-device-wayland.h +++ b/clutter/wayland/clutter-input-device-wayland.h @@ -53,6 +53,7 @@ struct _ClutterInputDeviceWayland guint repeat_time; guint repeat_source; gboolean is_initial_repeat; + ClutterModifierType button_modifier_state; }; GType _clutter_input_device_wayland_get_type (void) G_GNUC_CONST;