summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/windows
diff options
context:
space:
mode:
authorFrederik Gladhorn <frederik.gladhorn@theqtcompany.com>2015-02-24 17:19:40 +0100
committerFrederik Gladhorn <frederik.gladhorn@theqtcompany.com>2015-02-24 21:02:08 +0100
commit34b14a8472f44f8517577756e033b92ebd4c5912 (patch)
tree66a0575156d0a17a835430137e218e2b3f04cc65 /src/plugins/platforms/windows
parentd34353a065c443aac20376cbd88323480d769183 (diff)
parentedd555425a08f9e074f0a4d9333862636ccaae8d (diff)
Merge remote-tracking branch 'origin/5.4' into 5.5
Conflicts: examples/xml/htmlinfo/simpleexample.html examples/xml/rsslisting/rsslisting.cpp qmake/generators/win32/msbuild_objectmodel.cpp src/3rdparty/harfbuzz-ng/src/hb-private.hh src/corelib/global/qlogging.cpp src/corelib/io/qstorageinfo_unix.cpp src/corelib/thread/qwaitcondition_unix.cpp src/gui/kernel/qguiapplication.cpp src/plugins/platforms/linuxfb/qlinuxfbintegration.cpp src/testlib/doc/src/qt-webpages.qdoc tests/auto/other/qaccessibility/tst_qaccessibility.cpp Change-Id: Ib272ff0bc30a1a5d51275eb3cd2f201dc82c11ff
Diffstat (limited to 'src/plugins/platforms/windows')
-rw-r--r--src/plugins/platforms/windows/qwindowscontext.cpp8
-rw-r--r--src/plugins/platforms/windows/qwindowskeymapper.cpp15
2 files changed, 15 insertions, 8 deletions
diff --git a/src/plugins/platforms/windows/qwindowscontext.cpp b/src/plugins/platforms/windows/qwindowscontext.cpp
index 8f48efc7f9..b397b12311 100644
--- a/src/plugins/platforms/windows/qwindowscontext.cpp
+++ b/src/plugins/platforms/windows/qwindowscontext.cpp
@@ -675,6 +675,8 @@ static inline bool findPlatformWindowHelper(const POINT &screenPoint, unsigned c
#ifndef Q_OS_WINCE
const HWND child = ChildWindowFromPointEx(*hwnd, point, cwexFlags);
#else
+// Under Windows CE we don't use ChildWindowFromPointEx as it's not available
+// and ChildWindowFromPoint does not work properly.
Q_UNUSED(cwexFlags)
const HWND child = WindowFromPoint(point);
#endif
@@ -683,7 +685,13 @@ static inline bool findPlatformWindowHelper(const POINT &screenPoint, unsigned c
if (QWindowsWindow *window = context->findPlatformWindow(child)) {
*result = window;
*hwnd = child;
+#ifndef Q_OS_WINCE
return true;
+#else
+// WindowFromPoint does not return same handle in two sequential calls, which leads
+// to an endless loop, but calling WindowFromPoint once is good enough.
+ return false;
+#endif
}
#ifndef Q_OS_WINCE // Does not have WS_EX_TRANSPARENT .
// QTBUG-40555: despite CWP_SKIPINVISIBLE, it is possible to hit on invisible
diff --git a/src/plugins/platforms/windows/qwindowskeymapper.cpp b/src/plugins/platforms/windows/qwindowskeymapper.cpp
index db89402c05..0e26a17223 100644
--- a/src/plugins/platforms/windows/qwindowskeymapper.cpp
+++ b/src/plugins/platforms/windows/qwindowskeymapper.cpp
@@ -567,16 +567,15 @@ static inline int toKeyOrUnicode(int vk, int scancode, unsigned char *kbdBuffer,
Q_ASSERT(vk > 0 && vk < 256);
int code = 0;
QChar unicodeBuffer[5];
- // While key combinations containing alt and ctrl might trigger the third assignment of a key
- // (for example "alt+ctrl+q" causes '@' on a German layout), ToUnicode often does not return the
- // wanted character if only the ctrl modifier is used. Thus we unset this modifier temporarily
- // if it is not used together with alt.
- const unsigned char controlState = kbdBuffer[VK_MENU] ? 0 : kbdBuffer[VK_CONTROL];
- if (controlState)
- kbdBuffer[VK_CONTROL] = 0;
int res = ToUnicode(vk, scancode, kbdBuffer, reinterpret_cast<LPWSTR>(unicodeBuffer), 5, 0);
- if (controlState)
+ // When Ctrl modifier is used ToUnicode does not return correct values. In order to assign the
+ // right key the control modifier is removed for just that function if the previous call failed.
+ if (res == 0 && kbdBuffer[VK_CONTROL]) {
+ const unsigned char controlState = kbdBuffer[VK_CONTROL];
+ kbdBuffer[VK_CONTROL] = 0;
+ res = ToUnicode(vk, scancode, kbdBuffer, reinterpret_cast<LPWSTR>(unicodeBuffer), 5, 0);
kbdBuffer[VK_CONTROL] = controlState;
+ }
if (res)
code = unicodeBuffer[0].toUpper().unicode();