[gtk+/wayland-selections: 6/17] wayland: Store button and key modifiers separately
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wayland-selections: 6/17] wayland: Store button and key modifiers separately
- Date: Fri, 22 Aug 2014 14:13:29 +0000 (UTC)
commit 21b6a5f19fb1a647f51ae818bdec2bdc2928f820
Author: Carlos Garnacho <carlosg gnome org>
Date: Wed Aug 20 20:49:43 2014 +0200
wayland: Store button and key modifiers separately
That way the key and modifiers() and key handlers can't unset the button
state, both modifier masks are put together when creating the events.
gdk/wayland/gdkdevice-wayland.c | 19 ++++++++++---------
1 files changed, 10 insertions(+), 9 deletions(-)
---
diff --git a/gdk/wayland/gdkdevice-wayland.c b/gdk/wayland/gdkdevice-wayland.c
index 19eb2b6..48771d0 100644
--- a/gdk/wayland/gdkdevice-wayland.c
+++ b/gdk/wayland/gdkdevice-wayland.c
@@ -73,6 +73,7 @@ struct _GdkWaylandDeviceData
GHashTable *touches;
GdkModifierType modifiers;
+ GdkModifierType button_modifiers;
GdkWindow *pointer_focus;
GdkWindow *keyboard_focus;
struct wl_data_device *data_device;
@@ -317,7 +318,7 @@ gdk_wayland_device_query_state (GdkDevice *device,
if (child_window)
*child_window = wd->pointer_focus;
if (mask)
- *mask = wd->modifiers;
+ *mask = wd->modifiers | wd->button_modifiers;
get_coordinates (wd, win_x, win_y, root_x, root_y);
}
@@ -413,7 +414,7 @@ gdk_wayland_device_window_at_position (GdkDevice *device,
if (win_y)
*win_y = wd->surface_y;
if (mask)
- *mask = wd->modifiers;
+ *mask = wd->modifiers | wd->button_modifiers;
return wd->pointer_focus;
}
@@ -796,7 +797,7 @@ pointer_handle_motion (void *data,
gdk_event_set_source_device (event, device->pointer);
event->motion.time = time;
event->motion.axes = NULL;
- event->motion.state = device->modifiers;
+ event->motion.state = device->modifiers | device->button_modifiers;
event->motion.is_hint = 0;
gdk_event_set_screen (event, display->screen);
@@ -856,7 +857,7 @@ pointer_handle_button (void *data,
gdk_event_set_source_device (event, device->pointer);
event->button.time = time;
event->button.axes = NULL;
- event->button.state = device->modifiers;
+ event->button.state = device->modifiers | device->button_modifiers;
event->button.button = gdk_button;
gdk_event_set_screen (event, display->screen);
@@ -868,9 +869,9 @@ pointer_handle_button (void *data,
modifier = 1 << (8 + gdk_button - 1);
if (state)
- device->modifiers |= modifier;
+ device->button_modifiers |= modifier;
else
- device->modifiers &= ~modifier;
+ device->button_modifiers &= ~modifier;
GDK_NOTE (EVENTS,
g_message ("button %d %s, state %d",
@@ -918,7 +919,7 @@ pointer_handle_axis (void *data,
event->scroll.direction = GDK_SCROLL_SMOOTH;
event->scroll.delta_x = delta_x;
event->scroll.delta_y = delta_y;
- event->scroll.state = device->modifiers;
+ event->scroll.state = device->modifiers | device->button_modifiers;
gdk_event_set_screen (event, display->screen);
get_coordinates (device,
@@ -1178,7 +1179,7 @@ deliver_key_event (GdkWaylandDeviceData *device,
gdk_event_set_device (event, device->master_keyboard);
gdk_event_set_source_device (event, device->keyboard);
event->key.time = time_;
- event->key.state = device->modifiers;
+ event->key.state = device->modifiers | device->button_modifiers;
event->key.group = 0;
event->key.hardware_keycode = key;
event->key.keyval = sym;
@@ -1351,7 +1352,7 @@ _create_touch_event (GdkWaylandDeviceData *device,
gdk_event_set_device (event, device->master_pointer);
gdk_event_set_source_device (event, device->touch);
event->touch.time = time;
- event->touch.state = device->modifiers;
+ event->touch.state = device->modifiers | device->button_modifiers;
gdk_event_set_screen (event, display->screen);
event->touch.sequence = GDK_SLOT_TO_EVENT_SEQUENCE (touch->id);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]