wayland: Keep track of button modifier state

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 <jadahl@gmail.com>

https://bugzilla.gnome.org/show_bug.cgi?id=708781
This commit is contained in:
Jonas Ådahl 2013-09-18 21:56:06 +02:00 committed by Matthias Clasen
parent a96daf82c2
commit a4440b718d
2 changed files with 15 additions and 0 deletions

View File

@ -107,6 +107,7 @@ clutter_wayland_handle_button (void *data,
ClutterStageCogl *stage_cogl; ClutterStageCogl *stage_cogl;
ClutterEvent *event; ClutterEvent *event;
ClutterEventType type; ClutterEventType type;
ClutterModifierType modifier_mask = 0;
if (!device->pointer_focus) if (!device->pointer_focus)
return; return;
@ -130,15 +131,28 @@ clutter_wayland_handle_button (void *data,
switch (button) { switch (button) {
case 272: case 272:
event->button.button = 1; event->button.button = 1;
modifier_mask = CLUTTER_BUTTON1_MASK;
break; break;
case 273: case 273:
event->button.button = 3; event->button.button = 3;
modifier_mask = CLUTTER_BUTTON2_MASK;
break; break;
case 274: case 274:
event->button.button = 2; event->button.button = 2;
modifier_mask = CLUTTER_BUTTON3_MASK;
break; 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); _clutter_event_push (event, FALSE);
} }

View File

@ -53,6 +53,7 @@ struct _ClutterInputDeviceWayland
guint repeat_time; guint repeat_time;
guint repeat_source; guint repeat_source;
gboolean is_initial_repeat; gboolean is_initial_repeat;
ClutterModifierType button_modifier_state;
}; };
GType _clutter_input_device_wayland_get_type (void) G_GNUC_CONST; GType _clutter_input_device_wayland_get_type (void) G_GNUC_CONST;