summaryrefslogtreecommitdiff
path: root/gdk/wayland
diff options
context:
space:
mode:
authorKristian Høgsberg <krh@bitplanet.net>2012-01-17 12:30:52 -0500
committerKristian Høgsberg <krh@bitplanet.net>2012-01-18 12:04:18 -0500
commit4c79e2591517acdc78a061da2a93412bb7d47c0e (patch)
treedf76f7a6886d74f063d7698db28760ffa15b2c86 /gdk/wayland
parent29641ecd078c279327cbca5a30ca8426089aed5e (diff)
downloadgtk+-4c79e2591517acdc78a061da2a93412bb7d47c0e.tar.gz
wayland: Report middle and right buttons correctly
The linux evdev button codes have right as 274 and left as 273.
Diffstat (limited to 'gdk/wayland')
-rw-r--r--gdk/wayland/gdkdevice-wayland.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/gdk/wayland/gdkdevice-wayland.c b/gdk/wayland/gdkdevice-wayland.c
index a749c72d29..cc79ebf846 100644
--- a/gdk/wayland/gdkdevice-wayland.c
+++ b/gdk/wayland/gdkdevice-wayland.c
@@ -378,6 +378,19 @@ input_handle_button(void *data, struct wl_input_device *input_device,
GdkDisplayWayland *display = GDK_DISPLAY_WAYLAND (device->display);
GdkEvent *event;
uint32_t modifier;
+ int gdk_button;
+
+ switch (button) {
+ case 273:
+ gdk_button = 3;
+ break;
+ case 274:
+ gdk_button = 2;
+ break;
+ default:
+ gdk_button = button - 271;
+ break;
+ }
device->time = time;
event = gdk_event_new (state ? GDK_BUTTON_PRESS : GDK_BUTTON_RELEASE);
@@ -390,10 +403,10 @@ input_handle_button(void *data, struct wl_input_device *input_device,
event->button.y_root = (gdouble) device->y;
event->button.axes = NULL;
event->button.state = device->modifiers;
- event->button.button = button - 271;
+ event->button.button = gdk_button;
gdk_event_set_screen (event, display->screen);
- modifier = 1 << (8 + button - 272);
+ modifier = 1 << (8 + gdk_button - 1);
if (state)
device->modifiers |= modifier;
else