diff options
author | Daniel Stone <daniels@collabora.com> | 2015-11-20 15:37:30 +0000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2015-11-24 11:36:34 +1000 |
commit | 816015648ffe660ddaa0f7d4d192e555b723c372 (patch) | |
tree | 0053c4325903d20b09df2e35deb1579d76c344e9 /xkb | |
parent | c3788394e9190130a8eed44c5c93eeb93c2a9893 (diff) |
Input: Add focus-in event source
Add a new event source type for keypress events synthesised from focus
notifications (e.g. KeymapNotify from the parent server, when running
nested). This is used to keep the keys-down array in sync with the host
server's, without sending actual keypress events to clients.
Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'xkb')
-rw-r--r-- | xkb/xkbActions.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/xkb/xkbActions.c b/xkb/xkbActions.c index ddd09abd1..aeb702c63 100644 --- a/xkb/xkbActions.c +++ b/xkb/xkbActions.c @@ -1206,6 +1206,32 @@ XkbActionGetFilter(DeviceIntPtr dev, DeviceEvent *event, KeyCode key, XkbSrvInfoPtr xkbi = dev->key->xkbInfo; XkbFilterPtr filter; + /* For focus events, we only want to run actions which update our state to + * (hopefully vaguely kinda) match that of the host server, rather than + * actually execute anything. For example, if we enter our VT with + * Ctrl+Alt+Backspace held down, we don't want to terminate our server + * immediately, but we _do_ want Ctrl+Alt to be latched down, so if + * Backspace is released and then pressed again, the server will terminate. + * + * This is pretty flaky, and we should in fact inherit the complete state + * from the host server. There are some state combinations that we cannot + * express by running the state machine over every key, e.g. if AltGr+Shift + * generates a different state to Shift+AltGr. */ + if (event->source_type == EVENT_SOURCE_FOCUS) { + switch (act->type) { + case XkbSA_SetMods: + case XkbSA_SetGroup: + case XkbSA_LatchMods: + case XkbSA_LatchGroup: + case XkbSA_LockMods: + case XkbSA_LockGroup: + break; + default: + *sendEvent = 1; + return; + } + } + switch (act->type) { case XkbSA_SetMods: case XkbSA_SetGroup: |