summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/windows/qwindowsmousehandler.cpp
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@theqtcompany.com>2016-01-08 14:59:22 +0100
committerFriedemann Kleint <Friedemann.Kleint@theqtcompany.com>2016-01-30 16:08:14 +0000
commit14efcaa3921687129d4dca9b7d5794668a329cd6 (patch)
tree701403aae68a312f506b37ec21ed2e7e1aada47b /src/plugins/platforms/windows/qwindowsmousehandler.cpp
parent6b285de8ec616ec7110515f503090e5b3a5efe46 (diff)
Windows QPA: Improve handling of windows of type Qt::ForeignWindow.
Extract a base class QWindowsBaseWindow from QWindowsWindow that provides _sys() getters for geometry and margin calculation and implements QPlatformWindow::geometry()/ frameMargins() to be calculated from the HWND. Implement a QWindowsDesktopWindow class directly inheriting QWindowsBaseWindow which does not allow any manipulation. Add a thin QWindowsForeignWindow class that wraps a foreign window id and always returns correct geometry/margin information when queried. Simple reparenting and manipulation of geometry for child windows is also implemented, allowing for embedding foreign windows into Qt. When calling other setters on it, the unimplemented warnings of QPlatformWindow will trigger. Remove the special casing for foreign/desktop window from QWindowsWindow. The existing mechanism to cache the geometry/margin values in QWindowsWindow remains as is. Rename the existing QWindowsWindow::baseWindowOf() and add checks there. Task-number: QTBUG-50206 Task-number: QTBUG-41186 Change-Id: Ib57cb87e3981312d32920fe3e49f0b1c4ad516a3 Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
Diffstat (limited to 'src/plugins/platforms/windows/qwindowsmousehandler.cpp')
-rw-r--r--src/plugins/platforms/windows/qwindowsmousehandler.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/plugins/platforms/windows/qwindowsmousehandler.cpp b/src/plugins/platforms/windows/qwindowsmousehandler.cpp
index 2bc9527b1b..c8b18f3b57 100644
--- a/src/plugins/platforms/windows/qwindowsmousehandler.cpp
+++ b/src/plugins/platforms/windows/qwindowsmousehandler.cpp
@@ -267,7 +267,7 @@ bool QWindowsMouseHandler::translateMouseEvent(QWindow *window, HWND hwnd,
// Capture is necessary so we don't get WM_MOUSELEAVEs to confuse matters.
// This autocapture is released normally when button is released.
if (!platformWindow->hasMouseCapture()) {
- QWindowsWindow::baseWindowOf(window)->applyCursor();
+ platformWindow->applyCursor();
platformWindow->setMouseGrabEnabled(true);
platformWindow->setFlag(QWindowsWindow::AutoMouseCapture);
qCDebug(lcQpaEvents) << "Automatic mouse capture for missing buttondown event" << window;
@@ -355,7 +355,7 @@ bool QWindowsMouseHandler::translateMouseEvent(QWindow *window, HWND hwnd,
m_trackedWindow = 0;
// We are not officially in any window, but we need to set some cursor to clear
// whatever cursor the left window had, so apply the cursor of the capture window.
- QWindowsWindow::baseWindowOf(window)->applyCursor();
+ platformWindow->applyCursor();
}
}
// Enter is needed if:
@@ -367,7 +367,8 @@ bool QWindowsMouseHandler::translateMouseEvent(QWindow *window, HWND hwnd,
|| (m_previousCaptureWindow && window != m_previousCaptureWindow && currentWindowUnderMouse
&& currentWindowUnderMouse != m_previousCaptureWindow)) {
qCDebug(lcQpaEvents) << "Entering " << currentWindowUnderMouse;
- QWindowsWindow::baseWindowOf(currentWindowUnderMouse)->applyCursor();
+ if (QWindowsWindow *wumPlatformWindow = QWindowsWindow::windowsWindowOf(currentWindowUnderMouse))
+ wumPlatformWindow->applyCursor();
QWindowSystemInterface::handleEnterEvent(currentWindowUnderMouse,
currentWindowUnderMouse->mapFromGlobal(globalPosition),
globalPosition);
@@ -392,7 +393,7 @@ static bool isValidWheelReceiver(QWindow *candidate)
{
if (candidate) {
const QWindow *toplevel = QWindowsWindow::topLevelOf(candidate);
- if (const QWindowsWindow *ww = QWindowsWindow::baseWindowOf(toplevel))
+ if (const QWindowsWindow *ww = QWindowsWindow::windowsWindowOf(toplevel))
return !ww->testFlag(QWindowsWindow::BlockedByModal);
}