Modifiers are unset on events for the modifier key itself

This patch removes modifiers when processing key events for the
particular modifier key. For example, previously a Shift keypress
would register as a Shift + Shift modifier event.

This would cause issues when a modifier key as the action key in
the input map, because unpresses of the modifier key don't match as
matching inputs for that action. E.g. if Shift is used as an action,
the stored action event is Shift + Shift modifier (as indicated
in the editor as "Shift + Shift". The unpress event does not have the
Shift modifier set, so the event of unpressing Shift + no modifier
doesn't match the action which has the modifier set.

This patch removes the shift modifier on just pressing the Shift
key down, so the action event is registered as just Shift with
no modifier (as indicated in the editor as "Shift"), which matches
the unpress event.
This commit is contained in:
Manuel Lagang 2015-01-17 22:40:01 -08:00
parent 3e7d475b59
commit fa62125e05

View file

@ -589,10 +589,11 @@ LRESULT OS_Windows::WndProc(HWND hWnd,UINT uMsg, WPARAM wParam, LPARAM lParam) {
ERR_BREAK(key_event_pos >= KEY_EVENT_BUFFER_SIZE);
// Make sure we don't include modifiers for the modifier key itself.
KeyEvent ke;
ke.mod_state.shift=shift_mem;
ke.mod_state.alt=alt_mem;
ke.mod_state.control=control_mem;
ke.mod_state.shift= (wParam != VK_SHIFT) ? shift_mem : false;
ke.mod_state.alt= (! (wParam == VK_MENU && (uMsg == WM_KEYDOWN || uMsg == WM_SYSKEYDOWN))) ? alt_mem : false;
ke.mod_state.control= (wParam != VK_CONTROL) ? control_mem : false;
ke.mod_state.meta=meta_mem;
ke.uMsg=uMsg;