Xi: access the prev_state to get group/modifier state for key events.

Key events may change the modifier state, so we need to get the prev_state for
those (i.e. without the changes by the event already applied).

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
Peter Hutterer 2009-05-05 16:57:46 +10:00
parent 35a4b8e7f4
commit 1b593ced17

View File

@ -983,13 +983,20 @@ ProcessOtherEvent(InternalEvent *ev, DeviceIntPtr device)
if (kbd && kbd->key) if (kbd && kbd->key)
{ {
event->mods.base = kbd->key->xkbInfo->state.base_mods; XkbStatePtr state;
event->mods.latched = kbd->key->xkbInfo->state.latched_mods; /* we need the state before the event happens */
event->mods.locked = kbd->key->xkbInfo->state.locked_mods; if (event->type == ET_KeyPress || event->type == ET_KeyRelease)
state = &kbd->key->xkbInfo->prev_state;
else
state = &kbd->key->xkbInfo->state;
event->group.base = kbd->key->xkbInfo->state.base_group; event->mods.base = state->base_mods;
event->group.latched = kbd->key->xkbInfo->state.latched_group; event->mods.latched = state->latched_mods;
event->group.locked = kbd->key->xkbInfo->state.locked_group; event->mods.locked = state->locked_mods;
event->group.base = state->base_group;
event->group.latched = state->latched_group;
event->group.locked = state->locked_group;
} }
ret = UpdateDeviceState(device, event); ret = UpdateDeviceState(device, event);