diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-02-15 17:30:30 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-02-15 17:30:30 +0400 |
commit | b948c31258a45440628ffa744ce78d35dab2ff92 (patch) | |
tree | 7493003d47f5934534443278ee98da820ea74c28 | |
parent | 7fa256815f2aeebf9afd9b00859dcf2fa5716e2f (diff) |
revert own commit r54450, this works on X11 but not in Windows and caused bug [#34255] (which may be a bug in windows ghost?, not getting key release for modifiers).
Cross platform modifier keys on activating window better be handled at ghost level anyway.
-rw-r--r-- | source/blender/windowmanager/intern/wm_window.c | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/source/blender/windowmanager/intern/wm_window.c b/source/blender/windowmanager/intern/wm_window.c index dc0c6115098..a1ab0de49cf 100644 --- a/source/blender/windowmanager/intern/wm_window.c +++ b/source/blender/windowmanager/intern/wm_window.c @@ -756,7 +756,6 @@ 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 */ @@ -764,23 +763,26 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr C_void_ptr // window_handle(win, INPUTCHANGE, win->active); /* 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] */ kdata.ascii = '\0'; kdata.utf8_buf[0] = '\0'; - if ((win->eventstate->shift != 0) != ((is_key = query_qual(SHIFT)) != 0)) { + if (win->eventstate->shift && !query_qual(SHIFT)) { kdata.key = GHOST_kKeyLeftShift; - wm_event_add_ghostevent(wm, win, is_key ? GHOST_kEventKeyDown : GHOST_kEventKeyUp, time, &kdata); + wm_event_add_ghostevent(wm, win, GHOST_kEventKeyUp, time, &kdata); } - if ((win->eventstate->ctrl != 0) != ((is_key = query_qual(CONTROL)) != 0)) { + if (win->eventstate->ctrl && !query_qual(CONTROL)) { kdata.key = GHOST_kKeyLeftControl; - wm_event_add_ghostevent(wm, win, is_key ? GHOST_kEventKeyDown : GHOST_kEventKeyUp, time, &kdata); + wm_event_add_ghostevent(wm, win, GHOST_kEventKeyUp, time, &kdata); } - if ((win->eventstate->alt != 0) != ((is_key = query_qual(ALT)) != 0)) { + if (win->eventstate->alt && !query_qual(ALT)) { kdata.key = GHOST_kKeyLeftAlt; - wm_event_add_ghostevent(wm, win, is_key ? GHOST_kEventKeyDown : GHOST_kEventKeyUp, time, &kdata); + wm_event_add_ghostevent(wm, win, GHOST_kEventKeyUp, time, &kdata); } - if ((win->eventstate->oskey != 0) != ((is_key = query_qual(OS)) != 0)) { + if (win->eventstate->oskey && !query_qual(OS)) { kdata.key = GHOST_kKeyOS; - wm_event_add_ghostevent(wm, win, is_key ? GHOST_kEventKeyDown : GHOST_kEventKeyUp, time, &kdata); + wm_event_add_ghostevent(wm, win, GHOST_kEventKeyUp, time, &kdata); } /* keymodifier zero, it hangs on hotkeys that open windows otherwise */ win->eventstate->keymodifier = 0; |