From ed17559f88314c993d0da5e3364063fa8782f95e Mon Sep 17 00:00:00 2001 From: Olivier Fourdan Date: Mon, 4 Mar 2019 12:43:50 +0100 Subject: [PATCH] clutter/evdev: Use internal button codes for mousekeys The ClutterVirtualInputDevice API was fixed to use Clutter button internal codes, whereas the mousekeys still uses evdev codes. Change the mousekeys implementation to use the Clutter button code instead to remain compatible with the ClutterVirtualInputDevice API. Fixes: 24aef44b (Translate from button internal codes to evdev) https://gitlab.gnome.org/GNOME/mutter/merge_requests/473 --- .../evdev/clutter-input-device-evdev.c | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/clutter/clutter/evdev/clutter-input-device-evdev.c b/clutter/clutter/evdev/clutter-input-device-evdev.c index 76bee0785..8caf09572 100644 --- a/clutter/clutter/evdev/clutter-input-device-evdev.c +++ b/clutter/clutter/evdev/clutter-input-device-evdev.c @@ -724,11 +724,11 @@ get_button_index (gint button) { switch (button) { - case BTN_LEFT: + case CLUTTER_BUTTON_PRIMARY: return 0; - case BTN_MIDDLE: + case CLUTTER_BUTTON_MIDDLE: return 1; - case BTN_RIGHT: + case CLUTTER_BUTTON_SECONDARY: return 2; default: break; @@ -861,7 +861,7 @@ enable_mousekeys (ClutterInputDeviceEvdev *device) { ClutterDeviceManager *manager; - device->mousekeys_btn = BTN_LEFT; + device->mousekeys_btn = CLUTTER_BUTTON_PRIMARY; device->move_mousekeys_timer = 0; device->mousekeys_first_motion_time = 0; device->mousekeys_last_motion_time = 0; @@ -882,21 +882,21 @@ disable_mousekeys (ClutterInputDeviceEvdev *device) stop_mousekeys_move (device); /* Make sure we don't leave button pressed behind... */ - if (device->mousekeys_btn_states[get_button_index (BTN_LEFT)]) + if (device->mousekeys_btn_states[get_button_index (CLUTTER_BUTTON_PRIMARY)]) { - device->mousekeys_btn = BTN_LEFT; + device->mousekeys_btn = CLUTTER_BUTTON_PRIMARY; emulate_button_release (device); } - if (device->mousekeys_btn_states[get_button_index (BTN_MIDDLE)]) + if (device->mousekeys_btn_states[get_button_index (CLUTTER_BUTTON_MIDDLE)]) { - device->mousekeys_btn = BTN_MIDDLE; + device->mousekeys_btn = CLUTTER_BUTTON_MIDDLE; emulate_button_release (device); } - if (device->mousekeys_btn_states[get_button_index (BTN_RIGHT)]) + if (device->mousekeys_btn_states[get_button_index (CLUTTER_BUTTON_SECONDARY)]) { - device->mousekeys_btn = BTN_RIGHT; + device->mousekeys_btn = CLUTTER_BUTTON_SECONDARY; emulate_button_release (device); } @@ -1017,13 +1017,13 @@ handle_mousekeys_press (ClutterEvent *event, switch (event->key.keyval) { case XKB_KEY_KP_Divide: - device->mousekeys_btn = BTN_LEFT; + device->mousekeys_btn = CLUTTER_BUTTON_PRIMARY; return TRUE; case XKB_KEY_KP_Multiply: - device->mousekeys_btn = BTN_MIDDLE; + device->mousekeys_btn = CLUTTER_BUTTON_MIDDLE; return TRUE; case XKB_KEY_KP_Subtract: - device->mousekeys_btn = BTN_RIGHT; + device->mousekeys_btn = CLUTTER_BUTTON_SECONDARY; return TRUE; default: break;