mirror of
https://github.com/brl/mutter.git
synced 2024-11-21 23:50:41 -05:00
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
This commit is contained in:
parent
58cc4c2433
commit
ed17559f88
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user