summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@digia.com>2014-08-27 11:57:34 +0200
committerFriedemann Kleint <Friedemann.Kleint@digia.com>2014-09-01 13:08:41 +0200
commit78ee7597482a2efa06305d659a88122a95a062de (patch)
treed7901f513eade8be16bb6ce3c6b2cca52356b143 /src
parent367680679ae13faaf71aa481265cb93629a36427 (diff)
Windows QPA plugin: Streamline code to find window at a position.
Task-number: QTBUG-40815 Change-Id: I0efcc2cfcafdee04bda20afa88a7f6aaabd57210 Reviewed-by: Kai Koehne <kai.koehne@digia.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Diffstat (limited to 'src')
-rw-r--r--src/plugins/platforms/windows/qwindowsmousehandler.cpp2
-rw-r--r--src/plugins/platforms/windows/qwindowsscreen.cpp20
-rw-r--r--src/plugins/platforms/windows/qwindowsscreen.h8
-rw-r--r--src/plugins/platforms/windows/qwindowstabletsupport.cpp4
-rw-r--r--src/plugins/platforms/windows/qwindowswindow.cpp20
-rw-r--r--src/plugins/platforms/windows/qwindowswindow.h5
6 files changed, 10 insertions, 49 deletions
diff --git a/src/plugins/platforms/windows/qwindowsmousehandler.cpp b/src/plugins/platforms/windows/qwindowsmousehandler.cpp
index 2e677102a5..96c4a8bb78 100644
--- a/src/plugins/platforms/windows/qwindowsmousehandler.cpp
+++ b/src/plugins/platforms/windows/qwindowsmousehandler.cpp
@@ -384,7 +384,7 @@ bool QWindowsMouseHandler::translateMouseWheelEvent(QWindow *window, HWND,
// 2) The window receiving the event
// If a window is blocked by modality, it can't get the event.
const QPoint globalPos(GET_X_LPARAM(msg.lParam), GET_Y_LPARAM(msg.lParam));
- QWindow *receiver = QWindowsScreen::windowAt(globalPos);
+ QWindow *receiver = QWindowsScreen::windowAt(globalPos, CWP_SKIPINVISIBLE);
bool handleEvent = true;
if (!isValidWheelReceiver(receiver)) {
receiver = window;
diff --git a/src/plugins/platforms/windows/qwindowsscreen.cpp b/src/plugins/platforms/windows/qwindowsscreen.cpp
index a5a291a8d8..796975122e 100644
--- a/src/plugins/platforms/windows/qwindowsscreen.cpp
+++ b/src/plugins/platforms/windows/qwindowsscreen.cpp
@@ -287,13 +287,12 @@ QPixmap QWindowsScreen::grabWindow(WId window, int qX, int qY, int qWidth, int q
\brief Find a top level window taking the flags of ChildWindowFromPointEx.
*/
-QWindow *QWindowsScreen::findTopLevelAt(const QPoint &point, unsigned flags)
+QWindow *QWindowsScreen::topLevelAt(const QPoint &point) const
{
- QWindow* result = 0;
- if (QPlatformWindow *bw = QWindowsContext::instance()->
- findPlatformWindowAt(GetDesktopWindow(), point, flags))
- result = QWindowsWindow::topLevelOf(bw->window());
- qCDebug(lcQpaWindows) <<__FUNCTION__ << point << flags << result;
+ QWindow *result = 0;
+ if (QWindow *child = QWindowsScreen::windowAt(point * QWindowsScaling::factor(), CWP_SKIPINVISIBLE))
+ result = QWindowsWindow::topLevelOf(child);
+ qCDebug(lcQpaWindows) <<__FUNCTION__ << point << result;
return result;
}
@@ -307,15 +306,6 @@ QWindow *QWindowsScreen::windowAt(const QPoint &screenPoint, unsigned flags)
return result;
}
-QWindow *QWindowsScreen::windowUnderMouse(unsigned flags)
-{
-#ifndef QT_NO_CURSOR
- return QWindowsScreen::windowAt(QWindowsCursor::mousePosition(), flags);
-#else
- return 0;
-#endif
-}
-
QWindowsScreen *QWindowsScreen::screenOf(const QWindow *w)
{
if (w)
diff --git a/src/plugins/platforms/windows/qwindowsscreen.h b/src/plugins/platforms/windows/qwindowsscreen.h
index 49581db41a..44638bcbe0 100644
--- a/src/plugins/platforms/windows/qwindowsscreen.h
+++ b/src/plugins/platforms/windows/qwindowsscreen.h
@@ -104,12 +104,8 @@ public:
QString name() const Q_DECL_OVERRIDE { return m_data.name; }
Qt::ScreenOrientation orientation() const Q_DECL_OVERRIDE { return m_data.orientation; }
QList<QPlatformScreen *> virtualSiblings() const Q_DECL_OVERRIDE;
- QWindow *topLevelAt(const QPoint &point) const Q_DECL_OVERRIDE
- { return QWindowsScreen::findTopLevelAt(point * QWindowsScaling::factor() , CWP_SKIPINVISIBLE); }
-
- static QWindow *findTopLevelAt(const QPoint &point, unsigned flags);
- static QWindow *windowAt(const QPoint &point, unsigned flags = CWP_SKIPINVISIBLE);
- static QWindow *windowUnderMouse(unsigned flags = CWP_SKIPINVISIBLE);
+ QWindow *topLevelAt(const QPoint &point) const Q_DECL_OVERRIDE;
+ static QWindow *windowAt(const QPoint &point, unsigned flags);
QPixmap grabWindow(WId window, int qX, int qY, int qWidth, int qHeight) const Q_DECL_OVERRIDE;
diff --git a/src/plugins/platforms/windows/qwindowstabletsupport.cpp b/src/plugins/platforms/windows/qwindowstabletsupport.cpp
index 7d020ff9d6..b6940e6850 100644
--- a/src/plugins/platforms/windows/qwindowstabletsupport.cpp
+++ b/src/plugins/platforms/windows/qwindowstabletsupport.cpp
@@ -47,6 +47,7 @@
#include "qwindowscontext.h"
#include "qwindowskeymapper.h"
#include "qwindowswindow.h"
+#include "qwindowsscreen.h"
#include <qpa/qwindowsysteminterface.h>
@@ -437,8 +438,7 @@ bool QWindowsTabletSupport::translateTabletPacketEvent()
}
if (!target)
- if (QPlatformWindow *pw = QWindowsContext::instance()->findPlatformWindowAt(GetDesktopWindow(), globalPos, CWP_SKIPINVISIBLE | CWP_SKIPTRANSPARENT))
- target = pw->window();
+ target = QWindowsScreen::windowAt(globalPos, CWP_SKIPINVISIBLE | CWP_SKIPTRANSPARENT);
if (!target)
continue;
diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp
index e6b996c685..672d169984 100644
--- a/src/plugins/platforms/windows/qwindowswindow.cpp
+++ b/src/plugins/platforms/windows/qwindowswindow.cpp
@@ -2083,26 +2083,6 @@ void QWindowsWindow::setCursor(const QWindowsWindowCursor &c)
#endif
}
-/*!
- \brief Find a child window using flags from ChildWindowFromPointEx.
-*/
-
-QWindowsWindow *QWindowsWindow::childAtScreenPoint(const QPoint &screenPoint,
- unsigned cwexflags) const
-{
- if (m_data.hwnd)
- return QWindowsContext::instance()->findPlatformWindowAt(m_data.hwnd, screenPoint, cwexflags);
- return 0;
-}
-
-QWindowsWindow *QWindowsWindow::childAt(const QPoint &clientPoint, unsigned cwexflags) const
-{
- if (m_data.hwnd)
- return childAtScreenPoint(QWindowsGeometryHint::mapToGlobal(m_data.hwnd, clientPoint),
- cwexflags);
- return 0;
-}
-
#ifndef Q_OS_WINCE
void QWindowsWindow::setAlertState(bool enabled)
{
diff --git a/src/plugins/platforms/windows/qwindowswindow.h b/src/plugins/platforms/windows/qwindowswindow.h
index cb9da6fe27..03c71351bd 100644
--- a/src/plugins/platforms/windows/qwindowswindow.h
+++ b/src/plugins/platforms/windows/qwindowswindow.h
@@ -246,11 +246,6 @@ public:
void setCursor(const QWindowsWindowCursor &c);
void applyCursor();
- QWindowsWindow *childAt(const QPoint &clientPoint,
- unsigned cwexflags = CWP_SKIPINVISIBLE) const;
- QWindowsWindow *childAtScreenPoint(const QPoint &screenPoint,
- unsigned cwexflags = CWP_SKIPINVISIBLE) const;
-
static QByteArray debugWindowFlags(Qt::WindowFlags wf);
inline bool testFlag(unsigned f) const { return (m_flags & f) != 0; }