Coverage Report

Created: 2026-03-31 07:41

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/qtbase/src/gui/kernel/qwindowsysteminterface.cpp
Line
Count
Source
1
// Copyright (C) 2020 The Qt Company Ltd.
2
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
// Qt-Security score:significant reason:default
4
#include "qwindowsysteminterface.h"
5
#include <qpa/qplatformwindow.h>
6
#include "qwindowsysteminterface_p.h"
7
#include "private/qguiapplication_p.h"
8
#include "private/qevent_p.h"
9
#include "private/qeventpoint_p.h"
10
#include "private/qpointingdevice_p.h"
11
#include "private/qscreen_p.h"
12
#include <QAbstractEventDispatcher>
13
#include <qpa/qplatformintegration.h>
14
#include <qdebug.h>
15
#include "qhighdpiscaling_p.h"
16
17
#include <QtCore/qscopedvaluerollback.h>
18
#include <QtCore/private/qlocking_p.h>
19
20
#if QT_CONFIG(draganddrop)
21
#include <qpa/qplatformdrag.h>
22
#endif
23
24
QT_BEGIN_NAMESPACE
25
26
using namespace Qt::StringLiterals;
27
28
Q_LOGGING_CATEGORY(lcQpaInputDevices, "qt.qpa.input.devices", QtWarningMsg)
29
30
Q_CONSTINIT QElapsedTimer QWindowSystemInterfacePrivate::eventTime;
31
bool QWindowSystemInterfacePrivate::synchronousWindowSystemEvents = false;
32
bool QWindowSystemInterfacePrivate::TabletEvent::platformSynthesizesMouse = true;
33
QWaitCondition QWindowSystemInterfacePrivate::eventsFlushed;
34
Q_CONSTINIT QMutex QWindowSystemInterfacePrivate::flushEventMutex;
35
Q_CONSTINIT QAtomicInt QWindowSystemInterfacePrivate::eventAccepted;
36
QWindowSystemEventHandler *QWindowSystemInterfacePrivate::eventHandler;
37
QWindowSystemInterfacePrivate::WindowSystemEventList QWindowSystemInterfacePrivate::windowSystemEventQueue;
38
39
extern QPointer<QWindow> qt_last_mouse_receiver;
40
41
42
// ------------------- QWindowSystemInterfacePrivate -------------------
43
44
/*!
45
    \internal
46
47
    The QWindowSystemHelper creates synchronously delivered events on the stack, unless
48
    the calling thread is not the Gui thread.
49
50
    Asynchronously delivered events, and events created outside the Gui thread are
51
    allocated on the heap.
52
*/
53
54
template<typename Delivery>
55
struct QWindowSystemHelper
56
{
57
    template<typename EventType, typename ...Args>
58
    static bool handleEvent(Args ...);
59
};
60
61
/*
62
    Handles a window system event.
63
64
    By default this function posts the event on the window system event queue and
65
    wakes the Gui event dispatcher. Qt Gui will then handle the event asynchronously
66
    at a later point. The return value is not used in asynchronous mode and will
67
    always be true.
68
69
    In synchronous mode Qt Gui will process the event immediately. The return value
70
    indicates if Qt accepted the event. If the event is delivered from another thread
71
    than the Qt main thread the window system event queue is flushed, which may deliver
72
    other events as well.
73
74
    \sa flushWindowSystemEvents(), setSynchronousWindowSystemEvents()
75
*/
76
template<>
77
template<typename EventType, typename ...Args>
78
bool QWindowSystemHelper<QWindowSystemInterface::DefaultDelivery>::handleEvent(Args ...args)
79
0
{
80
0
    return QWindowSystemInterfacePrivate::synchronousWindowSystemEvents
81
0
        ? QWindowSystemHelper<QWindowSystemInterface::SynchronousDelivery>::handleEvent<EventType>(args...)
82
0
        : QWindowSystemHelper<QWindowSystemInterface::AsynchronousDelivery>::handleEvent<EventType>(args...);
83
0
}
Unexecuted instantiation: bool QWindowSystemHelper<QWindowSystemInterface::DefaultDelivery>::handleEvent<QWindowSystemInterfacePrivate::EnterEvent, QWindow*, QPointF, QPointF>(QWindow*, QPointF, QPointF)
Unexecuted instantiation: bool QWindowSystemHelper<QWindowSystemInterface::DefaultDelivery>::handleEvent<QWindowSystemInterfacePrivate::LeaveEvent, QWindow*>(QWindow*)
Unexecuted instantiation: bool QWindowSystemHelper<QWindowSystemInterface::DefaultDelivery>::handleEvent<QWindowSystemInterfacePrivate::FocusWindowEvent, QWindow*, Qt::FocusReason>(QWindow*, Qt::FocusReason)
Unexecuted instantiation: bool QWindowSystemHelper<QWindowSystemInterface::DefaultDelivery>::handleEvent<QWindowSystemInterfacePrivate::WindowStateChangedEvent, QWindow*, QFlags<Qt::WindowState>, QFlags<Qt::WindowState> >(QWindow*, QFlags<Qt::WindowState>, QFlags<Qt::WindowState>)
Unexecuted instantiation: bool QWindowSystemHelper<QWindowSystemInterface::DefaultDelivery>::handleEvent<QWindowSystemInterfacePrivate::WindowScreenChangedEvent, QWindow*, QScreen*>(QWindow*, QScreen*)
Unexecuted instantiation: bool QWindowSystemHelper<QWindowSystemInterface::DefaultDelivery>::handleEvent<QWindowSystemInterfacePrivate::WindowDevicePixelRatioChangedEvent, QWindow*>(QWindow*)
Unexecuted instantiation: bool QWindowSystemHelper<QWindowSystemInterface::DefaultDelivery>::handleEvent<QWindowSystemInterfacePrivate::SafeAreaMarginsChangedEvent, QWindow*>(QWindow*)
Unexecuted instantiation: bool QWindowSystemHelper<QWindowSystemInterface::DefaultDelivery>::handleEvent<QWindowSystemInterfacePrivate::ApplicationStateChangedEvent, Qt::ApplicationState, bool>(Qt::ApplicationState, bool)
Unexecuted instantiation: bool QWindowSystemHelper<QWindowSystemInterface::DefaultDelivery>::handleEvent<QWindowSystemInterfacePrivate::GeometryChangeEvent, QWindow*, QRect, QRect>(QWindow*, QRect, QRect)
Unexecuted instantiation: bool QWindowSystemHelper<QWindowSystemInterface::DefaultDelivery>::handleEvent<QWindowSystemInterfacePrivate::ExposeEvent, QWindow*, QRegion>(QWindow*, QRegion)
Unexecuted instantiation: bool QWindowSystemHelper<QWindowSystemInterface::DefaultDelivery>::handleEvent<QWindowSystemInterfacePrivate::PaintEvent, QWindow*, QRegion>(QWindow*, QRegion)
Unexecuted instantiation: bool QWindowSystemHelper<QWindowSystemInterface::DefaultDelivery>::handleEvent<QWindowSystemInterfacePrivate::CloseEvent, QWindow*>(QWindow*)
Unexecuted instantiation: bool QWindowSystemHelper<QWindowSystemInterface::DefaultDelivery>::handleEvent<QWindowSystemInterfacePrivate::MouseEvent, QWindow*, unsigned long, QPointF, QPointF, QFlags<Qt::MouseButton>, QFlags<Qt::KeyboardModifier>, Qt::MouseButton, QEvent::Type, Qt::MouseEventSource, bool, QPointingDevice const*>(QWindow*, unsigned long, QPointF, QPointF, QFlags<Qt::MouseButton>, QFlags<Qt::KeyboardModifier>, Qt::MouseButton, QEvent::Type, Qt::MouseEventSource, bool, QPointingDevice const*)
Unexecuted instantiation: bool QWindowSystemHelper<QWindowSystemInterface::DefaultDelivery>::handleEvent<QWindowSystemInterfacePrivate::KeyEvent, QWindow*, unsigned long, QEvent::Type, int, QFlags<Qt::KeyboardModifier>, QString, bool, unsigned short>(QWindow*, unsigned long, QEvent::Type, int, QFlags<Qt::KeyboardModifier>, QString, bool, unsigned short)
Unexecuted instantiation: bool QWindowSystemHelper<QWindowSystemInterface::DefaultDelivery>::handleEvent<QWindowSystemInterfacePrivate::KeyEvent, QWindow*, unsigned long, QEvent::Type, int, QFlags<Qt::KeyboardModifier>, unsigned int, unsigned int, unsigned int, QString, bool, unsigned short>(QWindow*, unsigned long, QEvent::Type, int, QFlags<Qt::KeyboardModifier>, unsigned int, unsigned int, unsigned int, QString, bool, unsigned short)
Unexecuted instantiation: bool QWindowSystemHelper<QWindowSystemInterface::DefaultDelivery>::handleEvent<QWindowSystemInterfacePrivate::WheelEvent, QWindow*, unsigned long, QPointF, QPointF, QPoint, QPoint, int, Qt::Orientation, QFlags<Qt::KeyboardModifier>, Qt::ScrollPhase, Qt::MouseEventSource, bool, QPointingDevice const*>(QWindow*, unsigned long, QPointF, QPointF, QPoint, QPoint, int, Qt::Orientation, QFlags<Qt::KeyboardModifier>, Qt::ScrollPhase, Qt::MouseEventSource, bool, QPointingDevice const*)
Unexecuted instantiation: bool QWindowSystemHelper<QWindowSystemInterface::DefaultDelivery>::handleEvent<QWindowSystemInterfacePrivate::TouchEvent, QWindow*, unsigned long, QEvent::Type, QPointingDevice const*, QList<QEventPoint>, QFlags<Qt::KeyboardModifier> >(QWindow*, unsigned long, QEvent::Type, QPointingDevice const*, QList<QEventPoint>, QFlags<Qt::KeyboardModifier>)
Unexecuted instantiation: bool QWindowSystemHelper<QWindowSystemInterface::DefaultDelivery>::handleEvent<QWindowSystemInterfacePrivate::ScreenOrientationEvent, QScreen*, Qt::ScreenOrientation>(QScreen*, Qt::ScreenOrientation)
Unexecuted instantiation: bool QWindowSystemHelper<QWindowSystemInterface::DefaultDelivery>::handleEvent<QWindowSystemInterfacePrivate::ScreenGeometryEvent, QScreen*, QRect, QRect>(QScreen*, QRect, QRect)
Unexecuted instantiation: bool QWindowSystemHelper<QWindowSystemInterface::DefaultDelivery>::handleEvent<QWindowSystemInterfacePrivate::ScreenLogicalDotsPerInchEvent, QScreen*, double, double>(QScreen*, double, double)
Unexecuted instantiation: bool QWindowSystemHelper<QWindowSystemInterface::DefaultDelivery>::handleEvent<QWindowSystemInterfacePrivate::ScreenRefreshRateEvent, QScreen*, double>(QScreen*, double)
Unexecuted instantiation: bool QWindowSystemHelper<QWindowSystemInterface::DefaultDelivery>::handleEvent<QWindowSystemInterfacePrivate::ThemeChangeEvent>()
Unexecuted instantiation: bool QWindowSystemHelper<QWindowSystemInterface::DefaultDelivery>::handleEvent<QWindowSystemInterfacePrivate::TabletEvent, QWindow*, unsigned long, QPointF, QPointF, QPointingDevice const*, QFlags<Qt::MouseButton>, double, double, double, double, double, int, QFlags<Qt::KeyboardModifier> >(QWindow*, unsigned long, QPointF, QPointF, QPointingDevice const*, QFlags<Qt::MouseButton>, double, double, double, double, double, int, QFlags<Qt::KeyboardModifier>)
Unexecuted instantiation: bool QWindowSystemHelper<QWindowSystemInterface::DefaultDelivery>::handleEvent<QWindowSystemInterfacePrivate::TabletEnterProximityEvent, unsigned long, QPointingDevice const*>(unsigned long, QPointingDevice const*)
Unexecuted instantiation: bool QWindowSystemHelper<QWindowSystemInterface::DefaultDelivery>::handleEvent<QWindowSystemInterfacePrivate::TabletLeaveProximityEvent, unsigned long, QPointingDevice const*>(unsigned long, QPointingDevice const*)
Unexecuted instantiation: bool QWindowSystemHelper<QWindowSystemInterface::DefaultDelivery>::handleEvent<QWindowSystemInterfacePrivate::GestureEvent, QWindow*, unsigned long, Qt::NativeGestureType, QPointingDevice const*, int, QPointF, QPointF, double, QPointF>(QWindow*, unsigned long, Qt::NativeGestureType, QPointingDevice const*, int, QPointF, QPointF, double, QPointF)
Unexecuted instantiation: bool QWindowSystemHelper<QWindowSystemInterface::DefaultDelivery>::handleEvent<QWindowSystemInterfacePrivate::PlatformPanelEvent, QWindow*>(QWindow*)
Unexecuted instantiation: bool QWindowSystemHelper<QWindowSystemInterface::DefaultDelivery>::handleEvent<QWindowSystemInterfacePrivate::ContextMenuEvent, QWindow*, bool, QPoint, QPoint, QFlags<Qt::KeyboardModifier> >(QWindow*, bool, QPoint, QPoint, QFlags<Qt::KeyboardModifier>)
Unexecuted instantiation: bool QWindowSystemHelper<QWindowSystemInterface::DefaultDelivery>::handleEvent<QWindowSystemInterfacePrivate::WindowSystemEvent, QWindowSystemInterfacePrivate::EventType>(QWindowSystemInterfacePrivate::EventType)
84
85
/*
86
    Handles a window system event synchronously.
87
88
    Qt Gui will process the event immediately. The return value indicates if Qt
89
    accepted the event.
90
91
    If the event is delivered from another thread than the Qt main thread the
92
    window system event queue is flushed, which may deliver other events as
93
    well.
94
*/
95
template<>
96
template<typename EventType, typename ...Args>
97
bool QWindowSystemHelper<QWindowSystemInterface::SynchronousDelivery>::handleEvent(Args ...args)
98
0
{
99
0
    if (QThread::isMainThread()) {
100
0
        EventType event(args...);
101
        // Process the event immediately on the Gui thread and return the accepted state
102
0
        if (QWindowSystemInterfacePrivate::eventHandler) {
103
0
            if (!QWindowSystemInterfacePrivate::eventHandler->sendEvent(&event))
104
0
                return false;
105
0
        } else {
106
0
            QGuiApplicationPrivate::processWindowSystemEvent(&event);
107
0
        }
108
0
        return event.eventAccepted;
109
0
    } else {
110
        // Post the event on the Qt main thread queue and flush the queue.
111
        // This will wake up the Gui thread which will process the event.
112
        // Return the accepted state for the last event on the queue,
113
        // which is the event posted by this function.
114
0
        QWindowSystemHelper<QWindowSystemInterface::AsynchronousDelivery>::handleEvent<EventType>(args...);
115
0
        return QWindowSystemInterface::flushWindowSystemEvents();
116
0
    }
117
0
}
Unexecuted instantiation: bool QWindowSystemHelper<QWindowSystemInterface::SynchronousDelivery>::handleEvent<QWindowSystemInterfacePrivate::EnterEvent, QWindow*, QPointF, QPointF>(QWindow*, QPointF, QPointF)
Unexecuted instantiation: bool QWindowSystemHelper<QWindowSystemInterface::SynchronousDelivery>::handleEvent<QWindowSystemInterfacePrivate::LeaveEvent, QWindow*>(QWindow*)
Unexecuted instantiation: bool QWindowSystemHelper<QWindowSystemInterface::SynchronousDelivery>::handleEvent<QWindowSystemInterfacePrivate::FocusWindowEvent, QWindow*, Qt::FocusReason>(QWindow*, Qt::FocusReason)
Unexecuted instantiation: bool QWindowSystemHelper<QWindowSystemInterface::SynchronousDelivery>::handleEvent<QWindowSystemInterfacePrivate::WindowStateChangedEvent, QWindow*, QFlags<Qt::WindowState>, QFlags<Qt::WindowState> >(QWindow*, QFlags<Qt::WindowState>, QFlags<Qt::WindowState>)
Unexecuted instantiation: bool QWindowSystemHelper<QWindowSystemInterface::SynchronousDelivery>::handleEvent<QWindowSystemInterfacePrivate::WindowScreenChangedEvent, QWindow*, QScreen*>(QWindow*, QScreen*)
Unexecuted instantiation: bool QWindowSystemHelper<QWindowSystemInterface::SynchronousDelivery>::handleEvent<QWindowSystemInterfacePrivate::WindowDevicePixelRatioChangedEvent, QWindow*>(QWindow*)
Unexecuted instantiation: bool QWindowSystemHelper<QWindowSystemInterface::SynchronousDelivery>::handleEvent<QWindowSystemInterfacePrivate::SafeAreaMarginsChangedEvent, QWindow*>(QWindow*)
Unexecuted instantiation: bool QWindowSystemHelper<QWindowSystemInterface::SynchronousDelivery>::handleEvent<QWindowSystemInterfacePrivate::ApplicationStateChangedEvent, Qt::ApplicationState, bool>(Qt::ApplicationState, bool)
Unexecuted instantiation: bool QWindowSystemHelper<QWindowSystemInterface::SynchronousDelivery>::handleEvent<QWindowSystemInterfacePrivate::WindowSystemEvent, QWindowSystemInterfacePrivate::EventType>(QWindowSystemInterfacePrivate::EventType)
Unexecuted instantiation: bool QWindowSystemHelper<QWindowSystemInterface::SynchronousDelivery>::handleEvent<QWindowSystemInterfacePrivate::GeometryChangeEvent, QWindow*, QRect, QRect>(QWindow*, QRect, QRect)
Unexecuted instantiation: bool QWindowSystemHelper<QWindowSystemInterface::SynchronousDelivery>::handleEvent<QWindowSystemInterfacePrivate::ExposeEvent, QWindow*, QRegion>(QWindow*, QRegion)
Unexecuted instantiation: bool QWindowSystemHelper<QWindowSystemInterface::SynchronousDelivery>::handleEvent<QWindowSystemInterfacePrivate::PaintEvent, QWindow*, QRegion>(QWindow*, QRegion)
Unexecuted instantiation: bool QWindowSystemHelper<QWindowSystemInterface::SynchronousDelivery>::handleEvent<QWindowSystemInterfacePrivate::CloseEvent, QWindow*>(QWindow*)
Unexecuted instantiation: bool QWindowSystemHelper<QWindowSystemInterface::SynchronousDelivery>::handleEvent<QWindowSystemInterfacePrivate::MouseEvent, QWindow*, unsigned long, QPointF, QPointF, QFlags<Qt::MouseButton>, QFlags<Qt::KeyboardModifier>, Qt::MouseButton, QEvent::Type, Qt::MouseEventSource, bool, QPointingDevice const*>(QWindow*, unsigned long, QPointF, QPointF, QFlags<Qt::MouseButton>, QFlags<Qt::KeyboardModifier>, Qt::MouseButton, QEvent::Type, Qt::MouseEventSource, bool, QPointingDevice const*)
Unexecuted instantiation: bool QWindowSystemHelper<QWindowSystemInterface::SynchronousDelivery>::handleEvent<QWindowSystemInterfacePrivate::KeyEvent, QWindow*, unsigned long, QEvent::Type, int, QFlags<Qt::KeyboardModifier>, unsigned int, unsigned int, unsigned int, QString, bool, unsigned short>(QWindow*, unsigned long, QEvent::Type, int, QFlags<Qt::KeyboardModifier>, unsigned int, unsigned int, unsigned int, QString, bool, unsigned short)
Unexecuted instantiation: bool QWindowSystemHelper<QWindowSystemInterface::SynchronousDelivery>::handleEvent<QWindowSystemInterfacePrivate::KeyEvent, QWindow*, unsigned long, QEvent::Type, int, QFlags<Qt::KeyboardModifier>, QString, bool, unsigned short>(QWindow*, unsigned long, QEvent::Type, int, QFlags<Qt::KeyboardModifier>, QString, bool, unsigned short)
Unexecuted instantiation: bool QWindowSystemHelper<QWindowSystemInterface::SynchronousDelivery>::handleEvent<QWindowSystemInterfacePrivate::WheelEvent, QWindow*, unsigned long, QPointF, QPointF, QPoint, QPoint, int, Qt::Orientation, QFlags<Qt::KeyboardModifier>, Qt::ScrollPhase, Qt::MouseEventSource, bool, QPointingDevice const*>(QWindow*, unsigned long, QPointF, QPointF, QPoint, QPoint, int, Qt::Orientation, QFlags<Qt::KeyboardModifier>, Qt::ScrollPhase, Qt::MouseEventSource, bool, QPointingDevice const*)
Unexecuted instantiation: bool QWindowSystemHelper<QWindowSystemInterface::SynchronousDelivery>::handleEvent<QWindowSystemInterfacePrivate::TouchEvent, QWindow*, unsigned long, QEvent::Type, QPointingDevice const*, QList<QEventPoint>, QFlags<Qt::KeyboardModifier> >(QWindow*, unsigned long, QEvent::Type, QPointingDevice const*, QList<QEventPoint>, QFlags<Qt::KeyboardModifier>)
Unexecuted instantiation: bool QWindowSystemHelper<QWindowSystemInterface::SynchronousDelivery>::handleEvent<QWindowSystemInterfacePrivate::ScreenOrientationEvent, QScreen*, Qt::ScreenOrientation>(QScreen*, Qt::ScreenOrientation)
Unexecuted instantiation: bool QWindowSystemHelper<QWindowSystemInterface::SynchronousDelivery>::handleEvent<QWindowSystemInterfacePrivate::ScreenGeometryEvent, QScreen*, QRect, QRect>(QScreen*, QRect, QRect)
Unexecuted instantiation: bool QWindowSystemHelper<QWindowSystemInterface::SynchronousDelivery>::handleEvent<QWindowSystemInterfacePrivate::ScreenLogicalDotsPerInchEvent, QScreen*, double, double>(QScreen*, double, double)
Unexecuted instantiation: bool QWindowSystemHelper<QWindowSystemInterface::SynchronousDelivery>::handleEvent<QWindowSystemInterfacePrivate::ScreenRefreshRateEvent, QScreen*, double>(QScreen*, double)
Unexecuted instantiation: bool QWindowSystemHelper<QWindowSystemInterface::SynchronousDelivery>::handleEvent<QWindowSystemInterfacePrivate::ThemeChangeEvent>()
Unexecuted instantiation: bool QWindowSystemHelper<QWindowSystemInterface::SynchronousDelivery>::handleEvent<QWindowSystemInterfacePrivate::TabletEvent, QWindow*, unsigned long, QPointF, QPointF, QPointingDevice const*, QFlags<Qt::MouseButton>, double, double, double, double, double, int, QFlags<Qt::KeyboardModifier> >(QWindow*, unsigned long, QPointF, QPointF, QPointingDevice const*, QFlags<Qt::MouseButton>, double, double, double, double, double, int, QFlags<Qt::KeyboardModifier>)
Unexecuted instantiation: bool QWindowSystemHelper<QWindowSystemInterface::SynchronousDelivery>::handleEvent<QWindowSystemInterfacePrivate::TabletEnterProximityEvent, unsigned long, QPointingDevice const*>(unsigned long, QPointingDevice const*)
Unexecuted instantiation: bool QWindowSystemHelper<QWindowSystemInterface::SynchronousDelivery>::handleEvent<QWindowSystemInterfacePrivate::TabletLeaveProximityEvent, unsigned long, QPointingDevice const*>(unsigned long, QPointingDevice const*)
Unexecuted instantiation: bool QWindowSystemHelper<QWindowSystemInterface::SynchronousDelivery>::handleEvent<QWindowSystemInterfacePrivate::GestureEvent, QWindow*, unsigned long, Qt::NativeGestureType, QPointingDevice const*, int, QPointF, QPointF, double, QPointF>(QWindow*, unsigned long, Qt::NativeGestureType, QPointingDevice const*, int, QPointF, QPointF, double, QPointF)
Unexecuted instantiation: bool QWindowSystemHelper<QWindowSystemInterface::SynchronousDelivery>::handleEvent<QWindowSystemInterfacePrivate::PlatformPanelEvent, QWindow*>(QWindow*)
Unexecuted instantiation: bool QWindowSystemHelper<QWindowSystemInterface::SynchronousDelivery>::handleEvent<QWindowSystemInterfacePrivate::ContextMenuEvent, QWindow*, bool, QPoint, QPoint, QFlags<Qt::KeyboardModifier> >(QWindow*, bool, QPoint, QPoint, QFlags<Qt::KeyboardModifier>)
118
119
/*
120
    Handles a window system event asynchronously by posting the event to Qt Gui.
121
122
    This function posts the event on the window system event queue and wakes the
123
    Gui event dispatcher. Qt Gui will then handle the event asynchronously at a
124
    later point.
125
*/
126
template<>
127
template<typename EventType, typename ...Args>
128
bool QWindowSystemHelper<QWindowSystemInterface::AsynchronousDelivery>::handleEvent(Args ...args)
129
0
{
130
0
    QWindowSystemInterfacePrivate::windowSystemEventQueue.append(new EventType(args...));
131
0
    if (QAbstractEventDispatcher *dispatcher = QGuiApplicationPrivate::qt_qpa_core_dispatcher())
132
0
        dispatcher->wakeUp();
133
0
    return true;
134
0
}
Unexecuted instantiation: bool QWindowSystemHelper<QWindowSystemInterface::AsynchronousDelivery>::handleEvent<QWindowSystemInterfacePrivate::EnterEvent, QWindow*, QPointF, QPointF>(QWindow*, QPointF, QPointF)
Unexecuted instantiation: bool QWindowSystemHelper<QWindowSystemInterface::AsynchronousDelivery>::handleEvent<QWindowSystemInterfacePrivate::LeaveEvent, QWindow*>(QWindow*)
Unexecuted instantiation: bool QWindowSystemHelper<QWindowSystemInterface::AsynchronousDelivery>::handleEvent<QWindowSystemInterfacePrivate::FocusWindowEvent, QWindow*, Qt::FocusReason>(QWindow*, Qt::FocusReason)
Unexecuted instantiation: bool QWindowSystemHelper<QWindowSystemInterface::AsynchronousDelivery>::handleEvent<QWindowSystemInterfacePrivate::WindowStateChangedEvent, QWindow*, QFlags<Qt::WindowState>, QFlags<Qt::WindowState> >(QWindow*, QFlags<Qt::WindowState>, QFlags<Qt::WindowState>)
Unexecuted instantiation: bool QWindowSystemHelper<QWindowSystemInterface::AsynchronousDelivery>::handleEvent<QWindowSystemInterfacePrivate::WindowScreenChangedEvent, QWindow*, QScreen*>(QWindow*, QScreen*)
Unexecuted instantiation: bool QWindowSystemHelper<QWindowSystemInterface::AsynchronousDelivery>::handleEvent<QWindowSystemInterfacePrivate::WindowDevicePixelRatioChangedEvent, QWindow*>(QWindow*)
Unexecuted instantiation: bool QWindowSystemHelper<QWindowSystemInterface::AsynchronousDelivery>::handleEvent<QWindowSystemInterfacePrivate::SafeAreaMarginsChangedEvent, QWindow*>(QWindow*)
Unexecuted instantiation: bool QWindowSystemHelper<QWindowSystemInterface::AsynchronousDelivery>::handleEvent<QWindowSystemInterfacePrivate::ApplicationStateChangedEvent, Qt::ApplicationState, bool>(Qt::ApplicationState, bool)
Unexecuted instantiation: bool QWindowSystemHelper<QWindowSystemInterface::AsynchronousDelivery>::handleEvent<QWindowSystemInterfacePrivate::WindowSystemEvent, QWindowSystemInterfacePrivate::EventType>(QWindowSystemInterfacePrivate::EventType)
Unexecuted instantiation: bool QWindowSystemHelper<QWindowSystemInterface::AsynchronousDelivery>::handleEvent<QWindowSystemInterfacePrivate::GeometryChangeEvent, QWindow*, QRect, QRect>(QWindow*, QRect, QRect)
Unexecuted instantiation: bool QWindowSystemHelper<QWindowSystemInterface::AsynchronousDelivery>::handleEvent<QWindowSystemInterfacePrivate::ExposeEvent, QWindow*, QRegion>(QWindow*, QRegion)
Unexecuted instantiation: bool QWindowSystemHelper<QWindowSystemInterface::AsynchronousDelivery>::handleEvent<QWindowSystemInterfacePrivate::PaintEvent, QWindow*, QRegion>(QWindow*, QRegion)
Unexecuted instantiation: bool QWindowSystemHelper<QWindowSystemInterface::AsynchronousDelivery>::handleEvent<QWindowSystemInterfacePrivate::CloseEvent, QWindow*>(QWindow*)
Unexecuted instantiation: bool QWindowSystemHelper<QWindowSystemInterface::AsynchronousDelivery>::handleEvent<QWindowSystemInterfacePrivate::MouseEvent, QWindow*, unsigned long, QPointF, QPointF, QFlags<Qt::MouseButton>, QFlags<Qt::KeyboardModifier>, Qt::MouseButton, QEvent::Type, Qt::MouseEventSource, bool, QPointingDevice const*>(QWindow*, unsigned long, QPointF, QPointF, QFlags<Qt::MouseButton>, QFlags<Qt::KeyboardModifier>, Qt::MouseButton, QEvent::Type, Qt::MouseEventSource, bool, QPointingDevice const*)
Unexecuted instantiation: bool QWindowSystemHelper<QWindowSystemInterface::AsynchronousDelivery>::handleEvent<QWindowSystemInterfacePrivate::KeyEvent, QWindow*, unsigned long, QEvent::Type, int, QFlags<Qt::KeyboardModifier>, unsigned int, unsigned int, unsigned int, QString, bool, unsigned short>(QWindow*, unsigned long, QEvent::Type, int, QFlags<Qt::KeyboardModifier>, unsigned int, unsigned int, unsigned int, QString, bool, unsigned short)
Unexecuted instantiation: bool QWindowSystemHelper<QWindowSystemInterface::AsynchronousDelivery>::handleEvent<QWindowSystemInterfacePrivate::KeyEvent, QWindow*, unsigned long, QEvent::Type, int, QFlags<Qt::KeyboardModifier>, QString, bool, unsigned short>(QWindow*, unsigned long, QEvent::Type, int, QFlags<Qt::KeyboardModifier>, QString, bool, unsigned short)
Unexecuted instantiation: bool QWindowSystemHelper<QWindowSystemInterface::AsynchronousDelivery>::handleEvent<QWindowSystemInterfacePrivate::WheelEvent, QWindow*, unsigned long, QPointF, QPointF, QPoint, QPoint, int, Qt::Orientation, QFlags<Qt::KeyboardModifier>, Qt::ScrollPhase, Qt::MouseEventSource, bool, QPointingDevice const*>(QWindow*, unsigned long, QPointF, QPointF, QPoint, QPoint, int, Qt::Orientation, QFlags<Qt::KeyboardModifier>, Qt::ScrollPhase, Qt::MouseEventSource, bool, QPointingDevice const*)
Unexecuted instantiation: bool QWindowSystemHelper<QWindowSystemInterface::AsynchronousDelivery>::handleEvent<QWindowSystemInterfacePrivate::TouchEvent, QWindow*, unsigned long, QEvent::Type, QPointingDevice const*, QList<QEventPoint>, QFlags<Qt::KeyboardModifier> >(QWindow*, unsigned long, QEvent::Type, QPointingDevice const*, QList<QEventPoint>, QFlags<Qt::KeyboardModifier>)
Unexecuted instantiation: bool QWindowSystemHelper<QWindowSystemInterface::AsynchronousDelivery>::handleEvent<QWindowSystemInterfacePrivate::ScreenOrientationEvent, QScreen*, Qt::ScreenOrientation>(QScreen*, Qt::ScreenOrientation)
Unexecuted instantiation: bool QWindowSystemHelper<QWindowSystemInterface::AsynchronousDelivery>::handleEvent<QWindowSystemInterfacePrivate::ScreenGeometryEvent, QScreen*, QRect, QRect>(QScreen*, QRect, QRect)
Unexecuted instantiation: bool QWindowSystemHelper<QWindowSystemInterface::AsynchronousDelivery>::handleEvent<QWindowSystemInterfacePrivate::ScreenLogicalDotsPerInchEvent, QScreen*, double, double>(QScreen*, double, double)
Unexecuted instantiation: bool QWindowSystemHelper<QWindowSystemInterface::AsynchronousDelivery>::handleEvent<QWindowSystemInterfacePrivate::ScreenRefreshRateEvent, QScreen*, double>(QScreen*, double)
Unexecuted instantiation: bool QWindowSystemHelper<QWindowSystemInterface::AsynchronousDelivery>::handleEvent<QWindowSystemInterfacePrivate::ThemeChangeEvent>()
Unexecuted instantiation: bool QWindowSystemHelper<QWindowSystemInterface::AsynchronousDelivery>::handleEvent<QWindowSystemInterfacePrivate::TabletEvent, QWindow*, unsigned long, QPointF, QPointF, QPointingDevice const*, QFlags<Qt::MouseButton>, double, double, double, double, double, int, QFlags<Qt::KeyboardModifier> >(QWindow*, unsigned long, QPointF, QPointF, QPointingDevice const*, QFlags<Qt::MouseButton>, double, double, double, double, double, int, QFlags<Qt::KeyboardModifier>)
Unexecuted instantiation: bool QWindowSystemHelper<QWindowSystemInterface::AsynchronousDelivery>::handleEvent<QWindowSystemInterfacePrivate::TabletEnterProximityEvent, unsigned long, QPointingDevice const*>(unsigned long, QPointingDevice const*)
Unexecuted instantiation: bool QWindowSystemHelper<QWindowSystemInterface::AsynchronousDelivery>::handleEvent<QWindowSystemInterfacePrivate::TabletLeaveProximityEvent, unsigned long, QPointingDevice const*>(unsigned long, QPointingDevice const*)
Unexecuted instantiation: bool QWindowSystemHelper<QWindowSystemInterface::AsynchronousDelivery>::handleEvent<QWindowSystemInterfacePrivate::GestureEvent, QWindow*, unsigned long, Qt::NativeGestureType, QPointingDevice const*, int, QPointF, QPointF, double, QPointF>(QWindow*, unsigned long, Qt::NativeGestureType, QPointingDevice const*, int, QPointF, QPointF, double, QPointF)
Unexecuted instantiation: bool QWindowSystemHelper<QWindowSystemInterface::AsynchronousDelivery>::handleEvent<QWindowSystemInterfacePrivate::PlatformPanelEvent, QWindow*>(QWindow*)
Unexecuted instantiation: bool QWindowSystemHelper<QWindowSystemInterface::AsynchronousDelivery>::handleEvent<QWindowSystemInterfacePrivate::ContextMenuEvent, QWindow*, bool, QPoint, QPoint, QFlags<Qt::KeyboardModifier> >(QWindow*, bool, QPoint, QPoint, QFlags<Qt::KeyboardModifier>)
Unexecuted instantiation: bool QWindowSystemHelper<QWindowSystemInterface::AsynchronousDelivery>::handleEvent<QWindowSystemInterfacePrivate::FlushEventsEvent, QFlags<QEventLoop::ProcessEventsFlag> >(QFlags<QEventLoop::ProcessEventsFlag>)
135
136
template <typename EventType, typename Delivery = QWindowSystemInterface::DefaultDelivery, typename ...Args>
137
static bool handleWindowSystemEvent(Args ...args)
138
0
{
139
0
    return QWindowSystemHelper<Delivery>::template handleEvent<EventType>(args...);
140
0
}
Unexecuted instantiation: qwindowsysteminterface.cpp:bool handleWindowSystemEvent<QWindowSystemInterfacePrivate::EnterEvent, QWindowSystemInterface::DefaultDelivery, QWindow*, QPointF, QPointF>(QWindow*, QPointF, QPointF)
Unexecuted instantiation: qwindowsysteminterface.cpp:bool handleWindowSystemEvent<QWindowSystemInterfacePrivate::EnterEvent, QWindowSystemInterface::SynchronousDelivery, QWindow*, QPointF, QPointF>(QWindow*, QPointF, QPointF)
Unexecuted instantiation: qwindowsysteminterface.cpp:bool handleWindowSystemEvent<QWindowSystemInterfacePrivate::EnterEvent, QWindowSystemInterface::AsynchronousDelivery, QWindow*, QPointF, QPointF>(QWindow*, QPointF, QPointF)
Unexecuted instantiation: qwindowsysteminterface.cpp:bool handleWindowSystemEvent<QWindowSystemInterfacePrivate::LeaveEvent, QWindowSystemInterface::DefaultDelivery, QWindow*>(QWindow*)
Unexecuted instantiation: qwindowsysteminterface.cpp:bool handleWindowSystemEvent<QWindowSystemInterfacePrivate::LeaveEvent, QWindowSystemInterface::SynchronousDelivery, QWindow*>(QWindow*)
Unexecuted instantiation: qwindowsysteminterface.cpp:bool handleWindowSystemEvent<QWindowSystemInterfacePrivate::LeaveEvent, QWindowSystemInterface::AsynchronousDelivery, QWindow*>(QWindow*)
Unexecuted instantiation: qwindowsysteminterface.cpp:bool handleWindowSystemEvent<QWindowSystemInterfacePrivate::FocusWindowEvent, QWindowSystemInterface::DefaultDelivery, QWindow*, Qt::FocusReason>(QWindow*, Qt::FocusReason)
Unexecuted instantiation: qwindowsysteminterface.cpp:bool handleWindowSystemEvent<QWindowSystemInterfacePrivate::FocusWindowEvent, QWindowSystemInterface::SynchronousDelivery, QWindow*, Qt::FocusReason>(QWindow*, Qt::FocusReason)
Unexecuted instantiation: qwindowsysteminterface.cpp:bool handleWindowSystemEvent<QWindowSystemInterfacePrivate::FocusWindowEvent, QWindowSystemInterface::AsynchronousDelivery, QWindow*, Qt::FocusReason>(QWindow*, Qt::FocusReason)
Unexecuted instantiation: qwindowsysteminterface.cpp:bool handleWindowSystemEvent<QWindowSystemInterfacePrivate::WindowStateChangedEvent, QWindowSystemInterface::DefaultDelivery, QWindow*, QFlags<Qt::WindowState>, QFlags<Qt::WindowState> >(QWindow*, QFlags<Qt::WindowState>, QFlags<Qt::WindowState>)
Unexecuted instantiation: qwindowsysteminterface.cpp:bool handleWindowSystemEvent<QWindowSystemInterfacePrivate::WindowStateChangedEvent, QWindowSystemInterface::SynchronousDelivery, QWindow*, QFlags<Qt::WindowState>, QFlags<Qt::WindowState> >(QWindow*, QFlags<Qt::WindowState>, QFlags<Qt::WindowState>)
Unexecuted instantiation: qwindowsysteminterface.cpp:bool handleWindowSystemEvent<QWindowSystemInterfacePrivate::WindowStateChangedEvent, QWindowSystemInterface::AsynchronousDelivery, QWindow*, QFlags<Qt::WindowState>, QFlags<Qt::WindowState> >(QWindow*, QFlags<Qt::WindowState>, QFlags<Qt::WindowState>)
Unexecuted instantiation: qwindowsysteminterface.cpp:bool handleWindowSystemEvent<QWindowSystemInterfacePrivate::WindowScreenChangedEvent, QWindowSystemInterface::DefaultDelivery, QWindow*, QScreen*>(QWindow*, QScreen*)
Unexecuted instantiation: qwindowsysteminterface.cpp:bool handleWindowSystemEvent<QWindowSystemInterfacePrivate::WindowScreenChangedEvent, QWindowSystemInterface::SynchronousDelivery, QWindow*, QScreen*>(QWindow*, QScreen*)
Unexecuted instantiation: qwindowsysteminterface.cpp:bool handleWindowSystemEvent<QWindowSystemInterfacePrivate::WindowScreenChangedEvent, QWindowSystemInterface::AsynchronousDelivery, QWindow*, QScreen*>(QWindow*, QScreen*)
Unexecuted instantiation: qwindowsysteminterface.cpp:bool handleWindowSystemEvent<QWindowSystemInterfacePrivate::WindowDevicePixelRatioChangedEvent, QWindowSystemInterface::DefaultDelivery, QWindow*>(QWindow*)
Unexecuted instantiation: qwindowsysteminterface.cpp:bool handleWindowSystemEvent<QWindowSystemInterfacePrivate::WindowDevicePixelRatioChangedEvent, QWindowSystemInterface::SynchronousDelivery, QWindow*>(QWindow*)
Unexecuted instantiation: qwindowsysteminterface.cpp:bool handleWindowSystemEvent<QWindowSystemInterfacePrivate::WindowDevicePixelRatioChangedEvent, QWindowSystemInterface::AsynchronousDelivery, QWindow*>(QWindow*)
Unexecuted instantiation: qwindowsysteminterface.cpp:bool handleWindowSystemEvent<QWindowSystemInterfacePrivate::SafeAreaMarginsChangedEvent, QWindowSystemInterface::DefaultDelivery, QWindow*>(QWindow*)
Unexecuted instantiation: qwindowsysteminterface.cpp:bool handleWindowSystemEvent<QWindowSystemInterfacePrivate::SafeAreaMarginsChangedEvent, QWindowSystemInterface::SynchronousDelivery, QWindow*>(QWindow*)
Unexecuted instantiation: qwindowsysteminterface.cpp:bool handleWindowSystemEvent<QWindowSystemInterfacePrivate::SafeAreaMarginsChangedEvent, QWindowSystemInterface::AsynchronousDelivery, QWindow*>(QWindow*)
Unexecuted instantiation: qwindowsysteminterface.cpp:bool handleWindowSystemEvent<QWindowSystemInterfacePrivate::ApplicationStateChangedEvent, QWindowSystemInterface::DefaultDelivery, Qt::ApplicationState, bool>(Qt::ApplicationState, bool)
Unexecuted instantiation: qwindowsysteminterface.cpp:bool handleWindowSystemEvent<QWindowSystemInterfacePrivate::ApplicationStateChangedEvent, QWindowSystemInterface::SynchronousDelivery, Qt::ApplicationState, bool>(Qt::ApplicationState, bool)
Unexecuted instantiation: qwindowsysteminterface.cpp:bool handleWindowSystemEvent<QWindowSystemInterfacePrivate::ApplicationStateChangedEvent, QWindowSystemInterface::AsynchronousDelivery, Qt::ApplicationState, bool>(Qt::ApplicationState, bool)
Unexecuted instantiation: qwindowsysteminterface.cpp:bool handleWindowSystemEvent<QWindowSystemInterfacePrivate::WindowSystemEvent, QWindowSystemInterface::SynchronousDelivery, QWindowSystemInterfacePrivate::EventType>(QWindowSystemInterfacePrivate::EventType)
Unexecuted instantiation: qwindowsysteminterface.cpp:bool handleWindowSystemEvent<QWindowSystemInterfacePrivate::WindowSystemEvent, QWindowSystemInterface::AsynchronousDelivery, QWindowSystemInterfacePrivate::EventType>(QWindowSystemInterfacePrivate::EventType)
Unexecuted instantiation: qwindowsysteminterface.cpp:bool handleWindowSystemEvent<QWindowSystemInterfacePrivate::GeometryChangeEvent, QWindowSystemInterface::DefaultDelivery, QWindow*, QRect, QRect>(QWindow*, QRect, QRect)
Unexecuted instantiation: qwindowsysteminterface.cpp:bool handleWindowSystemEvent<QWindowSystemInterfacePrivate::GeometryChangeEvent, QWindowSystemInterface::SynchronousDelivery, QWindow*, QRect, QRect>(QWindow*, QRect, QRect)
Unexecuted instantiation: qwindowsysteminterface.cpp:bool handleWindowSystemEvent<QWindowSystemInterfacePrivate::GeometryChangeEvent, QWindowSystemInterface::AsynchronousDelivery, QWindow*, QRect, QRect>(QWindow*, QRect, QRect)
Unexecuted instantiation: qwindowsysteminterface.cpp:bool handleWindowSystemEvent<QWindowSystemInterfacePrivate::ExposeEvent, QWindowSystemInterface::DefaultDelivery, QWindow*, QRegion>(QWindow*, QRegion)
Unexecuted instantiation: qwindowsysteminterface.cpp:bool handleWindowSystemEvent<QWindowSystemInterfacePrivate::ExposeEvent, QWindowSystemInterface::SynchronousDelivery, QWindow*, QRegion>(QWindow*, QRegion)
Unexecuted instantiation: qwindowsysteminterface.cpp:bool handleWindowSystemEvent<QWindowSystemInterfacePrivate::ExposeEvent, QWindowSystemInterface::AsynchronousDelivery, QWindow*, QRegion>(QWindow*, QRegion)
Unexecuted instantiation: qwindowsysteminterface.cpp:bool handleWindowSystemEvent<QWindowSystemInterfacePrivate::PaintEvent, QWindowSystemInterface::DefaultDelivery, QWindow*, QRegion>(QWindow*, QRegion)
Unexecuted instantiation: qwindowsysteminterface.cpp:bool handleWindowSystemEvent<QWindowSystemInterfacePrivate::PaintEvent, QWindowSystemInterface::SynchronousDelivery, QWindow*, QRegion>(QWindow*, QRegion)
Unexecuted instantiation: qwindowsysteminterface.cpp:bool handleWindowSystemEvent<QWindowSystemInterfacePrivate::PaintEvent, QWindowSystemInterface::AsynchronousDelivery, QWindow*, QRegion>(QWindow*, QRegion)
Unexecuted instantiation: qwindowsysteminterface.cpp:bool handleWindowSystemEvent<QWindowSystemInterfacePrivate::CloseEvent, QWindowSystemInterface::DefaultDelivery, QWindow*>(QWindow*)
Unexecuted instantiation: qwindowsysteminterface.cpp:bool handleWindowSystemEvent<QWindowSystemInterfacePrivate::CloseEvent, QWindowSystemInterface::SynchronousDelivery, QWindow*>(QWindow*)
Unexecuted instantiation: qwindowsysteminterface.cpp:bool handleWindowSystemEvent<QWindowSystemInterfacePrivate::CloseEvent, QWindowSystemInterface::AsynchronousDelivery, QWindow*>(QWindow*)
Unexecuted instantiation: qwindowsysteminterface.cpp:bool handleWindowSystemEvent<QWindowSystemInterfacePrivate::MouseEvent, QWindowSystemInterface::DefaultDelivery, QWindow*, unsigned long, QPointF, QPointF, QFlags<Qt::MouseButton>, QFlags<Qt::KeyboardModifier>, Qt::MouseButton, QEvent::Type, Qt::MouseEventSource, bool, QPointingDevice const*>(QWindow*, unsigned long, QPointF, QPointF, QFlags<Qt::MouseButton>, QFlags<Qt::KeyboardModifier>, Qt::MouseButton, QEvent::Type, Qt::MouseEventSource, bool, QPointingDevice const*)
Unexecuted instantiation: qwindowsysteminterface.cpp:bool handleWindowSystemEvent<QWindowSystemInterfacePrivate::MouseEvent, QWindowSystemInterface::SynchronousDelivery, QWindow*, unsigned long, QPointF, QPointF, QFlags<Qt::MouseButton>, QFlags<Qt::KeyboardModifier>, Qt::MouseButton, QEvent::Type, Qt::MouseEventSource, bool, QPointingDevice const*>(QWindow*, unsigned long, QPointF, QPointF, QFlags<Qt::MouseButton>, QFlags<Qt::KeyboardModifier>, Qt::MouseButton, QEvent::Type, Qt::MouseEventSource, bool, QPointingDevice const*)
Unexecuted instantiation: qwindowsysteminterface.cpp:bool handleWindowSystemEvent<QWindowSystemInterfacePrivate::MouseEvent, QWindowSystemInterface::AsynchronousDelivery, QWindow*, unsigned long, QPointF, QPointF, QFlags<Qt::MouseButton>, QFlags<Qt::KeyboardModifier>, Qt::MouseButton, QEvent::Type, Qt::MouseEventSource, bool, QPointingDevice const*>(QWindow*, unsigned long, QPointF, QPointF, QFlags<Qt::MouseButton>, QFlags<Qt::KeyboardModifier>, Qt::MouseButton, QEvent::Type, Qt::MouseEventSource, bool, QPointingDevice const*)
Unexecuted instantiation: qwindowsysteminterface.cpp:bool handleWindowSystemEvent<QWindowSystemInterfacePrivate::KeyEvent, QWindowSystemInterface::SynchronousDelivery, QWindow*, unsigned long, QEvent::Type, int, QFlags<Qt::KeyboardModifier>, unsigned int, unsigned int, unsigned int, QString, bool, unsigned short>(QWindow*, unsigned long, QEvent::Type, int, QFlags<Qt::KeyboardModifier>, unsigned int, unsigned int, unsigned int, QString, bool, unsigned short)
Unexecuted instantiation: qwindowsysteminterface.cpp:bool handleWindowSystemEvent<QWindowSystemInterfacePrivate::KeyEvent, QWindowSystemInterface::DefaultDelivery, QWindow*, unsigned long, QEvent::Type, int, QFlags<Qt::KeyboardModifier>, QString, bool, unsigned short>(QWindow*, unsigned long, QEvent::Type, int, QFlags<Qt::KeyboardModifier>, QString, bool, unsigned short)
Unexecuted instantiation: qwindowsysteminterface.cpp:bool handleWindowSystemEvent<QWindowSystemInterfacePrivate::KeyEvent, QWindowSystemInterface::SynchronousDelivery, QWindow*, unsigned long, QEvent::Type, int, QFlags<Qt::KeyboardModifier>, QString, bool, unsigned short>(QWindow*, unsigned long, QEvent::Type, int, QFlags<Qt::KeyboardModifier>, QString, bool, unsigned short)
Unexecuted instantiation: qwindowsysteminterface.cpp:bool handleWindowSystemEvent<QWindowSystemInterfacePrivate::KeyEvent, QWindowSystemInterface::AsynchronousDelivery, QWindow*, unsigned long, QEvent::Type, int, QFlags<Qt::KeyboardModifier>, QString, bool, unsigned short>(QWindow*, unsigned long, QEvent::Type, int, QFlags<Qt::KeyboardModifier>, QString, bool, unsigned short)
Unexecuted instantiation: qwindowsysteminterface.cpp:bool handleWindowSystemEvent<QWindowSystemInterfacePrivate::KeyEvent, QWindowSystemInterface::DefaultDelivery, QWindow*, unsigned long, QEvent::Type, int, QFlags<Qt::KeyboardModifier>, unsigned int, unsigned int, unsigned int, QString, bool, unsigned short>(QWindow*, unsigned long, QEvent::Type, int, QFlags<Qt::KeyboardModifier>, unsigned int, unsigned int, unsigned int, QString, bool, unsigned short)
Unexecuted instantiation: qwindowsysteminterface.cpp:bool handleWindowSystemEvent<QWindowSystemInterfacePrivate::WheelEvent, QWindowSystemInterface::DefaultDelivery, QWindow*, unsigned long, QPointF, QPointF, QPoint, QPoint, int, Qt::Orientation, QFlags<Qt::KeyboardModifier>, Qt::ScrollPhase, Qt::MouseEventSource, bool, QPointingDevice const*>(QWindow*, unsigned long, QPointF, QPointF, QPoint, QPoint, int, Qt::Orientation, QFlags<Qt::KeyboardModifier>, Qt::ScrollPhase, Qt::MouseEventSource, bool, QPointingDevice const*)
Unexecuted instantiation: qwindowsysteminterface.cpp:bool handleWindowSystemEvent<QWindowSystemInterfacePrivate::TouchEvent, QWindowSystemInterface::DefaultDelivery, QWindow*, unsigned long, QEvent::Type, QPointingDevice const*, QList<QEventPoint>, QFlags<Qt::KeyboardModifier> >(QWindow*, unsigned long, QEvent::Type, QPointingDevice const*, QList<QEventPoint>, QFlags<Qt::KeyboardModifier>)
Unexecuted instantiation: qwindowsysteminterface.cpp:bool handleWindowSystemEvent<QWindowSystemInterfacePrivate::TouchEvent, QWindowSystemInterface::SynchronousDelivery, QWindow*, unsigned long, QEvent::Type, QPointingDevice const*, QList<QEventPoint>, QFlags<Qt::KeyboardModifier> >(QWindow*, unsigned long, QEvent::Type, QPointingDevice const*, QList<QEventPoint>, QFlags<Qt::KeyboardModifier>)
Unexecuted instantiation: qwindowsysteminterface.cpp:bool handleWindowSystemEvent<QWindowSystemInterfacePrivate::TouchEvent, QWindowSystemInterface::AsynchronousDelivery, QWindow*, unsigned long, QEvent::Type, QPointingDevice const*, QList<QEventPoint>, QFlags<Qt::KeyboardModifier> >(QWindow*, unsigned long, QEvent::Type, QPointingDevice const*, QList<QEventPoint>, QFlags<Qt::KeyboardModifier>)
Unexecuted instantiation: qwindowsysteminterface.cpp:bool handleWindowSystemEvent<QWindowSystemInterfacePrivate::ScreenOrientationEvent, QWindowSystemInterface::DefaultDelivery, QScreen*, Qt::ScreenOrientation>(QScreen*, Qt::ScreenOrientation)
Unexecuted instantiation: qwindowsysteminterface.cpp:bool handleWindowSystemEvent<QWindowSystemInterfacePrivate::ScreenGeometryEvent, QWindowSystemInterface::DefaultDelivery, QScreen*, QRect, QRect>(QScreen*, QRect, QRect)
Unexecuted instantiation: qwindowsysteminterface.cpp:bool handleWindowSystemEvent<QWindowSystemInterfacePrivate::ScreenLogicalDotsPerInchEvent, QWindowSystemInterface::DefaultDelivery, QScreen*, double, double>(QScreen*, double, double)
Unexecuted instantiation: qwindowsysteminterface.cpp:bool handleWindowSystemEvent<QWindowSystemInterfacePrivate::ScreenRefreshRateEvent, QWindowSystemInterface::DefaultDelivery, QScreen*, double>(QScreen*, double)
Unexecuted instantiation: qwindowsysteminterface.cpp:bool handleWindowSystemEvent<QWindowSystemInterfacePrivate::ThemeChangeEvent, QWindowSystemInterface::DefaultDelivery>()
Unexecuted instantiation: qwindowsysteminterface.cpp:bool handleWindowSystemEvent<QWindowSystemInterfacePrivate::ThemeChangeEvent, QWindowSystemInterface::SynchronousDelivery>()
Unexecuted instantiation: qwindowsysteminterface.cpp:bool handleWindowSystemEvent<QWindowSystemInterfacePrivate::ThemeChangeEvent, QWindowSystemInterface::AsynchronousDelivery>()
Unexecuted instantiation: qwindowsysteminterface.cpp:bool handleWindowSystemEvent<QWindowSystemInterfacePrivate::TabletEvent, QWindowSystemInterface::DefaultDelivery, QWindow*, unsigned long, QPointF, QPointF, QPointingDevice const*, QFlags<Qt::MouseButton>, double, double, double, double, double, int, QFlags<Qt::KeyboardModifier> >(QWindow*, unsigned long, QPointF, QPointF, QPointingDevice const*, QFlags<Qt::MouseButton>, double, double, double, double, double, int, QFlags<Qt::KeyboardModifier>)
Unexecuted instantiation: qwindowsysteminterface.cpp:bool handleWindowSystemEvent<QWindowSystemInterfacePrivate::TabletEnterProximityEvent, QWindowSystemInterface::DefaultDelivery, unsigned long, QPointingDevice const*>(unsigned long, QPointingDevice const*)
Unexecuted instantiation: qwindowsysteminterface.cpp:bool handleWindowSystemEvent<QWindowSystemInterfacePrivate::TabletLeaveProximityEvent, QWindowSystemInterface::DefaultDelivery, unsigned long, QPointingDevice const*>(unsigned long, QPointingDevice const*)
Unexecuted instantiation: qwindowsysteminterface.cpp:bool handleWindowSystemEvent<QWindowSystemInterfacePrivate::GestureEvent, QWindowSystemInterface::DefaultDelivery, QWindow*, unsigned long, Qt::NativeGestureType, QPointingDevice const*, int, QPointF, QPointF, double, QPointF>(QWindow*, unsigned long, Qt::NativeGestureType, QPointingDevice const*, int, QPointF, QPointF, double, QPointF)
Unexecuted instantiation: qwindowsysteminterface.cpp:bool handleWindowSystemEvent<QWindowSystemInterfacePrivate::PlatformPanelEvent, QWindowSystemInterface::DefaultDelivery, QWindow*>(QWindow*)
Unexecuted instantiation: qwindowsysteminterface.cpp:bool handleWindowSystemEvent<QWindowSystemInterfacePrivate::ContextMenuEvent, QWindowSystemInterface::DefaultDelivery, QWindow*, bool, QPoint, QPoint, QFlags<Qt::KeyboardModifier> >(QWindow*, bool, QPoint, QPoint, QFlags<Qt::KeyboardModifier>)
Unexecuted instantiation: qwindowsysteminterface.cpp:bool handleWindowSystemEvent<QWindowSystemInterfacePrivate::ContextMenuEvent, QWindowSystemInterface::SynchronousDelivery, QWindow*, bool, QPoint, QPoint, QFlags<Qt::KeyboardModifier> >(QWindow*, bool, QPoint, QPoint, QFlags<Qt::KeyboardModifier>)
Unexecuted instantiation: qwindowsysteminterface.cpp:bool handleWindowSystemEvent<QWindowSystemInterfacePrivate::ContextMenuEvent, QWindowSystemInterface::AsynchronousDelivery, QWindow*, bool, QPoint, QPoint, QFlags<Qt::KeyboardModifier> >(QWindow*, bool, QPoint, QPoint, QFlags<Qt::KeyboardModifier>)
Unexecuted instantiation: qwindowsysteminterface.cpp:bool handleWindowSystemEvent<QWindowSystemInterfacePrivate::WindowSystemEvent, QWindowSystemInterface::DefaultDelivery, QWindowSystemInterfacePrivate::EventType>(QWindowSystemInterfacePrivate::EventType)
Unexecuted instantiation: qwindowsysteminterface.cpp:bool handleWindowSystemEvent<QWindowSystemInterfacePrivate::FlushEventsEvent, QWindowSystemInterface::AsynchronousDelivery, QFlags<QEventLoop::ProcessEventsFlag> >(QFlags<QEventLoop::ProcessEventsFlag>)
141
142
qsizetype QWindowSystemInterfacePrivate::windowSystemEventsQueued()
143
0
{
144
0
    return windowSystemEventQueue.count();
145
0
}
146
147
bool QWindowSystemInterfacePrivate::nonUserInputEventsQueued()
148
0
{
149
0
    return windowSystemEventQueue.nonUserInputEventsQueued();
150
0
}
151
152
QWindowSystemInterfacePrivate::WindowSystemEvent * QWindowSystemInterfacePrivate::getWindowSystemEvent()
153
0
{
154
0
    return windowSystemEventQueue.takeFirstOrReturnNull();
155
0
}
156
157
QWindowSystemInterfacePrivate::WindowSystemEvent *QWindowSystemInterfacePrivate::getNonUserInputWindowSystemEvent()
158
0
{
159
0
    return windowSystemEventQueue.takeFirstNonUserInputOrReturnNull();
160
0
}
161
162
QWindowSystemInterfacePrivate::WindowSystemEvent *QWindowSystemInterfacePrivate::peekWindowSystemEvent(EventType t)
163
0
{
164
0
    return windowSystemEventQueue.peekAtFirstOfType(t);
165
0
}
166
167
void QWindowSystemInterfacePrivate::removeWindowSystemEvent(WindowSystemEvent *event)
168
0
{
169
0
    windowSystemEventQueue.remove(event);
170
0
}
171
172
void QWindowSystemInterfacePrivate::installWindowSystemEventHandler(QWindowSystemEventHandler *handler)
173
0
{
174
0
    if (!eventHandler)
175
0
        eventHandler = handler;
176
0
}
177
178
void QWindowSystemInterfacePrivate::removeWindowSystemEventhandler(QWindowSystemEventHandler *handler)
179
0
{
180
0
    if (eventHandler == handler)
181
0
        eventHandler = nullptr;
182
0
}
183
184
QWindowSystemEventHandler::~QWindowSystemEventHandler()
185
0
{
186
0
    QWindowSystemInterfacePrivate::removeWindowSystemEventhandler(this);
187
0
}
188
189
bool QWindowSystemEventHandler::sendEvent(QWindowSystemInterfacePrivate::WindowSystemEvent *e)
190
0
{
191
0
    QGuiApplicationPrivate::processWindowSystemEvent(e);
192
0
    return true;
193
0
}
194
195
//------------------------------------------------------------
196
//
197
// Callback functions for plugins:
198
//
199
200
#define QT_DEFINE_QPA_EVENT_HANDLER(ReturnType, HandlerName, ...) \
201
    template Q_GUI_EXPORT ReturnType QWindowSystemInterface::HandlerName<QWindowSystemInterface::DefaultDelivery>(__VA_ARGS__); \
202
    template Q_GUI_EXPORT ReturnType QWindowSystemInterface::HandlerName<QWindowSystemInterface::SynchronousDelivery>(__VA_ARGS__); \
203
    template Q_GUI_EXPORT ReturnType QWindowSystemInterface::HandlerName<QWindowSystemInterface::AsynchronousDelivery>(__VA_ARGS__); \
204
    template<typename Delivery> ReturnType QWindowSystemInterface::HandlerName(__VA_ARGS__)
205
206
/*!
207
    \class QWindowSystemInterface
208
    \since 5.0
209
    \internal
210
    \preliminary
211
    \ingroup qpa
212
    \brief The QWindowSystemInterface provides an event queue for the QPA platform.
213
214
    The platform plugins call the various functions to notify about events. The events are queued
215
    until sendWindowSystemEvents() is called by the event dispatcher.
216
*/
217
218
QT_DEFINE_QPA_EVENT_HANDLER(void, handleEnterEvent, QWindow *window, const QPointF &local, const QPointF &global)
219
0
{
220
0
    if (window) {
221
0
        handleWindowSystemEvent<QWindowSystemInterfacePrivate::EnterEvent, Delivery>(window,
222
0
            QHighDpi::fromNativeLocalPosition(local, window), QHighDpi::fromNativeGlobalPosition(global, window));
223
0
    }
224
0
}
Unexecuted instantiation: void QWindowSystemInterface::handleEnterEvent<QWindowSystemInterface::DefaultDelivery>(QWindow*, QPointF const&, QPointF const&)
Unexecuted instantiation: void QWindowSystemInterface::handleEnterEvent<QWindowSystemInterface::SynchronousDelivery>(QWindow*, QPointF const&, QPointF const&)
Unexecuted instantiation: void QWindowSystemInterface::handleEnterEvent<QWindowSystemInterface::AsynchronousDelivery>(QWindow*, QPointF const&, QPointF const&)
225
226
QT_DEFINE_QPA_EVENT_HANDLER(void, handleLeaveEvent, QWindow *window)
227
0
{
228
0
    handleWindowSystemEvent<QWindowSystemInterfacePrivate::LeaveEvent, Delivery>(window);
229
0
}
Unexecuted instantiation: void QWindowSystemInterface::handleLeaveEvent<QWindowSystemInterface::DefaultDelivery>(QWindow*)
Unexecuted instantiation: void QWindowSystemInterface::handleLeaveEvent<QWindowSystemInterface::SynchronousDelivery>(QWindow*)
Unexecuted instantiation: void QWindowSystemInterface::handleLeaveEvent<QWindowSystemInterface::AsynchronousDelivery>(QWindow*)
230
231
/*!
232
    This method can be used to ensure leave and enter events are both in queue when moving from
233
    one QWindow to another. This allows QWindow subclasses to check for a queued enter event
234
    when handling the leave event (\c QWindowSystemInterfacePrivate::peekWindowSystemEvent) to
235
    determine where mouse went and act accordingly. E.g. QWidgetWindow needs to know if mouse
236
    cursor moves between windows in same window hierarchy.
237
*/
238
void QWindowSystemInterface::handleEnterLeaveEvent(QWindow *enter, QWindow *leave, const QPointF &local, const QPointF& global)
239
0
{
240
0
    handleLeaveEvent<AsynchronousDelivery>(leave);
241
0
    handleEnterEvent(enter, local, global);
242
0
}
243
244
QT_DEFINE_QPA_EVENT_HANDLER(void, handleFocusWindowChanged, QWindow *window, Qt::FocusReason r)
245
0
{
246
0
    handleWindowSystemEvent<QWindowSystemInterfacePrivate::FocusWindowEvent, Delivery>(window, r);
247
0
}
Unexecuted instantiation: void QWindowSystemInterface::handleFocusWindowChanged<QWindowSystemInterface::DefaultDelivery>(QWindow*, Qt::FocusReason)
Unexecuted instantiation: void QWindowSystemInterface::handleFocusWindowChanged<QWindowSystemInterface::SynchronousDelivery>(QWindow*, Qt::FocusReason)
Unexecuted instantiation: void QWindowSystemInterface::handleFocusWindowChanged<QWindowSystemInterface::AsynchronousDelivery>(QWindow*, Qt::FocusReason)
248
249
QT_DEFINE_QPA_EVENT_HANDLER(void, handleWindowStateChanged, QWindow *window, Qt::WindowStates newState, int oldState)
250
0
{
251
0
    Q_ASSERT(window);
252
0
    if (oldState < Qt::WindowNoState)
253
0
        oldState = window->windowStates();
254
255
0
    handleWindowSystemEvent<QWindowSystemInterfacePrivate::WindowStateChangedEvent, Delivery>(window, newState, Qt::WindowStates(oldState));
256
0
}
Unexecuted instantiation: void QWindowSystemInterface::handleWindowStateChanged<QWindowSystemInterface::DefaultDelivery>(QWindow*, QFlags<Qt::WindowState>, int)
Unexecuted instantiation: void QWindowSystemInterface::handleWindowStateChanged<QWindowSystemInterface::SynchronousDelivery>(QWindow*, QFlags<Qt::WindowState>, int)
Unexecuted instantiation: void QWindowSystemInterface::handleWindowStateChanged<QWindowSystemInterface::AsynchronousDelivery>(QWindow*, QFlags<Qt::WindowState>, int)
257
258
QT_DEFINE_QPA_EVENT_HANDLER(void, handleWindowScreenChanged, QWindow *window, QScreen *screen)
259
0
{
260
0
    handleWindowSystemEvent<QWindowSystemInterfacePrivate::WindowScreenChangedEvent, Delivery>(window, screen);
261
0
}
Unexecuted instantiation: void QWindowSystemInterface::handleWindowScreenChanged<QWindowSystemInterface::DefaultDelivery>(QWindow*, QScreen*)
Unexecuted instantiation: void QWindowSystemInterface::handleWindowScreenChanged<QWindowSystemInterface::SynchronousDelivery>(QWindow*, QScreen*)
Unexecuted instantiation: void QWindowSystemInterface::handleWindowScreenChanged<QWindowSystemInterface::AsynchronousDelivery>(QWindow*, QScreen*)
262
263
QT_DEFINE_QPA_EVENT_HANDLER(void, handleWindowDevicePixelRatioChanged, QWindow *window)
264
0
{
265
0
    handleWindowSystemEvent<QWindowSystemInterfacePrivate::WindowDevicePixelRatioChangedEvent, Delivery>(window);
266
0
}
Unexecuted instantiation: void QWindowSystemInterface::handleWindowDevicePixelRatioChanged<QWindowSystemInterface::DefaultDelivery>(QWindow*)
Unexecuted instantiation: void QWindowSystemInterface::handleWindowDevicePixelRatioChanged<QWindowSystemInterface::SynchronousDelivery>(QWindow*)
Unexecuted instantiation: void QWindowSystemInterface::handleWindowDevicePixelRatioChanged<QWindowSystemInterface::AsynchronousDelivery>(QWindow*)
267
268
269
QT_DEFINE_QPA_EVENT_HANDLER(void, handleSafeAreaMarginsChanged, QWindow *window)
270
0
{
271
0
    handleWindowSystemEvent<QWindowSystemInterfacePrivate::SafeAreaMarginsChangedEvent, Delivery>(window);
272
0
}
Unexecuted instantiation: void QWindowSystemInterface::handleSafeAreaMarginsChanged<QWindowSystemInterface::DefaultDelivery>(QWindow*)
Unexecuted instantiation: void QWindowSystemInterface::handleSafeAreaMarginsChanged<QWindowSystemInterface::SynchronousDelivery>(QWindow*)
Unexecuted instantiation: void QWindowSystemInterface::handleSafeAreaMarginsChanged<QWindowSystemInterface::AsynchronousDelivery>(QWindow*)
273
274
QT_DEFINE_QPA_EVENT_HANDLER(void, handleApplicationStateChanged, Qt::ApplicationState newState, bool forcePropagate)
275
0
{
276
0
    Q_ASSERT(QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::ApplicationState));
277
0
    handleWindowSystemEvent<QWindowSystemInterfacePrivate::ApplicationStateChangedEvent, Delivery>(newState, forcePropagate);
278
0
}
Unexecuted instantiation: void QWindowSystemInterface::handleApplicationStateChanged<QWindowSystemInterface::DefaultDelivery>(Qt::ApplicationState, bool)
Unexecuted instantiation: void QWindowSystemInterface::handleApplicationStateChanged<QWindowSystemInterface::SynchronousDelivery>(Qt::ApplicationState, bool)
Unexecuted instantiation: void QWindowSystemInterface::handleApplicationStateChanged<QWindowSystemInterface::AsynchronousDelivery>(Qt::ApplicationState, bool)
279
280
QT_DEFINE_QPA_EVENT_HANDLER(bool, handleApplicationTermination)
281
0
{
282
0
    return handleWindowSystemEvent<QWindowSystemInterfacePrivate::WindowSystemEvent, Delivery>(
283
0
        QWindowSystemInterfacePrivate::ApplicationTermination);
284
0
}
Unexecuted instantiation: bool QWindowSystemInterface::handleApplicationTermination<QWindowSystemInterface::DefaultDelivery>()
Unexecuted instantiation: bool QWindowSystemInterface::handleApplicationTermination<QWindowSystemInterface::SynchronousDelivery>()
Unexecuted instantiation: bool QWindowSystemInterface::handleApplicationTermination<QWindowSystemInterface::AsynchronousDelivery>()
285
286
QWindowSystemInterfacePrivate::GeometryChangeEvent::GeometryChangeEvent(QWindow *window,
287
                                                                        QRect requestedGeometry,
288
                                                                        QRect newGeometry)
289
0
    : WindowSystemEvent(GeometryChange)
290
0
    , window(window)
291
0
    , requestedGeometry(requestedGeometry)
292
0
    , newGeometry(newGeometry)
293
0
{
294
0
}
295
296
QT_DEFINE_QPA_EVENT_HANDLER(void, handleGeometryChange, QWindow *window, const QRect &newRect)
297
0
{
298
0
    Q_ASSERT(window);
299
0
    const auto newRectDi = QHighDpi::fromNativeWindowGeometry(newRect, window);
300
0
    QRect requestedGeometry;
301
0
    if (auto *handle = window->handle()) {
302
0
        requestedGeometry = QHighDpi::fromNativeWindowGeometry(handle->QPlatformWindow::geometry(),
303
0
                                                               window);
304
        // Persist the new geometry so that QWindow::geometry() can be queried in the resize event
305
0
        handle->QPlatformWindow::setGeometry(newRect);
306
        // FIXME: This does not work during platform window creation, where the QWindow does not
307
        // have its handle set up yet. Platforms that deliver events during window creation need
308
        // to handle the persistence manually, e.g. by overriding geometry().
309
0
    }
310
0
    handleWindowSystemEvent<QWindowSystemInterfacePrivate::GeometryChangeEvent, Delivery>(window,
311
0
                                                                                          requestedGeometry,
312
0
                                                                                          newRectDi);
313
0
}
Unexecuted instantiation: void QWindowSystemInterface::handleGeometryChange<QWindowSystemInterface::DefaultDelivery>(QWindow*, QRect const&)
Unexecuted instantiation: void QWindowSystemInterface::handleGeometryChange<QWindowSystemInterface::SynchronousDelivery>(QWindow*, QRect const&)
Unexecuted instantiation: void QWindowSystemInterface::handleGeometryChange<QWindowSystemInterface::AsynchronousDelivery>(QWindow*, QRect const&)
314
315
QWindowSystemInterfacePrivate::ExposeEvent::ExposeEvent(QWindow *window, const QRegion &region)
316
0
    : WindowSystemEvent(Expose)
317
0
    , window(window)
318
0
    , isExposed(window && window->handle() ? window->handle()->isExposed() : false)
319
0
    , region(region)
320
0
{
321
0
}
322
323
/*! \internal
324
    Handles an expose event.
325
326
    The platform plugin sends expose events when an area of the window
327
    is invalidated or window exposure changes. \a region is in window
328
    local coordinates. An empty region indicates that the window is
329
    obscured, but note that the exposed property of the QWindow will be set
330
    based on what QPlatformWindow::isExposed() returns at the time of this call,
331
    not based on what the region is. // FIXME: this should probably be fixed.
332
333
    The platform plugin may omit sending expose events (or send obscure
334
    events) for windows that are on screen but where the client area is
335
    completely covered by other windows or otherwise not visible. Expose
336
    event consumers can then use this to disable updates for such windows.
337
    This is required behavior on platforms where OpenGL swapbuffers stops
338
    blocking for obscured windows (like macOS).
339
*/
340
QT_DEFINE_QPA_EVENT_HANDLER(bool, handleExposeEvent, QWindow *window, const QRegion &region)
341
0
{
342
0
    return handleWindowSystemEvent<QWindowSystemInterfacePrivate::ExposeEvent, Delivery>(window,
343
0
        QHighDpi::fromNativeLocalExposedRegion(region, window));
344
0
}
Unexecuted instantiation: bool QWindowSystemInterface::handleExposeEvent<QWindowSystemInterface::DefaultDelivery>(QWindow*, QRegion const&)
Unexecuted instantiation: bool QWindowSystemInterface::handleExposeEvent<QWindowSystemInterface::SynchronousDelivery>(QWindow*, QRegion const&)
Unexecuted instantiation: bool QWindowSystemInterface::handleExposeEvent<QWindowSystemInterface::AsynchronousDelivery>(QWindow*, QRegion const&)
345
346
QT_DEFINE_QPA_EVENT_HANDLER(bool, handlePaintEvent, QWindow *window, const QRegion &region)
347
0
{
348
0
    return handleWindowSystemEvent<QWindowSystemInterfacePrivate::PaintEvent, Delivery>(window,
349
0
        QHighDpi::fromNativeLocalExposedRegion(region, window));
350
0
}
Unexecuted instantiation: bool QWindowSystemInterface::handlePaintEvent<QWindowSystemInterface::DefaultDelivery>(QWindow*, QRegion const&)
Unexecuted instantiation: bool QWindowSystemInterface::handlePaintEvent<QWindowSystemInterface::SynchronousDelivery>(QWindow*, QRegion const&)
Unexecuted instantiation: bool QWindowSystemInterface::handlePaintEvent<QWindowSystemInterface::AsynchronousDelivery>(QWindow*, QRegion const&)
351
352
353
QT_DEFINE_QPA_EVENT_HANDLER(bool, handleCloseEvent, QWindow *window)
354
0
{
355
0
    Q_ASSERT(window);
356
0
    return handleWindowSystemEvent<QWindowSystemInterfacePrivate::CloseEvent, Delivery>(window);
357
0
}
Unexecuted instantiation: bool QWindowSystemInterface::handleCloseEvent<QWindowSystemInterface::DefaultDelivery>(QWindow*)
Unexecuted instantiation: bool QWindowSystemInterface::handleCloseEvent<QWindowSystemInterface::SynchronousDelivery>(QWindow*)
Unexecuted instantiation: bool QWindowSystemInterface::handleCloseEvent<QWindowSystemInterface::AsynchronousDelivery>(QWindow*)
358
359
/*!
360
361
\a w == 0 means that the event is in global coords only, \a local will be ignored in this case
362
363
*/
364
365
QT_DEFINE_QPA_EVENT_HANDLER(bool, handleMouseEvent, QWindow *window,
366
                            const QPointF &local, const QPointF &global, Qt::MouseButtons state,
367
                            Qt::MouseButton button, QEvent::Type type, Qt::KeyboardModifiers mods,
368
                            Qt::MouseEventSource source)
369
0
{
370
0
    unsigned long time = QWindowSystemInterfacePrivate::eventTime.elapsed();
371
0
    return handleMouseEvent<Delivery>(window, time, local, global, state, button, type, mods, source);
372
0
}
Unexecuted instantiation: bool QWindowSystemInterface::handleMouseEvent<QWindowSystemInterface::DefaultDelivery>(QWindow*, QPointF const&, QPointF const&, QFlags<Qt::MouseButton>, Qt::MouseButton, QEvent::Type, QFlags<Qt::KeyboardModifier>, Qt::MouseEventSource)
Unexecuted instantiation: bool QWindowSystemInterface::handleMouseEvent<QWindowSystemInterface::SynchronousDelivery>(QWindow*, QPointF const&, QPointF const&, QFlags<Qt::MouseButton>, Qt::MouseButton, QEvent::Type, QFlags<Qt::KeyboardModifier>, Qt::MouseEventSource)
Unexecuted instantiation: bool QWindowSystemInterface::handleMouseEvent<QWindowSystemInterface::AsynchronousDelivery>(QWindow*, QPointF const&, QPointF const&, QFlags<Qt::MouseButton>, Qt::MouseButton, QEvent::Type, QFlags<Qt::KeyboardModifier>, Qt::MouseEventSource)
373
374
QT_DEFINE_QPA_EVENT_HANDLER(bool, handleMouseEvent, QWindow *window, const QPointingDevice *device,
375
                            const QPointF &local, const QPointF &global, Qt::MouseButtons state,
376
                            Qt::MouseButton button, QEvent::Type type, Qt::KeyboardModifiers mods,
377
                            Qt::MouseEventSource source)
378
0
{
379
0
    unsigned long time = QWindowSystemInterfacePrivate::eventTime.elapsed();
380
0
    return handleMouseEvent<Delivery>(window, time, device, local, global, state, button, type, mods, source);
381
0
}
Unexecuted instantiation: bool QWindowSystemInterface::handleMouseEvent<QWindowSystemInterface::DefaultDelivery>(QWindow*, QPointingDevice const*, QPointF const&, QPointF const&, QFlags<Qt::MouseButton>, Qt::MouseButton, QEvent::Type, QFlags<Qt::KeyboardModifier>, Qt::MouseEventSource)
Unexecuted instantiation: bool QWindowSystemInterface::handleMouseEvent<QWindowSystemInterface::SynchronousDelivery>(QWindow*, QPointingDevice const*, QPointF const&, QPointF const&, QFlags<Qt::MouseButton>, Qt::MouseButton, QEvent::Type, QFlags<Qt::KeyboardModifier>, Qt::MouseEventSource)
Unexecuted instantiation: bool QWindowSystemInterface::handleMouseEvent<QWindowSystemInterface::AsynchronousDelivery>(QWindow*, QPointingDevice const*, QPointF const&, QPointF const&, QFlags<Qt::MouseButton>, Qt::MouseButton, QEvent::Type, QFlags<Qt::KeyboardModifier>, Qt::MouseEventSource)
382
383
QT_DEFINE_QPA_EVENT_HANDLER(bool, handleMouseEvent, QWindow *window, ulong timestamp,
384
                            const QPointF &local, const QPointF &global, Qt::MouseButtons state,
385
                            Qt::MouseButton button, QEvent::Type type, Qt::KeyboardModifiers mods,
386
                            Qt::MouseEventSource source)
387
0
{
388
0
    return handleMouseEvent<Delivery>(window, timestamp, QPointingDevice::primaryPointingDevice(),
389
0
                                      local, global, state, button, type, mods, source);
390
0
}
Unexecuted instantiation: bool QWindowSystemInterface::handleMouseEvent<QWindowSystemInterface::DefaultDelivery>(QWindow*, unsigned long, QPointF const&, QPointF const&, QFlags<Qt::MouseButton>, Qt::MouseButton, QEvent::Type, QFlags<Qt::KeyboardModifier>, Qt::MouseEventSource)
Unexecuted instantiation: bool QWindowSystemInterface::handleMouseEvent<QWindowSystemInterface::SynchronousDelivery>(QWindow*, unsigned long, QPointF const&, QPointF const&, QFlags<Qt::MouseButton>, Qt::MouseButton, QEvent::Type, QFlags<Qt::KeyboardModifier>, Qt::MouseEventSource)
Unexecuted instantiation: bool QWindowSystemInterface::handleMouseEvent<QWindowSystemInterface::AsynchronousDelivery>(QWindow*, unsigned long, QPointF const&, QPointF const&, QFlags<Qt::MouseButton>, Qt::MouseButton, QEvent::Type, QFlags<Qt::KeyboardModifier>, Qt::MouseEventSource)
391
392
QT_DEFINE_QPA_EVENT_HANDLER(bool, handleMouseEvent, QWindow *window, ulong timestamp, const QPointingDevice *device,
393
                            const QPointF &local, const QPointF &global, Qt::MouseButtons state,
394
                            Qt::MouseButton button, QEvent::Type type, Qt::KeyboardModifiers mods,
395
                            Qt::MouseEventSource source)
396
0
{
397
398
0
    bool isNonClientArea = {};
399
400
0
    switch (type) {
401
0
    case QEvent::MouseButtonDblClick:
402
0
    case QEvent::NonClientAreaMouseButtonDblClick:
403
0
        Q_ASSERT_X(false, "QWindowSystemInterface::handleMouseEvent",
404
0
               "QTBUG-71263: Native double clicks are not implemented.");
405
0
        return false;
406
0
    case QEvent::MouseMove:
407
0
    case QEvent::MouseButtonPress:
408
0
    case QEvent::MouseButtonRelease:
409
0
        isNonClientArea = false;
410
0
        break;
411
0
    case QEvent::NonClientAreaMouseMove:
412
0
    case QEvent::NonClientAreaMouseButtonPress:
413
0
    case QEvent::NonClientAreaMouseButtonRelease:
414
0
        isNonClientArea = true;
415
0
        break;
416
0
    default:
417
0
        Q_UNREACHABLE();
418
0
    }
419
420
0
    auto localPos = QHighDpi::fromNativeLocalPosition(local, window);
421
0
    auto globalPos = QHighDpi::fromNativeGlobalPosition(global, window);
422
423
0
    return handleWindowSystemEvent<QWindowSystemInterfacePrivate::MouseEvent, Delivery>(window,
424
0
        timestamp, localPos, globalPos, state, mods, button, type, source, isNonClientArea, device);
425
0
}
Unexecuted instantiation: bool QWindowSystemInterface::handleMouseEvent<QWindowSystemInterface::DefaultDelivery>(QWindow*, unsigned long, QPointingDevice const*, QPointF const&, QPointF const&, QFlags<Qt::MouseButton>, Qt::MouseButton, QEvent::Type, QFlags<Qt::KeyboardModifier>, Qt::MouseEventSource)
Unexecuted instantiation: bool QWindowSystemInterface::handleMouseEvent<QWindowSystemInterface::SynchronousDelivery>(QWindow*, unsigned long, QPointingDevice const*, QPointF const&, QPointF const&, QFlags<Qt::MouseButton>, Qt::MouseButton, QEvent::Type, QFlags<Qt::KeyboardModifier>, Qt::MouseEventSource)
Unexecuted instantiation: bool QWindowSystemInterface::handleMouseEvent<QWindowSystemInterface::AsynchronousDelivery>(QWindow*, unsigned long, QPointingDevice const*, QPointF const&, QPointF const&, QFlags<Qt::MouseButton>, Qt::MouseButton, QEvent::Type, QFlags<Qt::KeyboardModifier>, Qt::MouseEventSource)
426
427
bool QWindowSystemInterface::handleShortcutEvent(QWindow *window, ulong timestamp, int keyCode, Qt::KeyboardModifiers modifiers, quint32 nativeScanCode,
428
                                      quint32 nativeVirtualKey, quint32 nativeModifiers, const QString &text, bool autorepeat, ushort count)
429
0
{
430
0
#if QT_CONFIG(shortcut)
431
0
    if (!window)
432
0
        window = QGuiApplication::focusWindow();
433
434
0
    QShortcutMap &shortcutMap = QGuiApplicationPrivate::instance()->shortcutMap;
435
0
    if (shortcutMap.state() == QKeySequence::NoMatch) {
436
        // Check if the shortcut is overridden by some object in the event delivery path (typically the focus object).
437
        // If so, we should not look up the shortcut in the shortcut map, but instead deliver the event as a regular
438
        // key event, so that the target that accepted the shortcut override event can handle it. Note that we only
439
        // do this if the shortcut map hasn't found a partial shortcut match yet. If it has, the shortcut can not be
440
        // overridden.
441
0
        bool overridden = handleWindowSystemEvent<QWindowSystemInterfacePrivate::KeyEvent, SynchronousDelivery>
442
0
            (window,timestamp, QEvent::ShortcutOverride, keyCode, modifiers, nativeScanCode,
443
0
             nativeVirtualKey, nativeModifiers, text, autorepeat, count);
444
0
        if (overridden)
445
0
            return false;
446
0
    }
447
448
    // The shortcut event is dispatched as a QShortcutEvent, not a QKeyEvent, but we use
449
    // the QKeyEvent as a container for the various properties that the shortcut map needs
450
    // to inspect to determine if a shortcut matched the keys that were pressed.
451
0
    QKeyEvent keyEvent(QEvent::ShortcutOverride, keyCode, modifiers, nativeScanCode,
452
0
        nativeVirtualKey, nativeModifiers, text, autorepeat, count);
453
454
0
    return shortcutMap.tryShortcut(&keyEvent);
455
#else
456
    Q_UNUSED(window);
457
    Q_UNUSED(timestamp);
458
    Q_UNUSED(keyCode);
459
    Q_UNUSED(modifiers);
460
    Q_UNUSED(nativeScanCode);
461
    Q_UNUSED(nativeVirtualKey);
462
    Q_UNUSED(nativeModifiers);
463
    Q_UNUSED(text);
464
    Q_UNUSED(autorepeat);
465
    Q_UNUSED(count);
466
    return false;
467
#endif
468
0
}
469
470
0
QT_DEFINE_QPA_EVENT_HANDLER(bool, handleKeyEvent, QWindow *window, QEvent::Type t, int k, Qt::KeyboardModifiers mods, const QString & text, bool autorep, ushort count) {
471
0
    unsigned long time = QWindowSystemInterfacePrivate::eventTime.elapsed();
472
0
    return handleKeyEvent<Delivery>(window, time, t, k, mods, text, autorep, count);
473
0
}
Unexecuted instantiation: bool QWindowSystemInterface::handleKeyEvent<QWindowSystemInterface::DefaultDelivery>(QWindow*, QEvent::Type, int, QFlags<Qt::KeyboardModifier>, QString const&, bool, unsigned short)
Unexecuted instantiation: bool QWindowSystemInterface::handleKeyEvent<QWindowSystemInterface::SynchronousDelivery>(QWindow*, QEvent::Type, int, QFlags<Qt::KeyboardModifier>, QString const&, bool, unsigned short)
Unexecuted instantiation: bool QWindowSystemInterface::handleKeyEvent<QWindowSystemInterface::AsynchronousDelivery>(QWindow*, QEvent::Type, int, QFlags<Qt::KeyboardModifier>, QString const&, bool, unsigned short)
474
475
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)
476
0
{
477
0
    return handleWindowSystemEvent<QWindowSystemInterfacePrivate::KeyEvent, Delivery>(window,
478
0
        timestamp, t, k, mods, text, autorep, count);
479
0
}
Unexecuted instantiation: bool QWindowSystemInterface::handleKeyEvent<QWindowSystemInterface::DefaultDelivery>(QWindow*, unsigned long, QEvent::Type, int, QFlags<Qt::KeyboardModifier>, QString const&, bool, unsigned short)
Unexecuted instantiation: bool QWindowSystemInterface::handleKeyEvent<QWindowSystemInterface::SynchronousDelivery>(QWindow*, unsigned long, QEvent::Type, int, QFlags<Qt::KeyboardModifier>, QString const&, bool, unsigned short)
Unexecuted instantiation: bool QWindowSystemInterface::handleKeyEvent<QWindowSystemInterface::AsynchronousDelivery>(QWindow*, unsigned long, QEvent::Type, int, QFlags<Qt::KeyboardModifier>, QString const&, bool, unsigned short)
480
481
bool QWindowSystemInterface::handleExtendedKeyEvent(QWindow *window, QEvent::Type type, int key, Qt::KeyboardModifiers modifiers,
482
                                                    quint32 nativeScanCode, quint32 nativeVirtualKey,
483
                                                    quint32 nativeModifiers,
484
                                                    const QString& text, bool autorep,
485
                                                    ushort count)
486
0
{
487
0
    unsigned long time = QWindowSystemInterfacePrivate::eventTime.elapsed();
488
0
    return handleExtendedKeyEvent(window, time, type, key, modifiers, nativeScanCode, nativeVirtualKey, nativeModifiers,
489
0
                           text, autorep, count);
490
0
}
491
492
bool QWindowSystemInterface::handleExtendedKeyEvent(QWindow *window, ulong timestamp, QEvent::Type type, int key,
493
                                                    Qt::KeyboardModifiers modifiers,
494
                                                    quint32 nativeScanCode, quint32 nativeVirtualKey,
495
                                                    quint32 nativeModifiers,
496
                                                    const QString& text, bool autorep,
497
                                                    ushort count)
498
0
{
499
0
    return handleWindowSystemEvent<QWindowSystemInterfacePrivate::KeyEvent>(window,
500
0
        timestamp, type, key, modifiers, nativeScanCode, nativeVirtualKey, nativeModifiers, text, autorep, count);
501
0
}
502
503
bool QWindowSystemInterface::handleWheelEvent(QWindow *window, const QPointF &local, const QPointF &global, QPoint pixelDelta, QPoint angleDelta, Qt::KeyboardModifiers mods, Qt::ScrollPhase phase, Qt::MouseEventSource source)
504
0
{
505
0
    unsigned long time = QWindowSystemInterfacePrivate::eventTime.elapsed();
506
0
    return handleWheelEvent(window, time, local, global, pixelDelta, angleDelta, mods, phase, source);
507
0
}
508
509
bool QWindowSystemInterface::handleWheelEvent(QWindow *window, ulong timestamp, const QPointF &local, const QPointF &global, QPoint pixelDelta, QPoint angleDelta, Qt::KeyboardModifiers mods, Qt::ScrollPhase phase,
510
                                              Qt::MouseEventSource source, bool invertedScrolling)
511
0
{
512
0
    return handleWheelEvent(window, timestamp, QPointingDevice::primaryPointingDevice(), local, global,
513
0
                            pixelDelta, angleDelta, mods, phase, source, invertedScrolling);
514
0
}
515
516
bool QWindowSystemInterface::handleWheelEvent(QWindow *window, ulong timestamp, const QPointingDevice *device,
517
                                              const QPointF &local, const QPointF &global, QPoint pixelDelta, QPoint angleDelta,
518
                                              Qt::KeyboardModifiers mods, Qt::ScrollPhase phase,
519
                                              Qt::MouseEventSource source, bool invertedScrolling)
520
0
{
521
    // Qt 4 sends two separate wheel events for horizontal and vertical
522
    // deltas. For Qt 5 we want to send the deltas in one event, but at the
523
    // same time preserve source and behavior compatibility with Qt 4.
524
    //
525
    // In addition high-resolution pixel-based deltas are also supported.
526
    // Platforms that does not support these may pass a null point here.
527
    // Angle deltas must always be sent in addition to pixel deltas.
528
529
    // Pass Qt::ScrollBegin and Qt::ScrollEnd through
530
    // even if the wheel delta is null.
531
0
    if (angleDelta.isNull() && phase == Qt::ScrollUpdate)
532
0
        return false;
533
534
    // Simple case: vertical deltas only:
535
0
    if (angleDelta.y() != 0 && angleDelta.x() == 0) {
536
0
        return handleWindowSystemEvent<QWindowSystemInterfacePrivate::WheelEvent>(window,
537
0
            timestamp, QHighDpi::fromNativeLocalPosition(local, window), QHighDpi::fromNativeGlobalPosition(global, window),
538
0
            pixelDelta, angleDelta, angleDelta.y(), Qt::Vertical, mods, phase, source, invertedScrolling, device);
539
0
    }
540
541
    // Simple case: horizontal deltas only:
542
0
    if (angleDelta.y() == 0 && angleDelta.x() != 0) {
543
0
        return handleWindowSystemEvent<QWindowSystemInterfacePrivate::WheelEvent>(window,
544
0
            timestamp, QHighDpi::fromNativeLocalPosition(local, window), QHighDpi::fromNativeGlobalPosition(global, window),
545
0
            pixelDelta, angleDelta, angleDelta.x(), Qt::Horizontal, mods, phase, source, invertedScrolling, device);
546
0
    }
547
548
0
    bool acceptVert;
549
0
    bool acceptHorz;
550
    // Both horizontal and vertical deltas: Send two wheel events.
551
    // The first event contains the Qt 5 pixel and angle delta as points,
552
    // and in addition the Qt 4 compatibility vertical angle delta.
553
0
    acceptVert = handleWindowSystemEvent<QWindowSystemInterfacePrivate::WheelEvent>(window,
554
0
        timestamp, QHighDpi::fromNativeLocalPosition(local, window), QHighDpi::fromNativeGlobalPosition(global, window),
555
0
        pixelDelta, angleDelta, angleDelta.y(), Qt::Vertical, mods, phase, source, invertedScrolling, device);
556
557
    // The second event contains null pixel and angle points and the
558
    // Qt 4 compatibility horizontal angle delta.
559
0
    acceptHorz = handleWindowSystemEvent<QWindowSystemInterfacePrivate::WheelEvent>(window,
560
0
        timestamp, QHighDpi::fromNativeLocalPosition(local, window), QHighDpi::fromNativeGlobalPosition(global, window),
561
0
        QPoint(), QPoint(), angleDelta.x(), Qt::Horizontal, mods, phase, source, invertedScrolling, device);
562
563
0
    return acceptVert || acceptHorz;
564
0
}
565
566
/*!
567
    \internal
568
    Register a new input \a device.
569
570
    It is expected that every platform plugin will discover available input
571
    devices at startup, and whenever a new device is plugged in, if possible.
572
    If that's not possible, then it at least must call this function before
573
    sending an event whose QInputEvent::source() is this device.
574
575
    When a device is unplugged, the platform plugin should destroy the
576
    corresponding QInputDevice instance. There is no unregisterInputDevice()
577
    function, because it's enough for the destructor to call
578
    QInputDevicePrivate::unregisterDevice(); while other parts of Qt can
579
    connect to the QObject::destroyed() signal to be notified when a device is
580
    unplugged or otherwise destroyed.
581
*/
582
void QWindowSystemInterface::registerInputDevice(const QInputDevice *device)
583
0
{
584
0
    QInputDevicePrivate::registerDevice(device);
585
0
}
586
587
/*!
588
    \internal
589
    Convert a list of \l QWindowSystemInterface::TouchPoint \a points to a list
590
    of \e temporary QEventPoint instances, scaled (but not localized)
591
    for delivery to the given \a window.
592
593
    This is called from QWindowSystemInterface::handleTouchEvent():
594
    that is too early to update the QEventPoint instances in QPointingDevice,
595
    because we want those to hold "current" state from the applcation's
596
    point of view.  The QWindowSystemInterfacePrivate::TouchEvent, to which
597
    the returned touchpoints will "belong", might go through the queue before
598
    being processed; the application doesn't see the equivalent QTouchEvent
599
    until later on.  Therefore the responsibility to update the QEventPoint
600
    instances in QPointingDevice is in QGuiApplication, not here.
601
602
    QGuiApplicationPrivate::processMouseEvent() also calls this function
603
    when it synthesizes a touch event from a mouse event.  But that's outside
604
    the normal use case.
605
606
    It might be better if we change all the platform plugins to create
607
    temporary instances of QEventPoint directly, and remove
608
    QWindowSystemInterface::TouchPoint completely. Then we will no longer need
609
    this function either. But that's only possible as long as QEventPoint
610
    remains a Q_GADGET, not a QObject, so that it continues to be small and
611
    suitable for temporary stack allocation.  QEventPoint is a little bigger
612
    than QWindowSystemInterface::TouchPoint, though.
613
*/
614
QList<QEventPoint>
615
    QWindowSystemInterfacePrivate::fromNativeTouchPoints(const QList<QWindowSystemInterface::TouchPoint> &points,
616
                                                         const QWindow *window, QEvent::Type *type)
617
0
{
618
0
    QList<QEventPoint> touchPoints;
619
0
    QEventPoint::States states;
620
621
0
    touchPoints.reserve(points.size());
622
0
    QList<QWindowSystemInterface::TouchPoint>::const_iterator point = points.constBegin();
623
0
    QList<QWindowSystemInterface::TouchPoint>::const_iterator end = points.constEnd();
624
0
    while (point != end) {
625
0
        QPointF globalPos = QHighDpi::fromNativePixels(point->area.center(), window);
626
0
        QEventPoint p(point->id, point->state, globalPos, globalPos);
627
0
        states |= point->state;
628
0
        if (point->uniqueId >= 0)
629
0
            QMutableEventPoint::setUniqueId(p, QPointingDeviceUniqueId::fromNumericId(point->uniqueId));
630
0
        QMutableEventPoint::setPressure(p, point->pressure);
631
0
        QMutableEventPoint::setRotation(p, point->rotation);
632
0
        QMutableEventPoint::setEllipseDiameters(p, QHighDpi::fromNativePixels(point->area.size(), window));
633
0
        QMutableEventPoint::setVelocity(p, QHighDpi::fromNativePixels(point->velocity, window));
634
635
        // The local pos is not set: it will be calculated
636
        // when the event gets processed by QGuiApplication.
637
638
0
        touchPoints.append(p);
639
0
        ++point;
640
0
    }
641
642
    // Determine the event type based on the combined point states.
643
0
    if (type) {
644
0
        *type = QEvent::TouchUpdate;
645
0
        if (states == QEventPoint::State::Pressed)
646
0
            *type = QEvent::TouchBegin;
647
0
        else if (states == QEventPoint::State::Released)
648
0
            *type = QEvent::TouchEnd;
649
0
    }
650
651
0
    return touchPoints;
652
0
}
653
654
QWindowSystemInterface::TouchPoint
655
QWindowSystemInterfacePrivate::toNativeTouchPoint(const QEventPoint &pt, const QWindow *window)
656
0
{
657
0
    QWindowSystemInterface::TouchPoint p;
658
0
    p.id = pt.id();
659
0
    QRectF area(QPointF(), pt.ellipseDiameters());
660
0
    area.moveCenter(pt.globalPosition());
661
    // TODO store ellipseDiameters in QWindowSystemInterface::TouchPoint or just use QEventPoint
662
0
    p.area = QHighDpi::toNativePixels(area, window);
663
0
    p.pressure = pt.pressure();
664
0
    p.state = pt.state();
665
0
    p.velocity = QHighDpi::toNativePixels(pt.velocity(), window);
666
0
    return p;
667
0
}
668
669
QT_DEFINE_QPA_EVENT_HANDLER(bool, handleTouchEvent, QWindow *window, const QPointingDevice *device,
670
                                              const QList<TouchPoint> &points, Qt::KeyboardModifiers mods)
671
0
{
672
0
    unsigned long time = QWindowSystemInterfacePrivate::eventTime.elapsed();
673
0
    return handleTouchEvent<Delivery>(window, time, device, points, mods);
674
0
}
Unexecuted instantiation: bool QWindowSystemInterface::handleTouchEvent<QWindowSystemInterface::DefaultDelivery>(QWindow*, QPointingDevice const*, QList<QWindowSystemInterface::TouchPoint> const&, QFlags<Qt::KeyboardModifier>)
Unexecuted instantiation: bool QWindowSystemInterface::handleTouchEvent<QWindowSystemInterface::SynchronousDelivery>(QWindow*, QPointingDevice const*, QList<QWindowSystemInterface::TouchPoint> const&, QFlags<Qt::KeyboardModifier>)
Unexecuted instantiation: bool QWindowSystemInterface::handleTouchEvent<QWindowSystemInterface::AsynchronousDelivery>(QWindow*, QPointingDevice const*, QList<QWindowSystemInterface::TouchPoint> const&, QFlags<Qt::KeyboardModifier>)
675
676
QT_DEFINE_QPA_EVENT_HANDLER(bool, handleTouchEvent, QWindow *window, ulong timestamp, const QPointingDevice *device,
677
                                              const QList<TouchPoint> &points, Qt::KeyboardModifiers mods)
678
0
{
679
0
    if (!points.size()) // Touch events must have at least one point
680
0
        return false;
681
682
0
    if (!QPointingDevicePrivate::isRegistered(device)) // Disallow passing bogus, non-registered devices.
683
0
        return false;
684
685
0
    QEvent::Type type;
686
0
    QList<QEventPoint> touchPoints =
687
0
            QWindowSystemInterfacePrivate::fromNativeTouchPoints(points, window, &type);
688
689
0
    return handleWindowSystemEvent<QWindowSystemInterfacePrivate::TouchEvent, Delivery>(window,
690
0
        timestamp, type, device, touchPoints, mods);
691
0
}
Unexecuted instantiation: bool QWindowSystemInterface::handleTouchEvent<QWindowSystemInterface::DefaultDelivery>(QWindow*, unsigned long, QPointingDevice const*, QList<QWindowSystemInterface::TouchPoint> const&, QFlags<Qt::KeyboardModifier>)
Unexecuted instantiation: bool QWindowSystemInterface::handleTouchEvent<QWindowSystemInterface::SynchronousDelivery>(QWindow*, unsigned long, QPointingDevice const*, QList<QWindowSystemInterface::TouchPoint> const&, QFlags<Qt::KeyboardModifier>)
Unexecuted instantiation: bool QWindowSystemInterface::handleTouchEvent<QWindowSystemInterface::AsynchronousDelivery>(QWindow*, unsigned long, QPointingDevice const*, QList<QWindowSystemInterface::TouchPoint> const&, QFlags<Qt::KeyboardModifier>)
692
693
QT_DEFINE_QPA_EVENT_HANDLER(bool, handleTouchCancelEvent, QWindow *window, const QPointingDevice *device,
694
                                                    Qt::KeyboardModifiers mods)
695
0
{
696
0
    unsigned long time = QWindowSystemInterfacePrivate::eventTime.elapsed();
697
0
    return handleTouchCancelEvent<Delivery>(window, time, device, mods);
698
0
}
Unexecuted instantiation: bool QWindowSystemInterface::handleTouchCancelEvent<QWindowSystemInterface::DefaultDelivery>(QWindow*, QPointingDevice const*, QFlags<Qt::KeyboardModifier>)
Unexecuted instantiation: bool QWindowSystemInterface::handleTouchCancelEvent<QWindowSystemInterface::SynchronousDelivery>(QWindow*, QPointingDevice const*, QFlags<Qt::KeyboardModifier>)
Unexecuted instantiation: bool QWindowSystemInterface::handleTouchCancelEvent<QWindowSystemInterface::AsynchronousDelivery>(QWindow*, QPointingDevice const*, QFlags<Qt::KeyboardModifier>)
699
700
QT_DEFINE_QPA_EVENT_HANDLER(bool, handleTouchCancelEvent, QWindow *window, ulong timestamp, const QPointingDevice *device,
701
                                                    Qt::KeyboardModifiers mods)
702
0
{
703
0
    return handleWindowSystemEvent<QWindowSystemInterfacePrivate::TouchEvent, Delivery>(window,
704
0
        timestamp, QEvent::TouchCancel, device, QList<QEventPoint>(), mods);
705
0
}
Unexecuted instantiation: bool QWindowSystemInterface::handleTouchCancelEvent<QWindowSystemInterface::DefaultDelivery>(QWindow*, unsigned long, QPointingDevice const*, QFlags<Qt::KeyboardModifier>)
Unexecuted instantiation: bool QWindowSystemInterface::handleTouchCancelEvent<QWindowSystemInterface::SynchronousDelivery>(QWindow*, unsigned long, QPointingDevice const*, QFlags<Qt::KeyboardModifier>)
Unexecuted instantiation: bool QWindowSystemInterface::handleTouchCancelEvent<QWindowSystemInterface::AsynchronousDelivery>(QWindow*, unsigned long, QPointingDevice const*, QFlags<Qt::KeyboardModifier>)
706
707
/*!
708
    Should be called by the implementation whenever a new screen is added.
709
710
    The first screen added will be the primary screen, used for default-created
711
    windows, GL contexts, and other resources unless otherwise specified.
712
713
    This adds the screen to QGuiApplication::screens(), and emits the
714
    QGuiApplication::screenAdded() signal.
715
716
    The screen should be deleted by calling QWindowSystemInterface::handleScreenRemoved().
717
*/
718
void QWindowSystemInterface::handleScreenAdded(QPlatformScreen *platformScreen, bool isPrimary)
719
0
{
720
0
    QScreen *screen = new QScreen(platformScreen);
721
722
0
    if (isPrimary)
723
0
        QGuiApplicationPrivate::screen_list.prepend(screen);
724
0
    else
725
0
        QGuiApplicationPrivate::screen_list.append(screen);
726
727
0
    QGuiApplicationPrivate::resetCachedDevicePixelRatio();
728
0
    QHighDpiScaling::updateHighDpiScaling();
729
0
    screen->d_func()->updateGeometry();
730
731
0
    emit qGuiApp->screenAdded(screen);
732
733
0
    if (isPrimary)
734
0
        emit qGuiApp->primaryScreenChanged(screen);
735
0
}
736
737
/*!
738
    Should be called by the implementation whenever a screen is removed.
739
740
    This removes the screen from QGuiApplication::screens(), and deletes it.
741
742
    Failing to call this and manually deleting the QPlatformScreen instead may
743
    lead to a crash due to a pure virtual call.
744
*/
745
void QWindowSystemInterface::handleScreenRemoved(QPlatformScreen *platformScreen)
746
0
{
747
0
    QScreen *screen = platformScreen->screen();
748
749
    // Remove screen
750
0
    const bool wasPrimary = QGuiApplication::primaryScreen() == screen;
751
0
    QGuiApplicationPrivate::screen_list.removeOne(screen);
752
0
    QGuiApplicationPrivate::resetCachedDevicePixelRatio();
753
754
0
    if (qGuiApp) {
755
0
        QScreen *newPrimaryScreen = QGuiApplication::primaryScreen();
756
0
        if (wasPrimary && newPrimaryScreen)
757
0
            emit qGuiApp->primaryScreenChanged(newPrimaryScreen);
758
759
        // Allow clients to manage windows that are affected by the screen going
760
        // away, before we fall back to moving them to the primary screen.
761
0
        emit qApp->screenRemoved(screen);
762
763
0
        if (!QGuiApplication::closingDown()) {
764
0
            bool movingFromVirtualSibling = newPrimaryScreen
765
0
                && newPrimaryScreen->handle()->virtualSiblings().contains(platformScreen);
766
767
            // Move any leftover windows to the primary screen
768
0
            const auto allWindows = QGuiApplication::allWindows();
769
0
            for (QWindow *window : allWindows) {
770
0
                if (!window->isTopLevel() || window->screen() != screen)
771
0
                    continue;
772
773
0
                const bool wasVisible = window->isVisible();
774
0
                window->setScreen(newPrimaryScreen);
775
776
                // Re-show window if moved from a virtual sibling screen. Otherwise
777
                // leave it up to the application developer to show the window.
778
0
                if (movingFromVirtualSibling)
779
0
                    window->setVisible(wasVisible);
780
0
            }
781
0
        }
782
0
    }
783
784
    // Important to keep this order since the QSceen doesn't own the platform screen
785
0
    delete screen;
786
0
    delete platformScreen;
787
0
}
788
789
/*!
790
    Should be called whenever the primary screen changes.
791
792
    When the screen specified as primary changes, this method will notify
793
    QGuiApplication and emit the QGuiApplication::primaryScreenChanged signal.
794
 */
795
void QWindowSystemInterface::handlePrimaryScreenChanged(QPlatformScreen *newPrimary)
796
0
{
797
0
    QScreen *newPrimaryScreen = newPrimary->screen();
798
0
    qsizetype indexOfScreen = QGuiApplicationPrivate::screen_list.indexOf(newPrimaryScreen);
799
0
    Q_ASSERT(indexOfScreen >= 0);
800
0
    if (indexOfScreen == 0)
801
0
        return;
802
803
0
    QGuiApplicationPrivate::screen_list.swapItemsAt(0, indexOfScreen);
804
0
    emit qGuiApp->primaryScreenChanged(newPrimaryScreen);
805
0
}
806
807
void QWindowSystemInterface::handleScreenOrientationChange(QScreen *screen, Qt::ScreenOrientation orientation)
808
0
{
809
0
    handleWindowSystemEvent<QWindowSystemInterfacePrivate::ScreenOrientationEvent>(screen, orientation);
810
0
}
811
812
void QWindowSystemInterface::handleScreenGeometryChange(QScreen *screen, const QRect &geometry, const QRect &availableGeometry)
813
0
{
814
0
    handleWindowSystemEvent<QWindowSystemInterfacePrivate::ScreenGeometryEvent>(screen,
815
0
        QHighDpi::fromNativeScreenGeometry(geometry, screen), QHighDpi::fromNative(availableGeometry,
816
0
        screen, geometry.topLeft()));
817
0
}
818
819
void QWindowSystemInterface::handleScreenLogicalDotsPerInchChange(QScreen *screen, qreal dpiX, qreal dpiY)
820
0
{
821
    // Keep QHighDpiScaling::m_active in sync with platform screen state, in
822
    // order to make scaling calls made during DPI change use the new state.
823
    // FIXME: Remove when QHighDpiScaling::m_active has been removed.
824
0
    QHighDpiScaling::updateHighDpiScaling();
825
826
0
    const QDpi effectiveDpi = QPlatformScreen::overrideDpi(QDpi{dpiX, dpiY});
827
0
    handleWindowSystemEvent<QWindowSystemInterfacePrivate::ScreenLogicalDotsPerInchEvent>(screen,
828
0
                    effectiveDpi.first, effectiveDpi.second);
829
0
}
830
831
void QWindowSystemInterface::handleScreenRefreshRateChange(QScreen *screen, qreal newRefreshRate)
832
0
{
833
0
    handleWindowSystemEvent<QWindowSystemInterfacePrivate::ScreenRefreshRateEvent>(screen, newRefreshRate);
834
0
}
835
836
QT_DEFINE_QPA_EVENT_HANDLER(void, handleThemeChange)
837
0
{
838
0
    handleWindowSystemEvent<QWindowSystemInterfacePrivate::ThemeChangeEvent, Delivery>();
839
0
}
Unexecuted instantiation: void QWindowSystemInterface::handleThemeChange<QWindowSystemInterface::DefaultDelivery>()
Unexecuted instantiation: void QWindowSystemInterface::handleThemeChange<QWindowSystemInterface::SynchronousDelivery>()
Unexecuted instantiation: void QWindowSystemInterface::handleThemeChange<QWindowSystemInterface::AsynchronousDelivery>()
840
841
#if QT_CONFIG(draganddrop)
842
/*!
843
    Drag and drop events are sent immediately.
844
845
    ### FIXME? Perhaps DnD API should add some convenience APIs that are more
846
    intuitive for the possible DND operations. Here passing nullptr as drop data is used to
847
    indicate that drop was canceled and QDragLeaveEvent should be sent as a result.
848
*/
849
QPlatformDragQtResponse QWindowSystemInterface::handleDrag(QWindow *window, const QMimeData *dropData,
850
                                                           const QPoint &p, Qt::DropActions supportedActions,
851
                                                           Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers)
852
0
{
853
0
    auto pos = QHighDpi::fromNativeLocalPosition(p, window);
854
0
    return QGuiApplicationPrivate::processDrag(window, dropData, pos, supportedActions, buttons, modifiers);
855
0
}
856
857
QPlatformDropQtResponse QWindowSystemInterface::handleDrop(QWindow *window, const QMimeData *dropData,
858
                                                           const QPoint &p, Qt::DropActions supportedActions,
859
                                                           Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers)
860
0
{
861
0
    auto pos = QHighDpi::fromNativeLocalPosition(p, window);
862
0
    return QGuiApplicationPrivate::processDrop(window, dropData, pos, supportedActions, buttons, modifiers);
863
0
}
864
#endif // QT_CONFIG(draganddrop)
865
866
/*!
867
    \fn static QWindowSystemInterface::handleNativeEvent(QWindow *window, const QByteArray &eventType, void *message, long *result)
868
    \brief Passes a native event identified by \a eventType to the \a window.
869
870
    \note This function can only be called from the GUI thread.
871
*/
872
873
bool QWindowSystemInterface::handleNativeEvent(QWindow *window, const QByteArray &eventType, void *message, qintptr *result)
874
0
{
875
0
    return QGuiApplicationPrivate::processNativeEvent(window, eventType, message, result);
876
0
}
877
878
void QWindowSystemInterface::handleFileOpenEvent(const QString& fileName)
879
0
{
880
0
    QWindowSystemInterfacePrivate::FileOpenEvent e(fileName);
881
0
    QGuiApplicationPrivate::processWindowSystemEvent(&e);
882
0
}
883
884
void QWindowSystemInterface::handleFileOpenEvent(const QUrl &url)
885
0
{
886
0
    QWindowSystemInterfacePrivate::FileOpenEvent e(url);
887
0
    QGuiApplicationPrivate::processWindowSystemEvent(&e);
888
0
}
889
890
void QWindowSystemInterfacePrivate::TabletEvent::setPlatformSynthesizesMouse(bool v)
891
0
{
892
0
    platformSynthesizesMouse = v;
893
0
}
894
895
bool QWindowSystemInterface::handleTabletEvent(QWindow *window, ulong timestamp, const QPointingDevice *device,
896
                                               const QPointF &local, const QPointF &global,
897
                                               Qt::MouseButtons buttons, qreal pressure, qreal xTilt, qreal yTilt,
898
                                               qreal tangentialPressure, qreal rotation, int z,
899
                                               Qt::KeyboardModifiers modifiers)
900
0
{
901
0
    return handleWindowSystemEvent<QWindowSystemInterfacePrivate::TabletEvent>(window,
902
0
        timestamp,
903
0
        QHighDpi::fromNativeLocalPosition(local, window),
904
0
        QHighDpi::fromNativeGlobalPosition(global, window),
905
0
        device, buttons, pressure,
906
0
        xTilt, yTilt, tangentialPressure, rotation, z, modifiers);
907
0
}
908
909
bool QWindowSystemInterface::handleTabletEvent(QWindow *window, const QPointingDevice *device,
910
                                               const QPointF &local, const QPointF &global,
911
                                               Qt::MouseButtons buttons, qreal pressure, qreal xTilt, qreal yTilt,
912
                                               qreal tangentialPressure, qreal rotation, int z,
913
                                               Qt::KeyboardModifiers modifiers)
914
0
{
915
0
    const ulong time = QWindowSystemInterfacePrivate::eventTime.elapsed();
916
0
    return handleTabletEvent(window, time, device, local, global,
917
0
                             buttons, pressure, xTilt, yTilt, tangentialPressure,
918
0
                             rotation, z, modifiers);
919
0
}
920
921
bool QWindowSystemInterface::handleTabletEvent(QWindow *window, ulong timestamp, const QPointF &local, const QPointF &global,
922
                                               int device, int pointerType, Qt::MouseButtons buttons, qreal pressure, qreal xTilt, qreal yTilt,
923
                                               qreal tangentialPressure, qreal rotation, int z, qint64 uid,
924
                                               Qt::KeyboardModifiers modifiers)
925
0
{
926
0
    const QPointingDevice *dev = QPointingDevicePrivate::tabletDevice(QInputDevice::DeviceType(device),QPointingDevice::PointerType(pointerType),
927
0
                                                                      QPointingDeviceUniqueId::fromNumericId(uid));
928
0
    return handleTabletEvent(window, timestamp, dev, local, global, buttons, pressure,
929
0
                      xTilt, yTilt, tangentialPressure, rotation, z, modifiers);
930
0
}
931
932
bool QWindowSystemInterface::handleTabletEvent(QWindow *window, const QPointF &local, const QPointF &global,
933
                                               int device, int pointerType, Qt::MouseButtons buttons, qreal pressure, qreal xTilt, qreal yTilt,
934
                                               qreal tangentialPressure, qreal rotation, int z, qint64 uid,
935
                                               Qt::KeyboardModifiers modifiers)
936
0
{
937
0
    ulong time = QWindowSystemInterfacePrivate::eventTime.elapsed();
938
0
    return handleTabletEvent(window, time, local, global, device, pointerType, buttons, pressure,
939
0
                      xTilt, yTilt, tangentialPressure, rotation, z, uid, modifiers);
940
0
}
941
942
bool QWindowSystemInterface::handleTabletEnterLeaveProximityEvent(QWindow *window, ulong timestamp, const QPointingDevice *device,
943
                                                                  bool inProximity, const QPointF &local, const QPointF &global,
944
                                                                  Qt::MouseButtons buttons, qreal xTilt, qreal yTilt,
945
                                                                  qreal tangentialPressure, qreal rotation, int z,
946
                                                                  Qt::KeyboardModifiers modifiers)
947
0
{
948
0
    Q_UNUSED(window);
949
0
    Q_UNUSED(local);
950
0
    Q_UNUSED(global);
951
0
    Q_UNUSED(buttons);
952
0
    Q_UNUSED(xTilt);
953
0
    Q_UNUSED(yTilt);
954
0
    Q_UNUSED(tangentialPressure);
955
0
    Q_UNUSED(rotation);
956
0
    Q_UNUSED(z);
957
0
    Q_UNUSED(modifiers);
958
0
    return inProximity
959
0
        ? handleWindowSystemEvent<QWindowSystemInterfacePrivate::TabletEnterProximityEvent>(timestamp, device)
960
0
        : handleWindowSystemEvent<QWindowSystemInterfacePrivate::TabletLeaveProximityEvent>(timestamp, device);
961
0
}
962
963
bool QWindowSystemInterface::handleTabletEnterLeaveProximityEvent(QWindow *window, const QPointingDevice *device,
964
                                                                  bool inProximity, const QPointF &local, const QPointF &global,
965
                                                                  Qt::MouseButtons buttons, qreal xTilt, qreal yTilt,
966
                                                                  qreal tangentialPressure, qreal rotation, int z,
967
                                                                  Qt::KeyboardModifiers modifiers)
968
0
{
969
0
    const ulong time = QWindowSystemInterfacePrivate::eventTime.elapsed();
970
0
    return handleTabletEnterLeaveProximityEvent(window, time, device, inProximity,
971
0
                                                local, global, buttons, xTilt, yTilt,
972
0
                                                tangentialPressure, rotation, z, modifiers);
973
0
}
974
975
976
bool QWindowSystemInterface::handleTabletEnterProximityEvent(ulong timestamp, int deviceType, int pointerType, qint64 uid)
977
0
{
978
0
    const QPointingDevice *device = QPointingDevicePrivate::tabletDevice(QInputDevice::DeviceType(deviceType),
979
0
                                                                         QPointingDevice::PointerType(pointerType),
980
0
                                                                         QPointingDeviceUniqueId::fromNumericId(uid));
981
0
    return handleWindowSystemEvent<QWindowSystemInterfacePrivate::TabletEnterProximityEvent>(timestamp, device);
982
0
}
983
984
void QWindowSystemInterface::handleTabletEnterProximityEvent(int deviceType, int pointerType, qint64 uid)
985
0
{
986
0
    ulong time = QWindowSystemInterfacePrivate::eventTime.elapsed();
987
0
    handleTabletEnterProximityEvent(time, deviceType, pointerType, uid);
988
0
}
989
990
bool QWindowSystemInterface::handleTabletLeaveProximityEvent(ulong timestamp, int deviceType, int pointerType, qint64 uid)
991
0
{
992
0
    const QPointingDevice *device = QPointingDevicePrivate::tabletDevice(QInputDevice::DeviceType(deviceType),
993
0
                                                                         QPointingDevice::PointerType(pointerType),
994
0
                                                                         QPointingDeviceUniqueId::fromNumericId(uid));
995
0
    return handleWindowSystemEvent<QWindowSystemInterfacePrivate::TabletLeaveProximityEvent>(timestamp, device);
996
0
}
997
998
void QWindowSystemInterface::handleTabletLeaveProximityEvent(int deviceType, int pointerType, qint64 uid)
999
0
{
1000
0
    ulong time = QWindowSystemInterfacePrivate::eventTime.elapsed();
1001
0
    handleTabletLeaveProximityEvent(time, deviceType, pointerType, uid);
1002
0
}
1003
1004
#ifndef QT_NO_GESTURES
1005
bool QWindowSystemInterface::handleGestureEvent(QWindow *window, ulong timestamp, const QPointingDevice *device,
1006
                                                Qt::NativeGestureType type, const QPointF &local, const QPointF &global, int fingerCount)
1007
0
{
1008
0
    return handleGestureEventWithValueAndDelta(window, timestamp, device, type, {}, {}, local, global, fingerCount);
1009
0
}
1010
1011
bool QWindowSystemInterface::handleGestureEventWithRealValue(QWindow *window, ulong timestamp, const QPointingDevice *device,
1012
                                                             Qt::NativeGestureType type, qreal value, const QPointF &local, const QPointF &global, int fingerCount)
1013
0
{
1014
0
    return handleGestureEventWithValueAndDelta(window, timestamp, device, type, value, {}, local, global, fingerCount);
1015
0
}
1016
1017
bool QWindowSystemInterface::handleGestureEventWithValueAndDelta(QWindow *window, ulong timestamp, const QPointingDevice *device,
1018
                                                                 Qt::NativeGestureType type, qreal value, const QPointF &delta,
1019
                                                                 const QPointF &local, const QPointF &global, int fingerCount)
1020
0
{
1021
0
    auto localPos = QHighDpi::fromNativeLocalPosition(local, window);
1022
0
    auto globalPos = QHighDpi::fromNativeGlobalPosition(global, window);
1023
1024
0
    return handleWindowSystemEvent<QWindowSystemInterfacePrivate::GestureEvent>(window,
1025
0
        timestamp, type, device, fingerCount, localPos, globalPos, value, delta);
1026
0
}
1027
#endif // QT_NO_GESTURES
1028
1029
void QWindowSystemInterface::handlePlatformPanelEvent(QWindow *w)
1030
0
{
1031
0
    handleWindowSystemEvent<QWindowSystemInterfacePrivate::PlatformPanelEvent>(w);
1032
0
}
1033
1034
#ifndef QT_NO_CONTEXTMENU
1035
QT_DEFINE_QPA_EVENT_HANDLER(bool, handleContextMenuEvent, QWindow *window, bool mouseTriggered,
1036
                                                    const QPoint &pos, const QPoint &globalPos,
1037
                                                    Qt::KeyboardModifiers modifiers)
1038
0
{
1039
0
    return handleWindowSystemEvent<QWindowSystemInterfacePrivate::ContextMenuEvent, Delivery>(
1040
0
        window, mouseTriggered, pos, globalPos, modifiers);
1041
0
}
Unexecuted instantiation: bool QWindowSystemInterface::handleContextMenuEvent<QWindowSystemInterface::DefaultDelivery>(QWindow*, bool, QPoint const&, QPoint const&, QFlags<Qt::KeyboardModifier>)
Unexecuted instantiation: bool QWindowSystemInterface::handleContextMenuEvent<QWindowSystemInterface::SynchronousDelivery>(QWindow*, bool, QPoint const&, QPoint const&, QFlags<Qt::KeyboardModifier>)
Unexecuted instantiation: bool QWindowSystemInterface::handleContextMenuEvent<QWindowSystemInterface::AsynchronousDelivery>(QWindow*, bool, QPoint const&, QPoint const&, QFlags<Qt::KeyboardModifier>)
1042
#endif
1043
1044
#if QT_CONFIG(whatsthis)
1045
void QWindowSystemInterface::handleEnterWhatsThisEvent()
1046
0
{
1047
0
    handleWindowSystemEvent<QWindowSystemInterfacePrivate::WindowSystemEvent>(
1048
0
        QWindowSystemInterfacePrivate::EnterWhatsThisMode);
1049
0
}
1050
#endif
1051
1052
#ifndef QT_NO_DEBUG_STREAM
1053
Q_GUI_EXPORT QDebug operator<<(QDebug dbg, const QWindowSystemInterface::TouchPoint &p)
1054
0
{
1055
0
    QDebugStateSaver saver(dbg);
1056
0
    dbg.nospace() << "TouchPoint(" << p.id << " @" << p.area << " normalized " << p.normalPosition
1057
0
                  << " press " << p.pressure << " vel " << p.velocity << " state " << (int)p.state;
1058
0
    return dbg;
1059
0
}
1060
#endif
1061
1062
// ------------------ Event dispatcher functionality ------------------
1063
1064
/*!
1065
    Make Qt Gui process all events on the event queue immediately. Return the
1066
    accepted state for the last event on the queue.
1067
*/
1068
bool QWindowSystemInterface::flushWindowSystemEvents(QEventLoop::ProcessEventsFlags flags)
1069
0
{
1070
0
    const qsizetype count = QWindowSystemInterfacePrivate::windowSystemEventQueue.count();
1071
0
    if (!count)
1072
0
        return false;
1073
0
    if (!QGuiApplication::instance()) {
1074
0
        qWarning().nospace()
1075
0
            << "QWindowSystemInterface::flushWindowSystemEvents() invoked after "
1076
0
               "QGuiApplication destruction, discarding " << count << " events.";
1077
0
        QWindowSystemInterfacePrivate::windowSystemEventQueue.clear();
1078
0
        return false;
1079
0
    }
1080
0
    if (QThread::currentThread() != QGuiApplication::instance()->thread()) {
1081
        // Post a FlushEvents event which will trigger a call back to
1082
        // deferredFlushWindowSystemEvents from the Gui thread.
1083
0
        QMutexLocker locker(&QWindowSystemInterfacePrivate::flushEventMutex);
1084
0
        handleWindowSystemEvent<QWindowSystemInterfacePrivate::FlushEventsEvent, AsynchronousDelivery>(flags);
1085
0
        QWindowSystemInterfacePrivate::eventsFlushed.wait(&QWindowSystemInterfacePrivate::flushEventMutex);
1086
0
    } else {
1087
0
        sendWindowSystemEvents(flags);
1088
0
    }
1089
0
    return QWindowSystemInterfacePrivate::eventAccepted.loadRelaxed() > 0;
1090
0
}
1091
1092
void QWindowSystemInterface::deferredFlushWindowSystemEvents(QEventLoop::ProcessEventsFlags flags)
1093
0
{
1094
0
    Q_ASSERT(QThread::currentThread() == QGuiApplication::instance()->thread());
1095
1096
0
    QMutexLocker locker(&QWindowSystemInterfacePrivate::flushEventMutex);
1097
0
    sendWindowSystemEvents(flags);
1098
0
    QWindowSystemInterfacePrivate::eventsFlushed.wakeOne();
1099
0
}
1100
1101
bool QWindowSystemInterface::sendWindowSystemEvents(QEventLoop::ProcessEventsFlags flags)
1102
0
{
1103
0
    int nevents = 0;
1104
1105
0
    while (QWindowSystemInterfacePrivate::windowSystemEventsQueued()) {
1106
0
        QWindowSystemInterfacePrivate::WindowSystemEvent *event =
1107
0
                flags & QEventLoop::ExcludeUserInputEvents ?
1108
0
                        QWindowSystemInterfacePrivate::getNonUserInputWindowSystemEvent() :
1109
0
                        QWindowSystemInterfacePrivate::getWindowSystemEvent();
1110
0
        if (!event)
1111
0
            break;
1112
1113
0
        if (QWindowSystemInterfacePrivate::eventHandler) {
1114
0
            if (QWindowSystemInterfacePrivate::eventHandler->sendEvent(event))
1115
0
                nevents++;
1116
0
        } else {
1117
0
            nevents++;
1118
0
            QGuiApplicationPrivate::processWindowSystemEvent(event);
1119
0
        }
1120
1121
        // Record the accepted state for the processed event
1122
        // (excluding flush events). This state can then be
1123
        // returned by flushWindowSystemEvents().
1124
0
        if (event->type != QWindowSystemInterfacePrivate::FlushEvents)
1125
0
            QWindowSystemInterfacePrivate::eventAccepted.storeRelaxed(event->eventAccepted);
1126
1127
0
        delete event;
1128
0
    }
1129
1130
0
    return (nevents > 0);
1131
0
}
1132
1133
void QWindowSystemInterface::setSynchronousWindowSystemEvents(bool enable)
1134
0
{
1135
0
    QWindowSystemInterfacePrivate::synchronousWindowSystemEvents = enable;
1136
0
}
1137
1138
int QWindowSystemInterface::windowSystemEventsQueued()
1139
0
{
1140
0
    return QWindowSystemInterfacePrivate::windowSystemEventsQueued();
1141
0
}
1142
1143
bool QWindowSystemInterface::nonUserInputEventsQueued()
1144
0
{
1145
0
    return QWindowSystemInterfacePrivate::nonUserInputEventsQueued();
1146
0
}
1147
1148
// --------------------- QtTestLib support ---------------------
1149
1150
// The following functions are used by testlib, and need to be synchronous to avoid
1151
// race conditions with plugins delivering native events from secondary threads.
1152
// FIXME: It seems unnecessary to export these wrapper functions, when qtestlib could access
1153
// QWindowSystemInterface directly (by adding dependency to gui-private), see QTBUG-63146.
1154
1155
Q_GUI_EXPORT void qt_handleMouseEvent(QWindow *window, const QPointF &local, const QPointF &global,
1156
                                      Qt::MouseButtons state, Qt::MouseButton button,
1157
                                      QEvent::Type type, Qt::KeyboardModifiers mods, int timestamp)
1158
0
{
1159
0
    QPointF nativeLocal = QHighDpi::toNativeLocalPosition(local, window);
1160
0
    QPointF nativeGlobal = QHighDpi::toNativeGlobalPosition(global, window);
1161
0
    QWindowSystemInterface::handleMouseEvent<QWindowSystemInterface::SynchronousDelivery>(window,
1162
0
                timestamp, nativeLocal, nativeGlobal, state, button, type, mods);
1163
0
}
1164
1165
/*
1166
    Used by QTest::simulateEvent() to synthesize key events during testing
1167
*/
1168
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)
1169
0
{
1170
#if defined(Q_OS_MACOS)
1171
    // FIXME: Move into QTest::simulateEvent() and align with QGuiApplicationPrivate::processKeyEvent()
1172
    auto timestamp = QWindowSystemInterfacePrivate::eventTime.elapsed();
1173
    if (t == QEvent::KeyPress && QWindowSystemInterface::handleShortcutEvent(window, timestamp, k, mods, 0, 0, 0, text, autorep, count))
1174
        return;
1175
#endif
1176
1177
0
    QWindowSystemInterface::handleKeyEvent<QWindowSystemInterface::SynchronousDelivery>(window, t, k, mods, text, autorep, count);
1178
0
}
1179
1180
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)
1181
0
{
1182
0
#if QT_CONFIG(shortcut)
1183
1184
    // FIXME: This method should not allow targeting a specific object, but should
1185
    // instead forward the event to a window, which then takes care of normal event
1186
    // propagation. We need to fix a lot of tests before we can refactor this (the
1187
    // window needs to be exposed and active and have a focus object), so we leave
1188
    // it as is for now. See QTBUG-48577.
1189
1190
0
    QGuiApplicationPrivate::modifier_buttons = mods;
1191
1192
0
    QKeyEvent qevent(QEvent::ShortcutOverride, k, mods, text, autorep, count);
1193
0
    qevent.setTimestamp(timestamp);
1194
1195
0
    QShortcutMap &shortcutMap = QGuiApplicationPrivate::instance()->shortcutMap;
1196
0
    if (shortcutMap.state() == QKeySequence::NoMatch) {
1197
        // Try sending as QKeyEvent::ShortcutOverride first
1198
0
        QCoreApplication::sendEvent(o, &qevent);
1199
0
        if (qevent.isAccepted())
1200
0
            return false;
1201
0
    }
1202
1203
    // Then as QShortcutEvent
1204
0
    return shortcutMap.tryShortcut(&qevent);
1205
#else
1206
    Q_UNUSED(o);
1207
    Q_UNUSED(timestamp);
1208
    Q_UNUSED(k);
1209
    Q_UNUSED(mods);
1210
    Q_UNUSED(text);
1211
    Q_UNUSED(autorep);
1212
    Q_UNUSED(count);
1213
    return false;
1214
#endif
1215
0
}
1216
1217
Q_GUI_EXPORT void qt_handleWheelEvent(QWindow *window, const QPointF &local, const QPointF &global,
1218
                                      QPoint pixelDelta, QPoint angleDelta, Qt::KeyboardModifiers mods,
1219
                                      Qt::ScrollPhase phase)
1220
0
{
1221
0
    QWindowSystemInterface::handleWheelEvent(window, local, global, pixelDelta, angleDelta, mods, phase);
1222
0
}
1223
1224
namespace QTest
1225
{
1226
    Q_GUI_EXPORT QPointingDevice * createTouchDevice(QInputDevice::DeviceType devType,
1227
                                                     QInputDevice::Capabilities caps)
1228
0
    {
1229
0
        static qint64 nextId = 0x100000000;
1230
0
        QPointingDevice *ret = new QPointingDevice("test touch device"_L1, nextId++,
1231
0
                                                   devType, QPointingDevice::PointerType::Finger,
1232
0
                                                   caps, 8, 0);
1233
0
        QWindowSystemInterface::registerInputDevice(ret);
1234
0
        return ret;
1235
0
    }
1236
}
1237
1238
Q_GUI_EXPORT bool qt_handleTouchEventv2(QWindow *window, const QPointingDevice *device,
1239
                                const QList<QEventPoint> &points,
1240
                                Qt::KeyboardModifiers mods)
1241
0
{
1242
0
    return QWindowSystemInterface::handleTouchEvent<QWindowSystemInterface::SynchronousDelivery>(window, device,
1243
0
        QWindowSystemInterfacePrivate::toNativeTouchPoints(points, window), mods);
1244
0
}
1245
1246
Q_GUI_EXPORT void qt_handleTouchEvent(QWindow *window, const QPointingDevice *device,
1247
                                const QList<QEventPoint> &points,
1248
                                Qt::KeyboardModifiers mods)
1249
0
{
1250
0
    qt_handleTouchEventv2(window, device, points, mods);
1251
0
}
1252
1253
QT_END_NAMESPACE