diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-02-11 09:55:11 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-02-11 09:55:11 +0400 |
commit | 48f905d806254eebe66ddbdba8e63266977e63e3 (patch) | |
tree | 5c9e2f4b8c1d89610f3085663d255d52ba419f50 /source/blender/windowmanager/intern/wm_window.c | |
parent | 0ac2f6e7d73bda112db13205d4b91ad98fa975ee (diff) |
fix for modifier keys held before a window was activated being ignored.
Diffstat (limited to 'source/blender/windowmanager/intern/wm_window.c')
-rw-r--r-- | source/blender/windowmanager/intern/wm_window.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/source/blender/windowmanager/intern/wm_window.c b/source/blender/windowmanager/intern/wm_window.c index d8b987a196c..dc0c6115098 100644 --- a/source/blender/windowmanager/intern/wm_window.c +++ b/source/blender/windowmanager/intern/wm_window.c @@ -756,6 +756,7 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr C_void_ptr GHOST_TEventKeyData kdata; wmEvent event; int wx, wy; + bool is_key; wm->winactive = win; /* no context change! c->wm->windrawable is drawable, or for area queues */ @@ -765,21 +766,21 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr C_void_ptr /* bad ghost support for modifier keys... so on activate we set the modifiers again */ kdata.ascii = '\0'; kdata.utf8_buf[0] = '\0'; - if (win->eventstate->shift && !query_qual(SHIFT)) { + if ((win->eventstate->shift != 0) != ((is_key = query_qual(SHIFT)) != 0)) { kdata.key = GHOST_kKeyLeftShift; - wm_event_add_ghostevent(wm, win, GHOST_kEventKeyUp, time, &kdata); + wm_event_add_ghostevent(wm, win, is_key ? GHOST_kEventKeyDown : GHOST_kEventKeyUp, time, &kdata); } - if (win->eventstate->ctrl && !query_qual(CONTROL)) { + if ((win->eventstate->ctrl != 0) != ((is_key = query_qual(CONTROL)) != 0)) { kdata.key = GHOST_kKeyLeftControl; - wm_event_add_ghostevent(wm, win, GHOST_kEventKeyUp, time, &kdata); + wm_event_add_ghostevent(wm, win, is_key ? GHOST_kEventKeyDown : GHOST_kEventKeyUp, time, &kdata); } - if (win->eventstate->alt && !query_qual(ALT)) { + if ((win->eventstate->alt != 0) != ((is_key = query_qual(ALT)) != 0)) { kdata.key = GHOST_kKeyLeftAlt; - wm_event_add_ghostevent(wm, win, GHOST_kEventKeyUp, time, &kdata); + wm_event_add_ghostevent(wm, win, is_key ? GHOST_kEventKeyDown : GHOST_kEventKeyUp, time, &kdata); } - if (win->eventstate->oskey && !query_qual(OS)) { + if ((win->eventstate->oskey != 0) != ((is_key = query_qual(OS)) != 0)) { kdata.key = GHOST_kKeyOS; - wm_event_add_ghostevent(wm, win, GHOST_kEventKeyUp, time, &kdata); + wm_event_add_ghostevent(wm, win, is_key ? GHOST_kEventKeyDown : GHOST_kEventKeyUp, time, &kdata); } /* keymodifier zero, it hangs on hotkeys that open windows otherwise */ win->eventstate->keymodifier = 0; |