diff options
Diffstat (limited to 'source/blender/windowmanager/intern')
-rw-r--r-- | source/blender/windowmanager/intern/wm_window.c | 63 |
1 files changed, 50 insertions, 13 deletions
diff --git a/source/blender/windowmanager/intern/wm_window.c b/source/blender/windowmanager/intern/wm_window.c index 44e31f46167..ddc20e36fef 100644 --- a/source/blender/windowmanager/intern/wm_window.c +++ b/source/blender/windowmanager/intern/wm_window.c @@ -747,6 +747,10 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr C_void_ptr GHOST_TEventKeyData kdata; wmEvent event; int wx, wy; + const int keymodifier = ((query_qual(SHIFT) ? KM_SHIFT : 0) | + (query_qual(CONTROL) ? KM_CTRL : 0) | + (query_qual(ALT) ? KM_ALT : 0) | + (query_qual(OS) ? KM_OSKEY : 0)); wm->winactive = win; /* no context change! c->wm->windrawable is drawable, or for area queues */ @@ -756,25 +760,58 @@ 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 */ /* TODO: This is not correct since a modifier may be held when a window is activated... - * better solve this at ghost level. attempted fix r54450 but it caused bug [#34255] */ + * better solve this at ghost level. attempted fix r54450 but it caused bug [#34255] + * + * For now don't send GHOST_kEventKeyDown events, just set the 'eventstate'. + */ kdata.ascii = '\0'; kdata.utf8_buf[0] = '\0'; - if (win->eventstate->shift && !query_qual(SHIFT)) { - kdata.key = GHOST_kKeyLeftShift; - wm_event_add_ghostevent(wm, win, GHOST_kEventKeyUp, time, &kdata); + + if (win->eventstate->shift) { + if ((keymodifier & KM_SHIFT) == 0) { + kdata.key = GHOST_kKeyLeftShift; + wm_event_add_ghostevent(wm, win, GHOST_kEventKeyUp, time, &kdata); + } + } + else { + if (keymodifier & KM_SHIFT) { + win->eventstate->shift = KM_MOD_FIRST; + } } - if (win->eventstate->ctrl && !query_qual(CONTROL)) { - kdata.key = GHOST_kKeyLeftControl; - wm_event_add_ghostevent(wm, win, GHOST_kEventKeyUp, time, &kdata); + if (win->eventstate->ctrl) { + if ((keymodifier & KM_CTRL) == 0) { + kdata.key = GHOST_kKeyLeftControl; + wm_event_add_ghostevent(wm, win, GHOST_kEventKeyUp, time, &kdata); + } } - if (win->eventstate->alt && !query_qual(ALT)) { - kdata.key = GHOST_kKeyLeftAlt; - wm_event_add_ghostevent(wm, win, GHOST_kEventKeyUp, time, &kdata); + else { + if (keymodifier & KM_CTRL) { + win->eventstate->ctrl = KM_MOD_FIRST; + } } - if (win->eventstate->oskey && !query_qual(OS)) { - kdata.key = GHOST_kKeyOS; - wm_event_add_ghostevent(wm, win, GHOST_kEventKeyUp, time, &kdata); + if (win->eventstate->alt) { + if ((keymodifier & KM_ALT) == 0) { + kdata.key = GHOST_kKeyLeftAlt; + wm_event_add_ghostevent(wm, win, GHOST_kEventKeyUp, time, &kdata); + } } + else { + if (keymodifier & KM_ALT) { + win->eventstate->alt = KM_MOD_FIRST; + } + } + if (win->eventstate->oskey) { + if ((keymodifier & KM_OSKEY) == 0) { + kdata.key = GHOST_kKeyOS; + wm_event_add_ghostevent(wm, win, GHOST_kEventKeyUp, time, &kdata); + } + } + else { + if (keymodifier & KM_OSKEY) { + win->eventstate->oskey = KM_MOD_FIRST; + } + } + /* keymodifier zero, it hangs on hotkeys that open windows otherwise */ win->eventstate->keymodifier = 0; |