diff options
author | Andy Shaw <andy.shaw@digia.com> | 2015-03-10 22:47:52 +0100 |
---|---|---|
committer | Andy Shaw <andy.shaw@digia.com> | 2015-03-13 12:03:37 +0000 |
commit | aa645caec178767e57da25f2a4566e1212c12b35 (patch) | |
tree | a5e794dfd2781f9992aa17b35c582b298a02e59e /src/plugins/platforms | |
parent | 51ec7ebfe5f45d1c0a03d992e97053cac66e25fe (diff) |
Windows: Get the normal virtual key when not composing
When there is no composing currently being done then we need to get the
real virtual key rather than the one it was sent as with ImmGetVirtualKey.
This ensures that any shortcut associated with the key will be fired right
away.
Change-Id: Id526b7030ca21eaacbd6c74774392b0707cf762a
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src/plugins/platforms')
-rw-r--r-- | src/plugins/platforms/windows/qwindowsinputcontext.h | 1 | ||||
-rw-r--r-- | src/plugins/platforms/windows/qwindowskeymapper.cpp | 5 |
2 files changed, 5 insertions, 1 deletions
diff --git a/src/plugins/platforms/windows/qwindowsinputcontext.h b/src/plugins/platforms/windows/qwindowsinputcontext.h index 86243952ec..898a0e6909 100644 --- a/src/plugins/platforms/windows/qwindowsinputcontext.h +++ b/src/plugins/platforms/windows/qwindowsinputcontext.h @@ -73,6 +73,7 @@ public: bool startComposition(HWND hwnd); bool composition(HWND hwnd, LPARAM lParam); bool endComposition(HWND hwnd); + inline bool isComposing() const { return m_compositionContext.isComposing; } int reconvertString(RECONVERTSTRING *reconv); diff --git a/src/plugins/platforms/windows/qwindowskeymapper.cpp b/src/plugins/platforms/windows/qwindowskeymapper.cpp index 4b1d1112d5..aa418a0100 100644 --- a/src/plugins/platforms/windows/qwindowskeymapper.cpp +++ b/src/plugins/platforms/windows/qwindowskeymapper.cpp @@ -36,6 +36,7 @@ #include "qwindowswindow.h" #include "qwindowsguieventdispatcher.h" #include "qwindowsscaling.h" +#include "qwindowsinputcontext.h" #include <QtGui/QWindow> #include <qpa/qwindowsysteminterface.h> @@ -847,7 +848,7 @@ bool QWindowsKeyMapper::translateKeyEventInternal(QWindow *window, const MSG &ms const int msgType = msg.message; const quint32 scancode = (msg.lParam >> 16) & scancodeBitmask; - const quint32 vk_key = msg.wParam; + quint32 vk_key = msg.wParam; quint32 nModifiers = 0; QWindow *receiver = m_keyGrabber ? m_keyGrabber : window; @@ -1041,6 +1042,8 @@ bool QWindowsKeyMapper::translateKeyEventInternal(QWindow *window, const MSG &ms // results, if we map this virtual key-code directly (for eg '?' US layouts). So try // to find the correct key using the current message parameters & keyboard state. if (uch.isNull() && msgType == WM_IME_KEYDOWN) { + if (!QWindowsInputContext::instance()->isComposing()) + vk_key = ImmGetVirtualKey((HWND)window->winId()); BYTE keyState[256]; wchar_t newKey[3] = {0}; GetKeyboardState(keyState); |