summaryrefslogtreecommitdiff
path: root/src/plugins/platforms/windows
diff options
context:
space:
mode:
authorOswald Buddenhagen <oswald.buddenhagen@qt.io>2017-02-01 21:00:55 +0100
committerOswald Buddenhagen <oswald.buddenhagen@qt.io>2017-02-01 21:00:55 +0100
commitdcd5cb973622d059818dba1a2c7b9a7b7601a14c (patch)
treefbda1c8c6d36cae42b084f7298cf5b1904e21e9f /src/plugins/platforms/windows
parentf299b565b5904e39a47b6133643448e46810f0ed (diff)
parentff68e5d667cc62141f177d01f747a62c95f08d3e (diff)
downloadqtbase-dcd5cb973622d059818dba1a2c7b9a7b7601a14c.tar.gz
Merge remote-tracking branch 'gerrit/dev' into HEAD
Diffstat (limited to 'src/plugins/platforms/windows')
-rw-r--r--src/plugins/platforms/windows/qwin10helpers.cpp2
-rw-r--r--src/plugins/platforms/windows/qwindowscontext.cpp11
-rw-r--r--src/plugins/platforms/windows/qwindowsintegration.cpp5
-rw-r--r--src/plugins/platforms/windows/qwindowskeymapper.cpp3
-rw-r--r--src/plugins/platforms/windows/qwindowsmousehandler.cpp21
-rw-r--r--src/plugins/platforms/windows/qwindowsscreen.cpp30
-rw-r--r--src/plugins/platforms/windows/qwindowswindow.cpp39
7 files changed, 68 insertions, 43 deletions
diff --git a/src/plugins/platforms/windows/qwin10helpers.cpp b/src/plugins/platforms/windows/qwin10helpers.cpp
index 977bbfd11b..12cccd124b 100644
--- a/src/plugins/platforms/windows/qwin10helpers.cpp
+++ b/src/plugins/platforms/windows/qwin10helpers.cpp
@@ -57,7 +57,7 @@
#endif
#ifdef HAS_UI_VIEW_SETTINGS_INTEROP
-# include <UIViewSettingsInterop.h>
+# include <uiviewsettingsinterop.h>
#endif
#ifndef HAS_UI_VIEW_SETTINGS_INTEROP
diff --git a/src/plugins/platforms/windows/qwindowscontext.cpp b/src/plugins/platforms/windows/qwindowscontext.cpp
index 4248d5685e..fefc848d01 100644
--- a/src/plugins/platforms/windows/qwindowscontext.cpp
+++ b/src/plugins/platforms/windows/qwindowscontext.cpp
@@ -1013,11 +1013,18 @@ bool QWindowsContext::windowsProc(HWND hwnd, UINT message,
case QtWindows::MouseWheelEvent:
case QtWindows::MouseEvent:
case QtWindows::LeaveEvent:
+ {
+ QWindow *window = platformWindow->window();
+ while (window->flags() & Qt::WindowTransparentForInput)
+ window = window->parent();
+ if (!window)
+ return false;
#if !defined(QT_NO_SESSIONMANAGER)
- return platformSessionManager()->isInteractionBlocked() ? true : d->m_mouseHandler.translateMouseEvent(platformWindow->window(), hwnd, et, msg, result);
+ return platformSessionManager()->isInteractionBlocked() ? true : d->m_mouseHandler.translateMouseEvent(window, hwnd, et, msg, result);
#else
- return d->m_mouseHandler.translateMouseEvent(platformWindow->window(), hwnd, et, msg, result);
+ return d->m_mouseHandler.translateMouseEvent(window, hwnd, et, msg, result);
#endif
+ }
case QtWindows::TouchEvent:
#if !defined(QT_NO_SESSIONMANAGER)
return platformSessionManager()->isInteractionBlocked() ? true : d->m_mouseHandler.translateTouchEvent(platformWindow->window(), hwnd, et, msg, result);
diff --git a/src/plugins/platforms/windows/qwindowsintegration.cpp b/src/plugins/platforms/windows/qwindowsintegration.cpp
index 2f88989b3c..5a3020387a 100644
--- a/src/plugins/platforms/windows/qwindowsintegration.cpp
+++ b/src/plugins/platforms/windows/qwindowsintegration.cpp
@@ -510,11 +510,6 @@ QVariant QWindowsIntegration::styleHint(QPlatformIntegration::StyleHint hint) co
return QVariant(keyBoardAutoRepeatRateMS());
#endif
case QPlatformIntegration::ShowIsMaximized:
-#ifndef QT_NO_CLIPBOARD
- return qt_windowsIsTabletMode(d->m_clipboard.clipboardViewer());
-#else
- break;
-#endif
case QPlatformIntegration::StartDragTime:
case QPlatformIntegration::StartDragDistance:
case QPlatformIntegration::KeyboardInputInterval:
diff --git a/src/plugins/platforms/windows/qwindowskeymapper.cpp b/src/plugins/platforms/windows/qwindowskeymapper.cpp
index c2b1df26f8..24c2df86d4 100644
--- a/src/plugins/platforms/windows/qwindowskeymapper.cpp
+++ b/src/plugins/platforms/windows/qwindowskeymapper.cpp
@@ -701,7 +701,8 @@ void QWindowsKeyMapper::updatePossibleKeyCodes(unsigned char *kbdBuffer, quint32
quint32 fallbackKey = winceKeyBend(vk_key);
if (!fallbackKey || fallbackKey == Qt::Key_unknown) {
fallbackKey = 0;
- if (vk_key != keyLayout[vk_key].qtKey[0] && vk_key < 0x5B && vk_key > 0x2F)
+ if (vk_key != keyLayout[vk_key].qtKey[0] && vk_key != keyLayout[vk_key].qtKey[1]
+ && vk_key < 0x5B && vk_key > 0x2F)
fallbackKey = vk_key;
}
keyLayout[vk_key].qtKey[8] = fallbackKey;
diff --git a/src/plugins/platforms/windows/qwindowsmousehandler.cpp b/src/plugins/platforms/windows/qwindowsmousehandler.cpp
index 81349f2998..81abf24131 100644
--- a/src/plugins/platforms/windows/qwindowsmousehandler.cpp
+++ b/src/plugins/platforms/windows/qwindowsmousehandler.cpp
@@ -306,7 +306,8 @@ bool QWindowsMouseHandler::translateMouseEvent(QWindow *window, HWND hwnd,
// events, "click-through") can be considered as the window under mouse.
QWindow *currentWindowUnderMouse = platformWindow->hasMouseCapture() ?
QWindowsScreen::windowAt(globalPosition, CWP_SKIPINVISIBLE | CWP_SKIPTRANSPARENT) : window;
-
+ while (currentWindowUnderMouse && currentWindowUnderMouse->flags() & Qt::WindowTransparentForInput)
+ currentWindowUnderMouse = currentWindowUnderMouse->parent();
// QTBUG-44332: When Qt is running at low integrity level and
// a Qt Window is parented on a Window of a higher integrity process
// using QWindow::fromWinId() (for example, Qt running in a browser plugin)
@@ -425,22 +426,10 @@ static bool isValidWheelReceiver(QWindow *candidate)
static void redirectWheelEvent(QWindow *window, const QPoint &globalPos, int delta,
Qt::Orientation orientation, Qt::KeyboardModifiers mods)
{
- // Redirect wheel event to one of the following, in order of preference:
- // 1) The window under mouse
- // 2) The window receiving the event
// If a window is blocked by modality, it can't get the event.
-
- QWindow *receiver = QWindowsScreen::windowAt(globalPos, CWP_SKIPINVISIBLE);
- bool handleEvent = true;
- if (!isValidWheelReceiver(receiver)) {
- receiver = window;
- if (!isValidWheelReceiver(receiver))
- handleEvent = false;
- }
-
- if (handleEvent) {
- QWindowSystemInterface::handleWheelEvent(receiver,
- QWindowsGeometryHint::mapFromGlobal(receiver, globalPos),
+ if (isValidWheelReceiver(window)) {
+ QWindowSystemInterface::handleWheelEvent(window,
+ QWindowsGeometryHint::mapFromGlobal(window, globalPos),
globalPos, delta, orientation, mods);
}
}
diff --git a/src/plugins/platforms/windows/qwindowsscreen.cpp b/src/plugins/platforms/windows/qwindowsscreen.cpp
index fa2fe6942a..bd598630ba 100644
--- a/src/plugins/platforms/windows/qwindowsscreen.cpp
+++ b/src/plugins/platforms/windows/qwindowsscreen.cpp
@@ -181,14 +181,30 @@ QWindowsScreen::QWindowsScreen(const QWindowsScreenData &data) :
Q_GUI_EXPORT QPixmap qt_pixmapFromWinHBITMAP(HBITMAP bitmap, int hbitmapFormat = 0);
-QPixmap QWindowsScreen::grabWindow(WId window, int x, int y, int width, int height) const
+QPixmap QWindowsScreen::grabWindow(WId window, int xIn, int yIn, int width, int height) const
{
- RECT r;
- HWND hwnd = window ? reinterpret_cast<HWND>(window) : GetDesktopWindow();
- GetClientRect(hwnd, &r);
+ QSize windowSize;
+ int x = xIn;
+ int y = yIn;
+ HWND hwnd = reinterpret_cast<HWND>(window);
+ if (hwnd) {
+ RECT r;
+ GetClientRect(hwnd, &r);
+ windowSize = QSize(r.right - r.left, r.bottom - r.top);
+ } else {
+ // Grab current screen. The client rectangle of GetDesktopWindow() is the
+ // primary screen, but it is possible to grab other screens from it.
+ hwnd = GetDesktopWindow();
+ const QRect screenGeometry = geometry();
+ windowSize = screenGeometry.size();
+ x += screenGeometry.x();
+ y += screenGeometry.y();
+ }
- if (width < 0) width = r.right - r.left;
- if (height < 0) height = r.bottom - r.top;
+ if (width < 0)
+ width = windowSize.width() - xIn;
+ if (height < 0)
+ height = windowSize.height() - yIn;
// Create and setup bitmap
HDC display_dc = GetDC(0);
@@ -242,7 +258,7 @@ qreal QWindowsScreen::pixelDensity() const
// the pixel density since it is reflects the Windows UI scaling.
// High DPI auto scaling should be disabled when the user chooses
// small fonts on a High DPI monitor, resulting in lower logical DPI.
- return qRound(logicalDpi().first / 96);
+ return qMax(1, qRound(logicalDpi().first / 96));
}
/*!
diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp
index 5edf40b886..04db975360 100644
--- a/src/plugins/platforms/windows/qwindowswindow.cpp
+++ b/src/plugins/platforms/windows/qwindowswindow.cpp
@@ -43,7 +43,7 @@
#include "qwindowsscreen.h"
#include "qwindowsintegration.h"
#include "qwindowsnativeinterface.h"
-#include "qwindowsopenglcontext.h"
+#include "qwindowsglcontext.h"
#ifdef QT_NO_CURSOR
# include "qwindowscursor.h"
#endif
@@ -1300,6 +1300,12 @@ void QWindowsWindow::updateTransientParent() const
if (const QWindowsWindow *tw = QWindowsWindow::windowsWindowOf(tp))
if (!tw->testFlag(WithinDestroy)) // Prevent destruction by parent window (QTBUG-35499, QTBUG-36666)
newTransientParent = tw->handle();
+
+ // QTSOLBUG-71: When using the MFC/winmigrate solution, it is possible that a child
+ // window is found, which can cause issues with modality. Loop up to top level.
+ while (newTransientParent && (GetWindowLongPtr(newTransientParent, GWL_STYLE) & WS_CHILD) != 0)
+ newTransientParent = GetParent(newTransientParent);
+
if (newTransientParent != oldTransientParent)
SetWindowLongPtr(m_data.hwnd, GWL_HWNDPARENT, LONG_PTR(newTransientParent));
}
@@ -1488,18 +1494,22 @@ void QWindowsWindow::handleResized(int wParam)
case SIZE_MAXHIDE: // Some other window affected.
case SIZE_MAXSHOW:
return;
- case SIZE_MINIMIZED:
- handleWindowStateChange(Qt::WindowMinimized);
+ case SIZE_MINIMIZED: // QTBUG-53577, prevent state change events during programmatic state change
+ if (!testFlag(WithinSetStyle))
+ handleWindowStateChange(Qt::WindowMinimized);
return;
case SIZE_MAXIMIZED:
- handleWindowStateChange(Qt::WindowMaximized);
+ if (!testFlag(WithinSetStyle))
+ handleWindowStateChange(Qt::WindowMaximized);
handleGeometryChange();
break;
case SIZE_RESTORED:
- if (isFullScreen_sys())
- handleWindowStateChange(Qt::WindowFullScreen);
- else if (m_windowState != Qt::WindowNoState && !testFlag(MaximizeToFullScreen))
- handleWindowStateChange(Qt::WindowNoState);
+ if (!testFlag(WithinSetStyle)) {
+ if (isFullScreen_sys())
+ handleWindowStateChange(Qt::WindowFullScreen);
+ else if (m_windowState != Qt::WindowNoState && !testFlag(MaximizeToFullScreen))
+ handleWindowStateChange(Qt::WindowNoState);
+ }
handleGeometryChange();
break;
}
@@ -1507,9 +1517,6 @@ void QWindowsWindow::handleResized(int wParam)
void QWindowsWindow::handleGeometryChange()
{
- //Prevent recursive resizes for Windows CE
- if (testFlag(WithinSetStyle))
- return;
const QRect previousGeometry = m_data.geometry;
m_data.geometry = geometry_sys();
QPlatformWindow::setGeometry(m_data.geometry);
@@ -1609,6 +1616,16 @@ bool QWindowsWindow::handleWmPaint(HWND hwnd, UINT message,
return false;
PAINTSTRUCT ps;
+#if QT_CONFIG(dynamicgl)
+ // QTBUG-58178: GL software rendering needs InvalidateRect() to suppress
+ // artifacts while resizing.
+ if (testFlag(OpenGLSurface)
+ && QOpenGLStaticContext::opengl32.moduleIsNotOpengl32()
+ && QOpenGLContext::openGLModuleType() == QOpenGLContext::LibGL) {
+ InvalidateRect(hwnd, 0, false);
+ }
+#endif // dynamicgl
+
BeginPaint(hwnd, &ps);
// Observed painting problems with Aero style disabled (QTBUG-7865).