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>bb10
parent
367680679a
commit
78ee759748
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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; }
|
||||
|
|
|
|||
Loading…
Reference in New Issue