Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qwindowsysteminterface.cpp File Reference

(454068232eae457c8f62f94b70e17b0ef8b7a74a)

#include "qwindowsysteminterface.h"
#include <qpa/qplatformwindow.h>
#include "qwindowsysteminterface_p.h"
#include "private/qguiapplication_p.h"
#include "private/qevent_p.h"
#include "private/qeventpoint_p.h"
#include "private/qpointingdevice_p.h"
#include "private/qscreen_p.h"
#include <QAbstractEventDispatcher>
#include <qpa/qplatformintegration.h>
#include <qdebug.h>
#include "qhighdpiscaling_p.h"
#include <QtCore/qscopedvaluerollback.h>
#include <QtCore/private/qlocking_p.h>
+ Include dependency graph for qwindowsysteminterface.cpp:

Go to the source code of this file.

Classes

struct  QWindowSystemHelper< Delivery >
 

Namespaces

namespace  QTest
 [15]
 

Macros

#define QT_DEFINE_QPA_EVENT_HANDLER(ReturnType, HandlerName, ...)
 

Functions

template<typename EventType , typename Delivery = QWindowSystemInterface::DefaultDelivery, typename ... Args>
static bool handleWindowSystemEvent (Args ...args)
 
 QT_DEFINE_QPA_EVENT_HANDLER (void, handleEnterEvent, QWindow *window, const QPointF &local, const QPointF &global)
 
 QT_DEFINE_QPA_EVENT_HANDLER (void, handleLeaveEvent, QWindow *window)
 
 QT_DEFINE_QPA_EVENT_HANDLER (void, handleFocusWindowChanged, QWindow *window, Qt::FocusReason r)
 
 QT_DEFINE_QPA_EVENT_HANDLER (void, handleWindowStateChanged, QWindow *window, Qt::WindowStates newState, int oldState)
 
 QT_DEFINE_QPA_EVENT_HANDLER (void, handleWindowScreenChanged, QWindow *window, QScreen *screen)
 
 QT_DEFINE_QPA_EVENT_HANDLER (void, handleWindowDevicePixelRatioChanged, QWindow *window)
 
 QT_DEFINE_QPA_EVENT_HANDLER (void, handleSafeAreaMarginsChanged, QWindow *window)
 
 QT_DEFINE_QPA_EVENT_HANDLER (void, handleApplicationStateChanged, Qt::ApplicationState newState, bool forcePropagate)
 
 QT_DEFINE_QPA_EVENT_HANDLER (bool, handleApplicationTermination)
 
 QT_DEFINE_QPA_EVENT_HANDLER (void, handleGeometryChange, QWindow *window, const QRect &newRect)
 
 QT_DEFINE_QPA_EVENT_HANDLER (bool, handleExposeEvent, QWindow *window, const QRegion &region)
 
 QT_DEFINE_QPA_EVENT_HANDLER (bool, handlePaintEvent, QWindow *window, const QRegion &region)
 
 QT_DEFINE_QPA_EVENT_HANDLER (bool, handleCloseEvent, QWindow *window)
 
 QT_DEFINE_QPA_EVENT_HANDLER (bool, handleMouseEvent, QWindow *window, const QPointF &local, const QPointF &global, Qt::MouseButtons state, Qt::MouseButton button, QEvent::Type type, Qt::KeyboardModifiers mods, Qt::MouseEventSource source)
 w == 0 means that the event is in global coords only, local will be ignored in this case
 
 QT_DEFINE_QPA_EVENT_HANDLER (bool, handleMouseEvent, QWindow *window, const QPointingDevice *device, const QPointF &local, const QPointF &global, Qt::MouseButtons state, Qt::MouseButton button, QEvent::Type type, Qt::KeyboardModifiers mods, Qt::MouseEventSource source)
 
 QT_DEFINE_QPA_EVENT_HANDLER (bool, handleMouseEvent, QWindow *window, ulong timestamp, const QPointF &local, const QPointF &global, Qt::MouseButtons state, Qt::MouseButton button, QEvent::Type type, Qt::KeyboardModifiers mods, Qt::MouseEventSource source)
 
 QT_DEFINE_QPA_EVENT_HANDLER (bool, handleMouseEvent, QWindow *window, ulong timestamp, const QPointingDevice *device, const QPointF &local, const QPointF &global, Qt::MouseButtons state, Qt::MouseButton button, QEvent::Type type, Qt::KeyboardModifiers mods, Qt::MouseEventSource source)
 
 QT_DEFINE_QPA_EVENT_HANDLER (bool, handleKeyEvent, QWindow *window, QEvent::Type t, int k, Qt::KeyboardModifiers mods, const QString &text, bool autorep, ushort count)
 
 QT_DEFINE_QPA_EVENT_HANDLER (bool, handleKeyEvent, QWindow *window, ulong timestamp, QEvent::Type t, int k, Qt::KeyboardModifiers mods, const QString &text, bool autorep, ushort count)
 
 QT_DEFINE_QPA_EVENT_HANDLER (bool, handleTouchEvent, QWindow *window, const QPointingDevice *device, const QList< TouchPoint > &points, Qt::KeyboardModifiers mods)
 
 QT_DEFINE_QPA_EVENT_HANDLER (bool, handleTouchEvent, QWindow *window, ulong timestamp, const QPointingDevice *device, const QList< TouchPoint > &points, Qt::KeyboardModifiers mods)
 
 QT_DEFINE_QPA_EVENT_HANDLER (bool, handleTouchCancelEvent, QWindow *window, const QPointingDevice *device, Qt::KeyboardModifiers mods)
 
 QT_DEFINE_QPA_EVENT_HANDLER (bool, handleTouchCancelEvent, QWindow *window, ulong timestamp, const QPointingDevice *device, Qt::KeyboardModifiers mods)
 
 QT_DEFINE_QPA_EVENT_HANDLER (void, handleThemeChange, QWindow *window)
 
Q_GUI_EXPORT QDebug operator<< (QDebug dbg, const QWindowSystemInterface::TouchPoint &p)
 
Q_GUI_EXPORT void qt_handleMouseEvent (QWindow *window, const QPointF &local, const QPointF &global, Qt::MouseButtons state, Qt::MouseButton button, QEvent::Type type, Qt::KeyboardModifiers mods, int timestamp)
 
Q_GUI_EXPORT void qt_handleKeyEvent (QWindow *window, QEvent::Type t, int k, Qt::KeyboardModifiers mods, const QString &text=QString(), bool autorep=false, ushort count=1)
 
Q_GUI_EXPORT bool qt_sendShortcutOverrideEvent (QObject *o, ulong timestamp, int k, Qt::KeyboardModifiers mods, const QString &text=QString(), bool autorep=false, ushort count=1)
 
Q_GUI_EXPORT void qt_handleWheelEvent (QWindow *window, const QPointF &local, const QPointF &global, QPoint pixelDelta, QPoint angleDelta, Qt::KeyboardModifiers mods, Qt::ScrollPhase phase)
 
Q_GUI_EXPORT QPointingDeviceQTest::createTouchDevice (QInputDevice::DeviceType devType=QInputDevice::DeviceType::TouchScreen, QInputDevice::Capabilities caps=QInputDevice::Capability::Position)
 
Q_GUI_EXPORT bool qt_handleTouchEventv2 (QWindow *window, const QPointingDevice *device, const QList< QEventPoint > &points, Qt::KeyboardModifiers mods)
 
Q_GUI_EXPORT void qt_handleTouchEvent (QWindow *window, const QPointingDevice *device, const QList< QEventPoint > &points, Qt::KeyboardModifiers mods)
 

Variables

QPointer< QWindowqt_last_mouse_receiver
 

Macro Definition Documentation

◆ QT_DEFINE_QPA_EVENT_HANDLER

#define QT_DEFINE_QPA_EVENT_HANDLER ( ReturnType,
HandlerName,
... )
Value:
template Q_GUI_EXPORT ReturnType QWindowSystemInterface::HandlerName<QWindowSystemInterface::DefaultDelivery>(__VA_ARGS__); \
template Q_GUI_EXPORT ReturnType QWindowSystemInterface::HandlerName<QWindowSystemInterface::SynchronousDelivery>(__VA_ARGS__); \
template Q_GUI_EXPORT ReturnType QWindowSystemInterface::HandlerName<QWindowSystemInterface::AsynchronousDelivery>(__VA_ARGS__); \
template<typename Delivery> ReturnType QWindowSystemInterface::HandlerName(__VA_ARGS__)

Definition at line 199 of file qwindowsysteminterface.cpp.

Function Documentation

◆ handleWindowSystemEvent()

template<typename EventType , typename Delivery = QWindowSystemInterface::DefaultDelivery, typename ... Args>
static bool handleWindowSystemEvent ( Args ... args)
static

Definition at line 136 of file qwindowsysteminterface.cpp.

References args.

◆ operator<<()

Q_GUI_EXPORT QDebug operator<< ( QDebug dbg,
const QWindowSystemInterface::TouchPoint & p )

Definition at line 1049 of file qwindowsysteminterface.cpp.

◆ QT_DEFINE_QPA_EVENT_HANDLER() [1/24]

QT_DEFINE_QPA_EVENT_HANDLER ( bool ,
handleApplicationTermination  )

◆ QT_DEFINE_QPA_EVENT_HANDLER() [2/24]

QT_DEFINE_QPA_EVENT_HANDLER ( bool ,
handleCloseEvent ,
QWindow * window )

Definition at line 348 of file qwindowsysteminterface.cpp.

References Q_ASSERT, and window().

+ Here is the call graph for this function:

◆ QT_DEFINE_QPA_EVENT_HANDLER() [3/24]

QT_DEFINE_QPA_EVENT_HANDLER ( bool ,
handleExposeEvent ,
QWindow * window,
const QRegion & region )

Handles an expose event.

The platform plugin sends expose events when an area of the window is invalidated or window exposure changes. region is in window local coordinates. An empty region indicates that the window is obscured, but note that the exposed property of the QWindow will be set based on what QPlatformWindow::isExposed() returns at the time of this call, not based on what the region is. // FIXME: this should probably be fixed.

The platform plugin may omit sending expose events (or send obscure events) for windows that are on screen but where the client area is completely covered by other windows or otherwise not visible. Expose event consumers can then use this to disable updates for such windows. This is required behavior on platforms where OpenGL swapbuffers stops blocking for obscured windows (like macOS).

Definition at line 335 of file qwindowsysteminterface.cpp.

References QHighDpi::fromNativeLocalExposedRegion(), and window().

+ Here is the call graph for this function:

◆ QT_DEFINE_QPA_EVENT_HANDLER() [4/24]

QT_DEFINE_QPA_EVENT_HANDLER ( bool ,
handleKeyEvent ,
QWindow * window,
QEvent::Type t,
int k,
Qt::KeyboardModifiers mods,
const QString & text,
bool autorep,
ushort count )

Definition at line 465 of file qwindowsysteminterface.cpp.

References QWindowSystemInterfacePrivate::eventTime, text, time, and window().

+ Here is the call graph for this function:

◆ QT_DEFINE_QPA_EVENT_HANDLER() [5/24]

QT_DEFINE_QPA_EVENT_HANDLER ( bool ,
handleKeyEvent ,
QWindow * window,
ulong timestamp,
QEvent::Type t,
int k,
Qt::KeyboardModifiers mods,
const QString & text,
bool autorep,
ushort count )

Definition at line 470 of file qwindowsysteminterface.cpp.

References text, and window().

+ Here is the call graph for this function:

◆ QT_DEFINE_QPA_EVENT_HANDLER() [6/24]

QT_DEFINE_QPA_EVENT_HANDLER ( bool ,
handleMouseEvent ,
QWindow * window,
const QPointF & local,
const QPointF & global,
Qt::MouseButtons state,
Qt::MouseButton button,
QEvent::Type type,
Qt::KeyboardModifiers mods,
Qt::MouseEventSource source )

w == 0 means that the event is in global coords only, local will be ignored in this case

Definition at line 360 of file qwindowsysteminterface.cpp.

References button, QWindowSystemInterfacePrivate::eventTime, global, state, time, and window().

+ Here is the call graph for this function:

◆ QT_DEFINE_QPA_EVENT_HANDLER() [7/24]

QT_DEFINE_QPA_EVENT_HANDLER ( bool ,
handleMouseEvent ,
QWindow * window,
const QPointingDevice * device,
const QPointF & local,
const QPointF & global,
Qt::MouseButtons state,
Qt::MouseButton button,
QEvent::Type type,
Qt::KeyboardModifiers mods,
Qt::MouseEventSource source )

Definition at line 369 of file qwindowsysteminterface.cpp.

References button, device, QWindowSystemInterfacePrivate::eventTime, global, state, time, and window().

+ Here is the call graph for this function:

◆ QT_DEFINE_QPA_EVENT_HANDLER() [8/24]

QT_DEFINE_QPA_EVENT_HANDLER ( bool ,
handleMouseEvent ,
QWindow * window,
ulong timestamp,
const QPointF & local,
const QPointF & global,
Qt::MouseButtons state,
Qt::MouseButton button,
QEvent::Type type,
Qt::KeyboardModifiers mods,
Qt::MouseEventSource source )

Definition at line 378 of file qwindowsysteminterface.cpp.

References button, global, QPointingDevice::primaryPointingDevice(), state, and window().

+ Here is the call graph for this function:

◆ QT_DEFINE_QPA_EVENT_HANDLER() [9/24]

QT_DEFINE_QPA_EVENT_HANDLER ( bool ,
handleMouseEvent ,
QWindow * window,
ulong timestamp,
const QPointingDevice * device,
const QPointF & local,
const QPointF & global,
Qt::MouseButtons state,
Qt::MouseButton button,
QEvent::Type type,
Qt::KeyboardModifiers mods,
Qt::MouseEventSource source )

◆ QT_DEFINE_QPA_EVENT_HANDLER() [10/24]

QT_DEFINE_QPA_EVENT_HANDLER ( bool ,
handlePaintEvent ,
QWindow * window,
const QRegion & region )

Definition at line 341 of file qwindowsysteminterface.cpp.

References QHighDpi::fromNativeLocalExposedRegion(), and window().

+ Here is the call graph for this function:

◆ QT_DEFINE_QPA_EVENT_HANDLER() [11/24]

QT_DEFINE_QPA_EVENT_HANDLER ( bool ,
handleTouchCancelEvent ,
QWindow * window,
const QPointingDevice * device,
Qt::KeyboardModifiers mods )

Definition at line 689 of file qwindowsysteminterface.cpp.

References device, QWindowSystemInterfacePrivate::eventTime, time, and window().

+ Here is the call graph for this function:

◆ QT_DEFINE_QPA_EVENT_HANDLER() [12/24]

QT_DEFINE_QPA_EVENT_HANDLER ( bool ,
handleTouchCancelEvent ,
QWindow * window,
ulong timestamp,
const QPointingDevice * device,
Qt::KeyboardModifiers mods )

Definition at line 696 of file qwindowsysteminterface.cpp.

References device, QEvent::TouchCancel, and window().

+ Here is the call graph for this function:

◆ QT_DEFINE_QPA_EVENT_HANDLER() [13/24]

QT_DEFINE_QPA_EVENT_HANDLER ( bool ,
handleTouchEvent ,
QWindow * window,
const QPointingDevice * device,
const QList< TouchPoint > & points,
Qt::KeyboardModifiers mods )

Definition at line 665 of file qwindowsysteminterface.cpp.

References device, QWindowSystemInterfacePrivate::eventTime, time, and window().

+ Here is the call graph for this function:

◆ QT_DEFINE_QPA_EVENT_HANDLER() [14/24]

QT_DEFINE_QPA_EVENT_HANDLER ( bool ,
handleTouchEvent ,
QWindow * window,
ulong timestamp,
const QPointingDevice * device,
const QList< TouchPoint > & points,
Qt::KeyboardModifiers mods )

Definition at line 672 of file qwindowsysteminterface.cpp.

References device, QWindowSystemInterfacePrivate::fromNativeTouchPoints(), QInputDevicePrivate::isRegistered(), and window().

+ Here is the call graph for this function:

◆ QT_DEFINE_QPA_EVENT_HANDLER() [15/24]

QT_DEFINE_QPA_EVENT_HANDLER ( void ,
handleApplicationStateChanged ,
Qt::ApplicationState newState,
bool forcePropagate )

Definition at line 273 of file qwindowsysteminterface.cpp.

References QPlatformIntegration::ApplicationState, newState(), QGuiApplicationPrivate::platformIntegration(), and Q_ASSERT.

+ Here is the call graph for this function:

◆ QT_DEFINE_QPA_EVENT_HANDLER() [16/24]

QT_DEFINE_QPA_EVENT_HANDLER ( void ,
handleEnterEvent ,
QWindow * window,
const QPointF & local,
const QPointF & global )

Definition at line 217 of file qwindowsysteminterface.cpp.

References QHighDpi::fromNativeGlobalPosition(), QHighDpi::fromNativeLocalPosition(), global, and window().

+ Here is the call graph for this function:

◆ QT_DEFINE_QPA_EVENT_HANDLER() [17/24]

QT_DEFINE_QPA_EVENT_HANDLER ( void ,
handleFocusWindowChanged ,
QWindow * window,
Qt::FocusReason r )

Definition at line 243 of file qwindowsysteminterface.cpp.

References window().

+ Here is the call graph for this function:

◆ QT_DEFINE_QPA_EVENT_HANDLER() [18/24]

QT_DEFINE_QPA_EVENT_HANDLER ( void ,
handleGeometryChange ,
QWindow * window,
const QRect & newRect )

Definition at line 296 of file qwindowsysteminterface.cpp.

References QHighDpi::fromNativeWindowGeometry(), Q_ASSERT, and window().

+ Here is the call graph for this function:

◆ QT_DEFINE_QPA_EVENT_HANDLER() [19/24]

QT_DEFINE_QPA_EVENT_HANDLER ( void ,
handleLeaveEvent ,
QWindow * window )

Definition at line 225 of file qwindowsysteminterface.cpp.

References window().

+ Here is the call graph for this function:

◆ QT_DEFINE_QPA_EVENT_HANDLER() [20/24]

QT_DEFINE_QPA_EVENT_HANDLER ( void ,
handleSafeAreaMarginsChanged ,
QWindow * window )

Definition at line 268 of file qwindowsysteminterface.cpp.

References window().

+ Here is the call graph for this function:

◆ QT_DEFINE_QPA_EVENT_HANDLER() [21/24]

QT_DEFINE_QPA_EVENT_HANDLER ( void ,
handleThemeChange ,
QWindow * window )

Definition at line 832 of file qwindowsysteminterface.cpp.

References window().

+ Here is the call graph for this function:

◆ QT_DEFINE_QPA_EVENT_HANDLER() [22/24]

QT_DEFINE_QPA_EVENT_HANDLER ( void ,
handleWindowDevicePixelRatioChanged ,
QWindow * window )

Definition at line 262 of file qwindowsysteminterface.cpp.

References window().

+ Here is the call graph for this function:

◆ QT_DEFINE_QPA_EVENT_HANDLER() [23/24]

QT_DEFINE_QPA_EVENT_HANDLER ( void ,
handleWindowScreenChanged ,
QWindow * window,
QScreen * screen )

Definition at line 257 of file qwindowsysteminterface.cpp.

References screen, and window().

+ Here is the call graph for this function:

◆ QT_DEFINE_QPA_EVENT_HANDLER() [24/24]

QT_DEFINE_QPA_EVENT_HANDLER ( void ,
handleWindowStateChanged ,
QWindow * window,
Qt::WindowStates newState,
int oldState )

Definition at line 248 of file qwindowsysteminterface.cpp.

References newState(), Q_ASSERT, window(), and Qt::WindowNoState.

+ Here is the call graph for this function:

◆ qt_handleKeyEvent()

Q_GUI_EXPORT void qt_handleKeyEvent ( QWindow * window,
QEvent::Type t,
int k,
Qt::KeyboardModifiers mods,
const QString & text = QString(),
bool autorep = false,
ushort count = 1 )

Definition at line 1164 of file qwindowsysteminterface.cpp.

References QWindowSystemInterfacePrivate::eventTime, QWindowSystemInterface::handleShortcutEvent(), QEvent::KeyPress, text, and window().

Referenced by QTest::simulateEvent().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ qt_handleMouseEvent()

Q_GUI_EXPORT void qt_handleMouseEvent ( QWindow * window,
const QPointF & local,
const QPointF & global,
Qt::MouseButtons state,
Qt::MouseButton button,
QEvent::Type type,
Qt::KeyboardModifiers mods,
int timestamp )

Definition at line 1151 of file qwindowsysteminterface.cpp.

References button, global, state, QHighDpi::toNativeGlobalPosition(), QHighDpi::toNativeLocalPosition(), and window().

Referenced by QTest::mouseEvent().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ qt_handleTouchEvent()

Q_GUI_EXPORT void qt_handleTouchEvent ( QWindow * window,
const QPointingDevice * device,
const QList< QEventPoint > & points,
Qt::KeyboardModifiers mods )

Definition at line 1242 of file qwindowsysteminterface.cpp.

References device, qt_handleTouchEventv2(), and window().

+ Here is the call graph for this function:

◆ qt_handleTouchEventv2()

Q_GUI_EXPORT bool qt_handleTouchEventv2 ( QWindow * window,
const QPointingDevice * device,
const QList< QEventPoint > & points,
Qt::KeyboardModifiers mods )

Definition at line 1234 of file qwindowsysteminterface.cpp.

References device, QWindowSystemInterfacePrivate::toNativeTouchPoints(), and window().

Referenced by QTest::QTouchEventSequence::commit(), QTest::QTouchEventWidgetSequence::commit(), and qt_handleTouchEvent().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ qt_handleWheelEvent()

Q_GUI_EXPORT void qt_handleWheelEvent ( QWindow * window,
const QPointF & local,
const QPointF & global,
QPoint pixelDelta,
QPoint angleDelta,
Qt::KeyboardModifiers mods,
Qt::ScrollPhase phase )

Definition at line 1213 of file qwindowsysteminterface.cpp.

References global, QWindowSystemInterface::handleWheelEvent(), and window().

Referenced by QTest::wheelEvent().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ qt_sendShortcutOverrideEvent()

Q_GUI_EXPORT bool qt_sendShortcutOverrideEvent ( QObject * o,
ulong timestamp,
int k,
Qt::KeyboardModifiers mods,
const QString & text = QString(),
bool autorep = false,
ushort count = 1 )

Definition at line 1176 of file qwindowsysteminterface.cpp.

References QGuiApplicationPrivate::instance(), QGuiApplicationPrivate::modifier_buttons, QKeySequence::NoMatch, o, Q_UNUSED, QCoreApplication::sendEvent(), QEvent::ShortcutOverride, and text.

Referenced by QQuickDeliveryAgentPrivate::deliverKeyEvent(), QApplication::notify(), and QTest::sendKeyEvent().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Variable Documentation

◆ qt_last_mouse_receiver