mirror of
https://github.com/brl/mutter.git
synced 2024-12-25 20:32:16 +00:00
clutter/evdev: disable mousekeys with Numlock ON
The clutter/evdev implementation of mousekeys is designed after the current implementation in X11, and works when the setting is enabled regardless of the status of NumLock. The GNOME documentation on accessibility features states however that mousekeys work only when NumLock is OFF: https://help.gnome.org/users/gnome-help/stable/mouse-mousekeys.html Change the clutter/evdev implementation to match the documentation, i.e. disable mousekeys when NumLock in ON so that switching NumLock ON restores the numeric keypad behaviour. Closes: https://gitlab.gnome.org/GNOME/mutter/issues/530
This commit is contained in:
parent
7df86fb246
commit
471b61bd14
@ -855,6 +855,14 @@ emulate_pointer_motion (ClutterInputDeviceEvdev *device,
|
||||
clutter_virtual_input_device_notify_relative_motion (device->mousekeys_virtual_device,
|
||||
time_us, dx_motion, dy_motion);
|
||||
}
|
||||
static gboolean
|
||||
is_numlock_active (ClutterInputDeviceEvdev *device)
|
||||
{
|
||||
ClutterSeatEvdev *seat = device->seat;
|
||||
return xkb_state_mod_name_is_active (seat->xkb,
|
||||
"Mod2",
|
||||
XKB_STATE_MODS_LOCKED);
|
||||
}
|
||||
|
||||
static void
|
||||
enable_mousekeys (ClutterInputDeviceEvdev *device)
|
||||
@ -1013,6 +1021,10 @@ handle_mousekeys_press (ClutterEvent *event,
|
||||
if (!(event->key.flags & CLUTTER_EVENT_FLAG_SYNTHETIC))
|
||||
stop_mousekeys_move (device);
|
||||
|
||||
/* Do not handle mousekeys if NumLock is ON */
|
||||
if (is_numlock_active (device))
|
||||
return FALSE;
|
||||
|
||||
/* Button selection */
|
||||
switch (event->key.keyval)
|
||||
{
|
||||
@ -1084,6 +1096,10 @@ static gboolean
|
||||
handle_mousekeys_release (ClutterEvent *event,
|
||||
ClutterInputDeviceEvdev *device)
|
||||
{
|
||||
/* Do not handle mousekeys if NumLock is ON */
|
||||
if (is_numlock_active (device))
|
||||
return FALSE;
|
||||
|
||||
switch (event->key.keyval)
|
||||
{
|
||||
case XKB_KEY_KP_0:
|
||||
|
Loading…
Reference in New Issue
Block a user