mirror of
https://github.com/brl/mutter.git
synced 2024-12-25 20:32:16 +00:00
wayland-keyboard: Send modifiers after the key event
The key event should be interpreted by clients with the modifier state as it was before the event itself just as in X11 input events. Achieving this in wayland is a matter of sending the key event first and the modifiers after (if needed). This isn't really specified in the wayland protocol but it matches weston's behavior and should avoid corner cases in clients. https://bugzilla.gnome.org/show_bug.cgi?id=738238
This commit is contained in:
parent
cb084cc841
commit
4040a70781
@ -434,16 +434,10 @@ meta_wayland_keyboard_update (MetaWaylandKeyboard *keyboard,
|
||||
const ClutterKeyEvent *event)
|
||||
{
|
||||
gboolean is_press = event->type == CLUTTER_KEY_PRESS;
|
||||
struct xkb_state *state = keyboard->xkb_info.state;
|
||||
enum xkb_state_component changed_state;
|
||||
|
||||
changed_state = xkb_state_update_key (state,
|
||||
event->hardware_keycode,
|
||||
is_press ? XKB_KEY_DOWN : XKB_KEY_UP);
|
||||
if (changed_state == 0)
|
||||
return;
|
||||
|
||||
notify_modifiers (keyboard);
|
||||
keyboard->mods_changed = xkb_state_update_key (keyboard->xkb_info.state,
|
||||
event->hardware_keycode,
|
||||
is_press ? XKB_KEY_DOWN : XKB_KEY_UP);
|
||||
}
|
||||
|
||||
gboolean
|
||||
@ -469,6 +463,12 @@ meta_wayland_keyboard_handle_event (MetaWaylandKeyboard *keyboard,
|
||||
else
|
||||
meta_verbose ("No wayland surface is focused, continuing normal operation\n");
|
||||
|
||||
if (keyboard->mods_changed != 0)
|
||||
{
|
||||
notify_modifiers (keyboard);
|
||||
keyboard->mods_changed = 0;
|
||||
}
|
||||
|
||||
return handled;
|
||||
}
|
||||
|
||||
|
@ -70,6 +70,7 @@ struct _MetaWaylandKeyboard
|
||||
uint32_t focus_serial;
|
||||
|
||||
MetaWaylandXkbInfo xkb_info;
|
||||
enum xkb_state_component mods_changed;
|
||||
|
||||
GSettings *settings;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user