OpenCoverage

qwindowsysteminterface.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/gui/kernel/qwindowsysteminterface.cpp
Source codeSwitch to Preprocessed file
LineSourceCount
1/****************************************************************************-
2**-
3** Copyright (C) 2016 The Qt Company Ltd.-
4** Contact: https://www.qt.io/licensing/-
5**-
6** This file is part of the QtGui module of the Qt Toolkit.-
7**-
8** $QT_BEGIN_LICENSE:LGPL$-
9** Commercial License Usage-
10** Licensees holding valid commercial Qt licenses may use this file in-
11** accordance with the commercial license agreement provided with the-
12** Software or, alternatively, in accordance with the terms contained in-
13** a written agreement between you and The Qt Company. For licensing terms-
14** and conditions see https://www.qt.io/terms-conditions. For further-
15** information use the contact form at https://www.qt.io/contact-us.-
16**-
17** GNU Lesser General Public License Usage-
18** Alternatively, this file may be used under the terms of the GNU Lesser-
19** General Public License version 3 as published by the Free Software-
20** Foundation and appearing in the file LICENSE.LGPL3 included in the-
21** packaging of this file. Please review the following information to-
22** ensure the GNU Lesser General Public License version 3 requirements-
23** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.-
24**-
25** GNU General Public License Usage-
26** Alternatively, this file may be used under the terms of the GNU-
27** General Public License version 2.0 or (at your option) the GNU General-
28** Public license version 3 or any later version approved by the KDE Free-
29** Qt Foundation. The licenses are as published by the Free Software-
30** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3-
31** included in the packaging of this file. Please review the following-
32** information to ensure the GNU General Public License requirements will-
33** be met: https://www.gnu.org/licenses/gpl-2.0.html and-
34** https://www.gnu.org/licenses/gpl-3.0.html.-
35**-
36** $QT_END_LICENSE$-
37**-
38****************************************************************************/-
39#include "qwindowsysteminterface.h"-
40#include <qpa/qplatformwindow.h>-
41#include "qwindowsysteminterface_p.h"-
42#include "private/qguiapplication_p.h"-
43#include "private/qevent_p.h"-
44#include "private/qtouchdevice_p.h"-
45#include <QAbstractEventDispatcher>-
46#include <qpa/qplatformdrag.h>-
47#include <qpa/qplatformintegration.h>-
48#include <qdebug.h>-
49#include "qhighdpiscaling_p.h"-
50#include <QtCore/qscopedvaluerollback.h>-
51-
52QT_BEGIN_NAMESPACE-
53-
54-
55QElapsedTimer QWindowSystemInterfacePrivate::eventTime;-
56bool QWindowSystemInterfacePrivate::synchronousWindowSystemEvents = false;-
57bool QWindowSystemInterfacePrivate::TabletEvent::platformSynthesizesMouse = true;-
58QWaitCondition QWindowSystemInterfacePrivate::eventsFlushed;-
59QMutex QWindowSystemInterfacePrivate::flushEventMutex;-
60QAtomicInt QWindowSystemInterfacePrivate::eventAccepted;-
61QWindowSystemEventHandler *QWindowSystemInterfacePrivate::eventHandler;-
62-
63//-------------------------------------------------------------
64//-
65// Callback functions for plugins:-
66//-
67-
68QWindowSystemInterfacePrivate::WindowSystemEventList QWindowSystemInterfacePrivate::windowSystemEventQueue;-
69-
70extern QPointer<QWindow> qt_last_mouse_receiver;-
71-
72/*!-
73 \class QWindowSystemInterface-
74 \since 5.0-
75 \internal-
76 \preliminary-
77 \ingroup qpa-
78 \brief The QWindowSystemInterface provides an event queue for the QPA platform.-
79-
80 The platform plugins call the various functions to notify about events. The events are queued-
81 until sendWindowSystemEvents() is called by the event dispatcher.-
82*/-
83-
84void QWindowSystemInterface::handleEnterEvent(QWindow *tlw, const QPointF &local, const QPointF &global)-
85{-
86 if (tlw) {
tlwDescription
TRUEnever evaluated
FALSEnever evaluated
0
87 QWindowSystemInterfacePrivate::EnterEvent *e = new QWindowSystemInterfacePrivate::EnterEvent(tlw, local, global);-
88 QWindowSystemInterfacePrivate::handleWindowSystemEvent(e);-
89 }
never executed: end of block
0
90}
never executed: end of block
0
91-
92void QWindowSystemInterface::handleLeaveEvent(QWindow *tlw)-
93{-
94 QWindowSystemInterfacePrivate::LeaveEvent *e = new QWindowSystemInterfacePrivate::LeaveEvent(tlw);-
95 QWindowSystemInterfacePrivate::handleWindowSystemEvent(e);-
96}
never executed: end of block
0
97-
98/*!-
99 This method can be used to ensure leave and enter events are both in queue when moving from-
100 one QWindow to another. This allows QWindow subclasses to check for a queued enter event-
101 when handling the leave event (\c QWindowSystemInterfacePrivate::peekWindowSystemEvent) to-
102 determine where mouse went and act accordingly. E.g. QWidgetWindow needs to know if mouse-
103 cursor moves between windows in same window hierarchy.-
104*/-
105void QWindowSystemInterface::handleEnterLeaveEvent(QWindow *enter, QWindow *leave, const QPointF &local, const QPointF& global)-
106{-
107 bool wasSynchronous = QWindowSystemInterfacePrivate::synchronousWindowSystemEvents;-
108 if (wasSynchronous)
wasSynchronousDescription
TRUEnever evaluated
FALSEnever evaluated
0
109 setSynchronousWindowSystemEvents(false);
never executed: setSynchronousWindowSystemEvents(false);
0
110 handleLeaveEvent(leave);-
111 handleEnterEvent(enter, local, global);-
112 if (wasSynchronous) {
wasSynchronousDescription
TRUEnever evaluated
FALSEnever evaluated
0
113 flushWindowSystemEvents();-
114 setSynchronousWindowSystemEvents(true);-
115 }
never executed: end of block
0
116}
never executed: end of block
0
117-
118void QWindowSystemInterface::handleWindowActivated(QWindow *tlw, Qt::FocusReason r)-
119{-
120 QWindowSystemInterfacePrivate::ActivatedWindowEvent *e =-
121 new QWindowSystemInterfacePrivate::ActivatedWindowEvent(tlw, r);-
122 QWindowSystemInterfacePrivate::handleWindowSystemEvent(e);-
123}
never executed: end of block
0
124-
125void QWindowSystemInterface::handleWindowStateChanged(QWindow *tlw, Qt::WindowState newState)-
126{-
127 QWindowSystemInterfacePrivate::WindowStateChangedEvent *e =-
128 new QWindowSystemInterfacePrivate::WindowStateChangedEvent(tlw, newState);-
129 QWindowSystemInterfacePrivate::handleWindowSystemEvent(e);-
130}
never executed: end of block
0
131-
132void QWindowSystemInterface::handleWindowScreenChanged(QWindow *tlw, QScreen *screen)-
133{-
134 QWindowSystemInterfacePrivate::WindowScreenChangedEvent *e =-
135 new QWindowSystemInterfacePrivate::WindowScreenChangedEvent(tlw, screen);-
136 QWindowSystemInterfacePrivate::handleWindowSystemEvent(e);-
137}
never executed: end of block
0
138-
139void QWindowSystemInterface::handleApplicationStateChanged(Qt::ApplicationState newState, bool forcePropagate)-
140{-
141 Q_ASSERT(QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::ApplicationState));-
142 QWindowSystemInterfacePrivate::ApplicationStateChangedEvent *e =-
143 new QWindowSystemInterfacePrivate::ApplicationStateChangedEvent(newState, forcePropagate);-
144 QWindowSystemInterfacePrivate::handleWindowSystemEvent(e);-
145}
never executed: end of block
0
146-
147/*!-
148 If \a oldRect is null, Qt will use the previously reported geometry instead.-
149 */-
150void QWindowSystemInterface::handleGeometryChange(QWindow *tlw, const QRect &newRect, const QRect &oldRect)-
151{-
152 QWindowSystemInterfacePrivate::GeometryChangeEvent *e = new QWindowSystemInterfacePrivate::GeometryChangeEvent(tlw, QHighDpi::fromNativePixels(newRect, tlw), QHighDpi::fromNativePixels(oldRect, tlw));-
153 QWindowSystemInterfacePrivate::handleWindowSystemEvent(e);-
154}
never executed: end of block
0
155-
156void QWindowSystemInterface::handleCloseEvent(QWindow *tlw, bool *accepted)-
157{-
158 if (tlw) {
tlwDescription
TRUEnever evaluated
FALSEnever evaluated
0
159 QWindowSystemInterfacePrivate::CloseEvent *e =-
160 new QWindowSystemInterfacePrivate::CloseEvent(tlw, accepted);-
161 QWindowSystemInterfacePrivate::handleWindowSystemEvent(e);-
162 }
never executed: end of block
0
163}
never executed: end of block
0
164-
165/*!-
166-
167\a w == 0 means that the event is in global coords only, \a local will be ignored in this case-
168-
169*/-
170void QWindowSystemInterface::handleMouseEvent(QWindow *w, const QPointF & local, const QPointF & global, Qt::MouseButtons b,-
171 Qt::KeyboardModifiers mods, Qt::MouseEventSource source)-
172{-
173 unsigned long time = QWindowSystemInterfacePrivate::eventTime.elapsed();-
174 handleMouseEvent(w, time, local, global, b, mods, source);-
175}
never executed: end of block
0
176-
177void QWindowSystemInterface::handleMouseEvent(QWindow *w, ulong timestamp, const QPointF & local, const QPointF & global, Qt::MouseButtons b,-
178 Qt::KeyboardModifiers mods, Qt::MouseEventSource source)-
179{-
180 QWindowSystemInterfacePrivate::MouseEvent * e =-
181 new QWindowSystemInterfacePrivate::MouseEvent(w, timestamp, QHighDpi::fromNativeLocalPosition(local, w), QHighDpi::fromNativePixels(global, w), b, mods, source);-
182 QWindowSystemInterfacePrivate::handleWindowSystemEvent(e);-
183}
never executed: end of block
0
184-
185void QWindowSystemInterface::handleFrameStrutMouseEvent(QWindow *w, const QPointF & local, const QPointF & global, Qt::MouseButtons b,-
186 Qt::KeyboardModifiers mods, Qt::MouseEventSource source)-
187{-
188 const unsigned long time = QWindowSystemInterfacePrivate::eventTime.elapsed();-
189 handleFrameStrutMouseEvent(w, time, local, global, b, mods, source);-
190}
never executed: end of block
0
191-
192void QWindowSystemInterface::handleFrameStrutMouseEvent(QWindow *w, ulong timestamp, const QPointF & local, const QPointF & global, Qt::MouseButtons b,-
193 Qt::KeyboardModifiers mods, Qt::MouseEventSource source)-
194{-
195 QWindowSystemInterfacePrivate::MouseEvent * e =-
196 new QWindowSystemInterfacePrivate::MouseEvent(w, timestamp,-
197 QWindowSystemInterfacePrivate::FrameStrutMouse,-
198 QHighDpi::fromNativeLocalPosition(local, w), QHighDpi::fromNativePixels(global, w), b, mods, source);-
199 QWindowSystemInterfacePrivate::handleWindowSystemEvent(e);-
200}
never executed: end of block
0
201-
202bool QWindowSystemInterface::handleShortcutEvent(QWindow *window, ulong timestamp, int keyCode, Qt::KeyboardModifiers modifiers, quint32 nativeScanCode,-
203 quint32 nativeVirtualKey, quint32 nativeModifiers, const QString &text, bool autorepeat, ushort count)-
204{-
205#ifndef QT_NO_SHORTCUT-
206 if (!window)
!windowDescription
TRUEnever evaluated
FALSEnever evaluated
0
207 window = QGuiApplication::focusWindow();
never executed: window = QGuiApplication::focusWindow();
0
208-
209 QShortcutMap &shortcutMap = QGuiApplicationPrivate::instance()->shortcutMap;-
210 if (shortcutMap.state() == QKeySequence::NoMatch) {
shortcutMap.st...uence::NoMatchDescription
TRUEnever evaluated
FALSEnever evaluated
0
211 // Check if the shortcut is overridden by some object in the event delivery path (typically the focus object).-
212 // If so, we should not look up the shortcut in the shortcut map, but instead deliver the event as a regular-
213 // key event, so that the target that accepted the shortcut override event can handle it. Note that we only-
214 // do this if the shortcut map hasn't found a partial shortcut match yet. If it has, the shortcut can not be-
215 // overridden.-
216 QWindowSystemInterfacePrivate::KeyEvent *shortcutOverrideEvent = new QWindowSystemInterfacePrivate::KeyEvent(window, timestamp,-
217 QEvent::ShortcutOverride, keyCode, modifiers, nativeScanCode, nativeVirtualKey, nativeModifiers, text, autorepeat, count);-
218-
219 {-
220 // FIXME: Template handleWindowSystemEvent to support both sync and async delivery-
221 QScopedValueRollback<bool> syncRollback(QWindowSystemInterfacePrivate::synchronousWindowSystemEvents);-
222 QWindowSystemInterfacePrivate::synchronousWindowSystemEvents = true;-
223-
224 if (QWindowSystemInterfacePrivate::handleWindowSystemEvent(shortcutOverrideEvent))
QWindowSystemI...OverrideEvent)Description
TRUEnever evaluated
FALSEnever evaluated
0
225 return false;
never executed: return false;
0
226 }-
227 }
never executed: end of block
0
228-
229 // The shortcut event is dispatched as a QShortcutEvent, not a QKeyEvent, but we use-
230 // the QKeyEvent as a container for the various properties that the shortcut map needs-
231 // to inspect to determine if a shortcut matched the keys that were pressed.-
232 QKeyEvent keyEvent(QEvent::ShortcutOverride, keyCode, modifiers, nativeScanCode,-
233 nativeVirtualKey, nativeModifiers, text, autorepeat, count);-
234-
235 return shortcutMap.tryShortcut(&keyEvent);
never executed: return shortcutMap.tryShortcut(&keyEvent);
0
236#else-
237 Q_UNUSED(window)-
238 Q_UNUSED(timestamp)-
239 Q_UNUSED(key)-
240 Q_UNUSED(modifiers)-
241 Q_UNUSED(nativeScanCode)-
242 Q_UNUSED(nativeVirtualKey)-
243 Q_UNUSED(nativeModifiers)-
244 Q_UNUSED(text)-
245 Q_UNUSED(autorepeat)-
246 Q_UNUSED(count)-
247 return false;-
248#endif-
249}-
250-
251-
252bool QWindowSystemInterface::handleKeyEvent(QWindow *w, QEvent::Type t, int k, Qt::KeyboardModifiers mods, const QString & text, bool autorep, ushort count) {-
253 unsigned long time = QWindowSystemInterfacePrivate::eventTime.elapsed();-
254 return handleKeyEvent(w, time, t, k, mods, text, autorep, count);
never executed: return handleKeyEvent(w, time, t, k, mods, text, autorep, count);
0
255}-
256-
257bool QWindowSystemInterface::handleKeyEvent(QWindow *tlw, ulong timestamp, QEvent::Type t, int k, Qt::KeyboardModifiers mods, const QString & text, bool autorep, ushort count)-
258{-
259#if defined(Q_OS_OSX)-
260 if (t == QEvent::KeyPress && QWindowSystemInterface::handleShortcutEvent(tlw, timestamp, k, mods, 0, 0, 0, text, autorep, count))-
261 return true;-
262#endif-
263-
264 QWindowSystemInterfacePrivate::KeyEvent * e =-
265 new QWindowSystemInterfacePrivate::KeyEvent(tlw, timestamp, t, k, mods, text, autorep, count);-
266 return QWindowSystemInterfacePrivate::handleWindowSystemEvent(e);
never executed: return QWindowSystemInterfacePrivate::handleWindowSystemEvent(e);
0
267}-
268-
269bool QWindowSystemInterface::handleExtendedKeyEvent(QWindow *w, QEvent::Type type, int key, Qt::KeyboardModifiers modifiers,-
270 quint32 nativeScanCode, quint32 nativeVirtualKey,-
271 quint32 nativeModifiers,-
272 const QString& text, bool autorep,-
273 ushort count, bool tryShortcutOverride)-
274{-
275 unsigned long time = QWindowSystemInterfacePrivate::eventTime.elapsed();-
276 return handleExtendedKeyEvent(w, time, type, key, modifiers, nativeScanCode, nativeVirtualKey, nativeModifiers,
never executed: return handleExtendedKeyEvent(w, time, type, key, modifiers, nativeScanCode, nativeVirtualKey, nativeModifiers, text, autorep, count, tryShortcutOverride);
0
277 text, autorep, count, tryShortcutOverride);
never executed: return handleExtendedKeyEvent(w, time, type, key, modifiers, nativeScanCode, nativeVirtualKey, nativeModifiers, text, autorep, count, tryShortcutOverride);
0
278}-
279-
280bool QWindowSystemInterface::handleExtendedKeyEvent(QWindow *tlw, ulong timestamp, QEvent::Type type, int key,-
281 Qt::KeyboardModifiers modifiers,-
282 quint32 nativeScanCode, quint32 nativeVirtualKey,-
283 quint32 nativeModifiers,-
284 const QString& text, bool autorep,-
285 ushort count, bool tryShortcutOverride)-
286{-
287#if defined(Q_OS_OSX)-
288 if (tryShortcutOverride && type == QEvent::KeyPress && QWindowSystemInterface::handleShortcutEvent(tlw,-
289 timestamp, key, modifiers, nativeScanCode, nativeVirtualKey, nativeModifiers, text, autorep, count)) {-
290 return true;-
291 }-
292#else-
293 Q_UNUSED(tryShortcutOverride)-
294#endif-
295-
296 QWindowSystemInterfacePrivate::KeyEvent * e =-
297 new QWindowSystemInterfacePrivate::KeyEvent(tlw, timestamp, type, key, modifiers,-
298 nativeScanCode, nativeVirtualKey, nativeModifiers, text, autorep, count);-
299 return QWindowSystemInterfacePrivate::handleWindowSystemEvent(e);
never executed: return QWindowSystemInterfacePrivate::handleWindowSystemEvent(e);
0
300}-
301-
302void QWindowSystemInterface::handleWheelEvent(QWindow *w, const QPointF & local, const QPointF & global, int d, Qt::Orientation o, Qt::KeyboardModifiers mods) {-
303 unsigned long time = QWindowSystemInterfacePrivate::eventTime.elapsed();-
304 handleWheelEvent(w, time, local, global, d, o, mods);-
305}
never executed: end of block
0
306-
307void QWindowSystemInterface::handleWheelEvent(QWindow *tlw, ulong timestamp, const QPointF & local, const QPointF & global, int d, Qt::Orientation o, Qt::KeyboardModifiers mods)-
308{-
309 QPoint point = (o == Qt::Vertical) ? QPoint(0, d) : QPoint(d, 0);
(o == Qt::Vertical)Description
TRUEnever evaluated
FALSEnever evaluated
0
310 handleWheelEvent(tlw, timestamp, local, global, QPoint(), point, mods);-
311}
never executed: end of block
0
312-
313void QWindowSystemInterface::handleWheelEvent(QWindow *w, const QPointF & local, const QPointF & global, QPoint pixelDelta, QPoint angleDelta, Qt::KeyboardModifiers mods, Qt::ScrollPhase phase, Qt::MouseEventSource source)-
314{-
315 unsigned long time = QWindowSystemInterfacePrivate::eventTime.elapsed();-
316 handleWheelEvent(w, time, local, global, pixelDelta, angleDelta, mods, phase, source);-
317}
never executed: end of block
0
318-
319void QWindowSystemInterface::handleWheelEvent(QWindow *tlw, ulong timestamp, const QPointF & local, const QPointF & global, QPoint pixelDelta, QPoint angleDelta, Qt::KeyboardModifiers mods, Qt::ScrollPhase phase,-
320 Qt::MouseEventSource source, bool invertedScrolling)-
321{-
322 // Qt 4 sends two separate wheel events for horizontal and vertical-
323 // deltas. For Qt 5 we want to send the deltas in one event, but at the-
324 // same time preserve source and behavior compatibility with Qt 4.-
325 //-
326 // In addition high-resolution pixel-based deltas are also supported.-
327 // Platforms that does not support these may pass a null point here.-
328 // Angle deltas must always be sent in addition to pixel deltas.-
329 QWindowSystemInterfacePrivate::WheelEvent *e;-
330-
331 // Pass Qt::ScrollBegin and Qt::ScrollEnd through-
332 // even if the wheel delta is null.-
333 if (angleDelta.isNull() && phase == Qt::ScrollUpdate)
angleDelta.isNull()Description
TRUEnever evaluated
FALSEnever evaluated
phase == Qt::ScrollUpdateDescription
TRUEnever evaluated
FALSEnever evaluated
0
334 return;
never executed: return;
0
335-
336 // Simple case: vertical deltas only:-
337 if (angleDelta.y() != 0 && angleDelta.x() == 0) {
angleDelta.y() != 0Description
TRUEnever evaluated
FALSEnever evaluated
angleDelta.x() == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
338 e = new QWindowSystemInterfacePrivate::WheelEvent(tlw, timestamp, QHighDpi::fromNativeLocalPosition(local, tlw), QHighDpi::fromNativePixels(global, tlw), pixelDelta, angleDelta, angleDelta.y(), Qt::Vertical,-
339 mods, phase, source, invertedScrolling);-
340 QWindowSystemInterfacePrivate::handleWindowSystemEvent(e);-
341 return;
never executed: return;
0
342 }-
343-
344 // Simple case: horizontal deltas only:-
345 if (angleDelta.y() == 0 && angleDelta.x() != 0) {
angleDelta.y() == 0Description
TRUEnever evaluated
FALSEnever evaluated
angleDelta.x() != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
346 e = new QWindowSystemInterfacePrivate::WheelEvent(tlw, timestamp, QHighDpi::fromNativeLocalPosition(local, tlw), QHighDpi::fromNativePixels(global, tlw), pixelDelta, angleDelta, angleDelta.x(), Qt::Horizontal, mods, phase, source, invertedScrolling);-
347 QWindowSystemInterfacePrivate::handleWindowSystemEvent(e);-
348 return;
never executed: return;
0
349 }-
350-
351 // Both horizontal and vertical deltas: Send two wheel events.-
352 // The first event contains the Qt 5 pixel and angle delta as points,-
353 // and in addition the Qt 4 compatibility vertical angle delta.-
354 e = new QWindowSystemInterfacePrivate::WheelEvent(tlw, timestamp, QHighDpi::fromNativeLocalPosition(local, tlw), QHighDpi::fromNativePixels(global, tlw), pixelDelta, angleDelta, angleDelta.y(), Qt::Vertical, mods, phase, source, invertedScrolling);-
355 QWindowSystemInterfacePrivate::handleWindowSystemEvent(e);-
356-
357 // The second event contains null pixel and angle points and the-
358 // Qt 4 compatibility horizontal angle delta.-
359 e = new QWindowSystemInterfacePrivate::WheelEvent(tlw, timestamp, QHighDpi::fromNativeLocalPosition(local, tlw), QHighDpi::fromNativePixels(global, tlw), QPoint(), QPoint(), angleDelta.x(), Qt::Horizontal, mods, phase, source, invertedScrolling);-
360 QWindowSystemInterfacePrivate::handleWindowSystemEvent(e);-
361}
never executed: end of block
0
362-
363-
364QWindowSystemInterfacePrivate::ExposeEvent::ExposeEvent(QWindow *exposed, const QRegion &region)-
365 : WindowSystemEvent(Expose)-
366 , exposed(exposed)-
367 , isExposed(exposed && exposed->handle() ? exposed->handle()->isExposed() : false)-
368 , region(region)-
369{-
370}
never executed: end of block
0
371-
372int QWindowSystemInterfacePrivate::windowSystemEventsQueued()-
373{-
374 return windowSystemEventQueue.count();
never executed: return windowSystemEventQueue.count();
0
375}-
376-
377QWindowSystemInterfacePrivate::WindowSystemEvent * QWindowSystemInterfacePrivate::getWindowSystemEvent()-
378{-
379 return windowSystemEventQueue.takeFirstOrReturnNull();
never executed: return windowSystemEventQueue.takeFirstOrReturnNull();
0
380}-
381-
382QWindowSystemInterfacePrivate::WindowSystemEvent *QWindowSystemInterfacePrivate::getNonUserInputWindowSystemEvent()-
383{-
384 return windowSystemEventQueue.takeFirstNonUserInputOrReturnNull();
never executed: return windowSystemEventQueue.takeFirstNonUserInputOrReturnNull();
0
385}-
386-
387QWindowSystemInterfacePrivate::WindowSystemEvent *QWindowSystemInterfacePrivate::peekWindowSystemEvent(EventType t)-
388{-
389 return windowSystemEventQueue.peekAtFirstOfType(t);
never executed: return windowSystemEventQueue.peekAtFirstOfType(t);
0
390}-
391-
392void QWindowSystemInterfacePrivate::removeWindowSystemEvent(WindowSystemEvent *event)-
393{-
394 windowSystemEventQueue.remove(event);-
395}
never executed: end of block
0
396-
397void QWindowSystemInterfacePrivate::postWindowSystemEvent(WindowSystemEvent *ev)-
398{-
399 windowSystemEventQueue.append(ev);-
400 QAbstractEventDispatcher *dispatcher = QGuiApplicationPrivate::qt_qpa_core_dispatcher();-
401 if (dispatcher)
dispatcherDescription
TRUEnever evaluated
FALSEnever evaluated
0
402 dispatcher->wakeUp();
never executed: dispatcher->wakeUp();
0
403}
never executed: end of block
0
404-
405/*!-
406 Handles a window system event.-
407-
408 By default this function posts the event on the window system event queue and-
409 wakes the Gui event dispatcher. Qt Gui will then handle the event asynchonously-
410 at a later point. The return value is not used in asynchronous mode and will-
411 always be true.-
412-
413 In synchronous mode Qt Gui will process the event immediately. The return value-
414 indicates if Qt accepted the event.-
415-
416 \sa flushWindowSystemEvents(), setSynchronousWindowSystemEvents()-
417*/-
418bool QWindowSystemInterfacePrivate::handleWindowSystemEvent(QWindowSystemInterfacePrivate::WindowSystemEvent *ev)-
419{-
420 bool accepted = true;-
421 if (synchronousWindowSystemEvents) {
synchronousWindowSystemEventsDescription
TRUEnever evaluated
FALSEnever evaluated
0
422 if (QThread::currentThread() == QGuiApplication::instance()->thread()) {
QThread::curre...ce()->thread()Description
TRUEnever evaluated
FALSEnever evaluated
0
423 // Process the event immediately on the current thread and return the accepted state.-
424 QGuiApplicationPrivate::processWindowSystemEvent(ev);-
425 accepted = ev->eventAccepted;-
426 delete ev;-
427 } else {
never executed: end of block
0
428 // Post the event on the Qt main thread queue and flush the queue.-
429 // This will wake up the Gui thread which will process the event.-
430 // Return the accepted state for the last event on the queue,-
431 // which is the event posted by this function.-
432 postWindowSystemEvent(ev);-
433 accepted = QWindowSystemInterface::flushWindowSystemEvents();-
434 }
never executed: end of block
0
435 } else {-
436 postWindowSystemEvent(ev);-
437 }
never executed: end of block
0
438 return accepted;
never executed: return accepted;
0
439}-
440-
441void QWindowSystemInterface::registerTouchDevice(const QTouchDevice *device)-
442{-
443 QTouchDevicePrivate::registerDevice(device);-
444}
never executed: end of block
0
445-
446void QWindowSystemInterface::unregisterTouchDevice(const QTouchDevice *device)-
447{-
448 QTouchDevicePrivate::unregisterDevice(device);-
449}
never executed: end of block
0
450-
451bool QWindowSystemInterface::isTouchDeviceRegistered(const QTouchDevice *device)-
452{-
453 return QTouchDevicePrivate::isRegistered(device);
never executed: return QTouchDevicePrivate::isRegistered(device);
0
454}-
455-
456void QWindowSystemInterface::handleTouchEvent(QWindow *w, QTouchDevice *device,-
457 const QList<TouchPoint> &points, Qt::KeyboardModifiers mods)-
458{-
459 unsigned long time = QWindowSystemInterfacePrivate::eventTime.elapsed();-
460 handleTouchEvent(w, time, device, points, mods);-
461}
never executed: end of block
0
462-
463QList<QTouchEvent::TouchPoint>-
464 QWindowSystemInterfacePrivate::fromNativeTouchPoints(const QList<QWindowSystemInterface::TouchPoint> &points,-
465 const QWindow *window,-
466 QEvent::Type *type)-
467{-
468 QList<QTouchEvent::TouchPoint> touchPoints;-
469 Qt::TouchPointStates states;-
470 QTouchEvent::TouchPoint p;-
471-
472 touchPoints.reserve(points.count());-
473 QList<QWindowSystemInterface::TouchPoint>::const_iterator point = points.constBegin();-
474 QList<QWindowSystemInterface::TouchPoint>::const_iterator end = points.constEnd();-
475 while (point != end) {
point != endDescription
TRUEnever evaluated
FALSEnever evaluated
0
476 p.setId(point->id);-
477 p.setPressure(point->pressure);-
478 states |= point->state;-
479 p.setState(point->state);-
480-
481 const QPointF screenPos = point->area.center();-
482 p.setScreenPos(QHighDpi::fromNativePixels(screenPos, window));-
483 p.setScreenRect(QHighDpi::fromNativePixels(point->area, window));-
484-
485 // The local pos and rect are not set, they will be calculated-
486 // when the event gets processed by QGuiApplication.-
487-
488 p.setNormalizedPos(QHighDpi::fromNativePixels(point->normalPosition, window));-
489 p.setVelocity(QHighDpi::fromNativePixels(point->velocity, window));-
490 p.setFlags(point->flags);-
491 p.setRawScreenPositions(QHighDpi::fromNativePixels(point->rawPositions, window));-
492-
493 touchPoints.append(p);-
494 ++point;-
495 }
never executed: end of block
0
496-
497 // Determine the event type based on the combined point states.-
498 if (type) {
typeDescription
TRUEnever evaluated
FALSEnever evaluated
0
499 *type = QEvent::TouchUpdate;-
500 if (states == Qt::TouchPointPressed)
states == Qt::...chPointPressedDescription
TRUEnever evaluated
FALSEnever evaluated
0
501 *type = QEvent::TouchBegin;
never executed: *type = QEvent::TouchBegin;
0
502 else if (states == Qt::TouchPointReleased)
states == Qt::...hPointReleasedDescription
TRUEnever evaluated
FALSEnever evaluated
0
503 *type = QEvent::TouchEnd;
never executed: *type = QEvent::TouchEnd;
0
504 }
never executed: end of block
0
505-
506 return touchPoints;
never executed: return touchPoints;
0
507}-
508-
509QList<QWindowSystemInterface::TouchPoint>-
510 QWindowSystemInterfacePrivate::toNativeTouchPoints(const QList<QTouchEvent::TouchPoint>& pointList,-
511 const QWindow *window)-
512{-
513 QList<QWindowSystemInterface::TouchPoint> newList;-
514 newList.reserve(pointList.size());-
515 for (const QTouchEvent::TouchPoint &pt : pointList) {-
516 QWindowSystemInterface::TouchPoint p;-
517 p.id = pt.id();-
518 p.flags = pt.flags();-
519 p.normalPosition = QHighDpi::toNativeLocalPosition(pt.normalizedPos(), window);-
520 p.area = QHighDpi::toNativePixels(pt.screenRect(), window);-
521 p.pressure = pt.pressure();-
522 p.state = pt.state();-
523 p.velocity = pt.velocity();-
524 p.rawPositions = pt.rawScreenPositions();-
525 newList.append(p);-
526 }
never executed: end of block
0
527 return newList;
never executed: return newList;
0
528}-
529-
530void QWindowSystemInterface::handleTouchEvent(QWindow *tlw, ulong timestamp, QTouchDevice *device,-
531 const QList<TouchPoint> &points, Qt::KeyboardModifiers mods)-
532{-
533 if (!points.size()) // Touch events must have at least one point
!points.size()Description
TRUEnever evaluated
FALSEnever evaluated
0
534 return;
never executed: return;
0
535-
536 if (!QTouchDevicePrivate::isRegistered(device)) // Disallow passing bogus, non-registered devices.
!QTouchDeviceP...stered(device)Description
TRUEnever evaluated
FALSEnever evaluated
0
537 return;
never executed: return;
0
538-
539 QEvent::Type type;-
540 QList<QTouchEvent::TouchPoint> touchPoints = QWindowSystemInterfacePrivate::fromNativeTouchPoints(points, tlw, &type);-
541-
542 QWindowSystemInterfacePrivate::TouchEvent *e =-
543 new QWindowSystemInterfacePrivate::TouchEvent(tlw, timestamp, type, device, touchPoints, mods);-
544 QWindowSystemInterfacePrivate::handleWindowSystemEvent(e);-
545}
never executed: end of block
0
546-
547void QWindowSystemInterface::handleTouchCancelEvent(QWindow *w, QTouchDevice *device,-
548 Qt::KeyboardModifiers mods)-
549{-
550 unsigned long time = QWindowSystemInterfacePrivate::eventTime.elapsed();-
551 handleTouchCancelEvent(w, time, device, mods);-
552}
never executed: end of block
0
553-
554void QWindowSystemInterface::handleTouchCancelEvent(QWindow *w, ulong timestamp, QTouchDevice *device,-
555 Qt::KeyboardModifiers mods)-
556{-
557 QWindowSystemInterfacePrivate::TouchEvent *e =-
558 new QWindowSystemInterfacePrivate::TouchEvent(w, timestamp, QEvent::TouchCancel, device,-
559 QList<QTouchEvent::TouchPoint>(), mods);-
560 QWindowSystemInterfacePrivate::handleWindowSystemEvent(e);-
561}
never executed: end of block
0
562-
563void QWindowSystemInterface::handleScreenOrientationChange(QScreen *screen, Qt::ScreenOrientation orientation)-
564{-
565 QWindowSystemInterfacePrivate::ScreenOrientationEvent *e =-
566 new QWindowSystemInterfacePrivate::ScreenOrientationEvent(screen, orientation);-
567 QWindowSystemInterfacePrivate::handleWindowSystemEvent(e);-
568}
never executed: end of block
0
569-
570void QWindowSystemInterface::handleScreenGeometryChange(QScreen *screen, const QRect &geometry, const QRect &availableGeometry)-
571{-
572 QWindowSystemInterfacePrivate::ScreenGeometryEvent *e =-
573 new QWindowSystemInterfacePrivate::ScreenGeometryEvent(screen, QHighDpi::fromNativeScreenGeometry(geometry, screen), QHighDpi::fromNative(availableGeometry, screen, geometry.topLeft()));-
574 QWindowSystemInterfacePrivate::handleWindowSystemEvent(e);-
575}
never executed: end of block
0
576-
577void QWindowSystemInterface::handleScreenLogicalDotsPerInchChange(QScreen *screen, qreal dpiX, qreal dpiY)-
578{-
579 QWindowSystemInterfacePrivate::ScreenLogicalDotsPerInchEvent *e =-
580 new QWindowSystemInterfacePrivate::ScreenLogicalDotsPerInchEvent(screen, dpiX, dpiY); // ### tja-
581 QWindowSystemInterfacePrivate::handleWindowSystemEvent(e);-
582}
never executed: end of block
0
583-
584void QWindowSystemInterface::handleScreenRefreshRateChange(QScreen *screen, qreal newRefreshRate)-
585{-
586 QWindowSystemInterfacePrivate::ScreenRefreshRateEvent *e =-
587 new QWindowSystemInterfacePrivate::ScreenRefreshRateEvent(screen, newRefreshRate);-
588 QWindowSystemInterfacePrivate::handleWindowSystemEvent(e);-
589}
never executed: end of block
0
590-
591void QWindowSystemInterface::handleThemeChange(QWindow *tlw)-
592{-
593 QWindowSystemInterfacePrivate::ThemeChangeEvent *e = new QWindowSystemInterfacePrivate::ThemeChangeEvent(tlw);-
594 QWindowSystemInterfacePrivate::handleWindowSystemEvent(e);-
595}
never executed: end of block
0
596-
597void QWindowSystemInterface::handleExposeEvent(QWindow *tlw, const QRegion &region)-
598{-
599 QWindowSystemInterfacePrivate::ExposeEvent *e =-
600 new QWindowSystemInterfacePrivate::ExposeEvent(tlw, QHighDpi::fromNativeLocalExposedRegion(region, tlw));-
601 QWindowSystemInterfacePrivate::handleWindowSystemEvent(e);-
602}
never executed: end of block
0
603-
604void QWindowSystemInterface::deferredFlushWindowSystemEvents(QEventLoop::ProcessEventsFlags flags)-
605{-
606 Q_ASSERT(QThread::currentThread() == QGuiApplication::instance()->thread());-
607-
608 QMutexLocker locker(&QWindowSystemInterfacePrivate::flushEventMutex);-
609 sendWindowSystemEvents(flags);-
610 QWindowSystemInterfacePrivate::eventsFlushed.wakeOne();-
611}
never executed: end of block
0
612-
613/*!-
614 Make Qt Gui process all events on the event queue immediately. Return the-
615 accepted state for the last event on the queue.-
616*/-
617bool QWindowSystemInterface::flushWindowSystemEvents(QEventLoop::ProcessEventsFlags flags)-
618{-
619 const int count = QWindowSystemInterfacePrivate::windowSystemEventQueue.count();-
620 if (!count)
!countDescription
TRUEnever evaluated
FALSEnever evaluated
0
621 return false;
never executed: return false;
0
622 if (!QGuiApplication::instance()) {
!QGuiApplication::instance()Description
TRUEnever evaluated
FALSEnever evaluated
0
623 qWarning().nospace()-
624 << "QWindowSystemInterface::flushWindowSystemEvents() invoked after "-
625 "QGuiApplication destruction, discarding " << count << " events.";-
626 QWindowSystemInterfacePrivate::windowSystemEventQueue.clear();-
627 return false;
never executed: return false;
0
628 }-
629 if (QThread::currentThread() != QGuiApplication::instance()->thread()) {
QThread::curre...ce()->thread()Description
TRUEnever evaluated
FALSEnever evaluated
0
630 // Post a FlushEvents event which will trigger a call back to-
631 // deferredFlushWindowSystemEvents from the Gui thread.-
632 QMutexLocker locker(&QWindowSystemInterfacePrivate::flushEventMutex);-
633 QWindowSystemInterfacePrivate::FlushEventsEvent *e = new QWindowSystemInterfacePrivate::FlushEventsEvent(flags);-
634 QWindowSystemInterfacePrivate::postWindowSystemEvent(e);-
635 QWindowSystemInterfacePrivate::eventsFlushed.wait(&QWindowSystemInterfacePrivate::flushEventMutex);-
636 } else {
never executed: end of block
0
637 sendWindowSystemEvents(flags);-
638 }
never executed: end of block
0
639 return QWindowSystemInterfacePrivate::eventAccepted.load() > 0;
never executed: return QWindowSystemInterfacePrivate::eventAccepted.load() > 0;
0
640}-
641-
642bool QWindowSystemInterface::sendWindowSystemEvents(QEventLoop::ProcessEventsFlags flags)-
643{-
644 int nevents = 0;-
645-
646 while (QWindowSystemInterfacePrivate::windowSystemEventsQueued()) {
QWindowSystemI...EventsQueued()Description
TRUEnever evaluated
FALSEnever evaluated
0
647 QWindowSystemInterfacePrivate::WindowSystemEvent *event =-
648 (flags & QEventLoop::ExcludeUserInputEvents) ?
(flags & QEven...erInputEvents)Description
TRUEnever evaluated
FALSEnever evaluated
0
649 QWindowSystemInterfacePrivate::getNonUserInputWindowSystemEvent() :-
650 QWindowSystemInterfacePrivate::getWindowSystemEvent();-
651 if (!event)
!eventDescription
TRUEnever evaluated
FALSEnever evaluated
0
652 break;
never executed: break;
0
653-
654 if (QWindowSystemInterfacePrivate::eventHandler) {
QWindowSystemI...::eventHandlerDescription
TRUEnever evaluated
FALSEnever evaluated
0
655 if (QWindowSystemInterfacePrivate::eventHandler->sendEvent(event))
QWindowSystemI...ndEvent(event)Description
TRUEnever evaluated
FALSEnever evaluated
0
656 nevents++;
never executed: nevents++;
0
657 } else {
never executed: end of block
0
658 nevents++;-
659 QGuiApplicationPrivate::processWindowSystemEvent(event);-
660 }
never executed: end of block
0
661-
662 // Record the accepted state for the processed event-
663 // (excluding flush events). This state can then be-
664 // returned by flushWindowSystemEvents().-
665 if (event->type != QWindowSystemInterfacePrivate::FlushEvents)
event->type !=...e::FlushEventsDescription
TRUEnever evaluated
FALSEnever evaluated
0
666 QWindowSystemInterfacePrivate::eventAccepted.store(event->eventAccepted);
never executed: QWindowSystemInterfacePrivate::eventAccepted.store(event->eventAccepted);
0
667-
668 delete event;-
669 }
never executed: end of block
0
670-
671 return (nevents > 0);
never executed: return (nevents > 0);
0
672}-
673-
674void QWindowSystemInterfacePrivate::installWindowSystemEventHandler(QWindowSystemEventHandler *handler)-
675{-
676 if (!eventHandler)
!eventHandlerDescription
TRUEnever evaluated
FALSEnever evaluated
0
677 eventHandler = handler;
never executed: eventHandler = handler;
0
678}
never executed: end of block
0
679-
680void QWindowSystemInterfacePrivate::removeWindowSystemEventhandler(QWindowSystemEventHandler *handler)-
681{-
682 if (eventHandler == handler)
eventHandler == handlerDescription
TRUEnever evaluated
FALSEnever evaluated
0
683 eventHandler = 0;
never executed: eventHandler = 0;
0
684}
never executed: end of block
0
685-
686void QWindowSystemInterface::setSynchronousWindowSystemEvents(bool enable)-
687{-
688 QWindowSystemInterfacePrivate::synchronousWindowSystemEvents = enable;-
689}
never executed: end of block
0
690-
691int QWindowSystemInterface::windowSystemEventsQueued()-
692{-
693 return QWindowSystemInterfacePrivate::windowSystemEventsQueued();
never executed: return QWindowSystemInterfacePrivate::windowSystemEventsQueued();
0
694}-
695-
696#ifndef QT_NO_DRAGANDDROP-
697QPlatformDragQtResponse QWindowSystemInterface::handleDrag(QWindow *w, const QMimeData *dropData, const QPoint &p, Qt::DropActions supportedActions)-
698{-
699 return QGuiApplicationPrivate::processDrag(w, dropData, QHighDpi::fromNativeLocalPosition(p, w) ,supportedActions);
never executed: return QGuiApplicationPrivate::processDrag(w, dropData, QHighDpi::fromNativeLocalPosition(p, w) ,supportedActions);
0
700}-
701-
702QPlatformDropQtResponse QWindowSystemInterface::handleDrop(QWindow *w, const QMimeData *dropData, const QPoint &p, Qt::DropActions supportedActions)-
703{-
704 return QGuiApplicationPrivate::processDrop(w, dropData, QHighDpi::fromNativeLocalPosition(p, w),supportedActions);
never executed: return QGuiApplicationPrivate::processDrop(w, dropData, QHighDpi::fromNativeLocalPosition(p, w),supportedActions);
0
705}-
706#endif // QT_NO_DRAGANDDROP-
707-
708/*!-
709 \fn static QWindowSystemInterface::handleNativeEvent(QWindow *window, const QByteArray &eventType, void *message, long *result)-
710 \brief Passes a native event identified by \a eventType to the \a window.-
711-
712 \note This function can only be called from the GUI thread.-
713*/-
714-
715bool QWindowSystemInterface::handleNativeEvent(QWindow *window, const QByteArray &eventType, void *message, long *result)-
716{-
717 return QGuiApplicationPrivate::processNativeEvent(window, eventType, message, result);
never executed: return QGuiApplicationPrivate::processNativeEvent(window, eventType, message, result);
0
718}-
719-
720void QWindowSystemInterface::handleFileOpenEvent(const QString& fileName)-
721{-
722 QWindowSystemInterfacePrivate::FileOpenEvent e(fileName);-
723 QGuiApplicationPrivate::processWindowSystemEvent(&e);-
724}
never executed: end of block
0
725-
726void QWindowSystemInterface::handleFileOpenEvent(const QUrl &url)-
727{-
728 QWindowSystemInterfacePrivate::FileOpenEvent e(url);-
729 QGuiApplicationPrivate::processWindowSystemEvent(&e);-
730}
never executed: end of block
0
731-
732void QWindowSystemInterface::handleTabletEvent(QWindow *w, ulong timestamp, const QPointF &local, const QPointF &global,-
733 int device, int pointerType, Qt::MouseButtons buttons, qreal pressure, int xTilt, int yTilt,-
734 qreal tangentialPressure, qreal rotation, int z, qint64 uid,-
735 Qt::KeyboardModifiers modifiers)-
736{-
737 QWindowSystemInterfacePrivate::TabletEvent *e =-
738 new QWindowSystemInterfacePrivate::TabletEvent(w,timestamp,-
739 QHighDpi::fromNativeLocalPosition(local, w),-
740 QHighDpi::fromNativePixels(global, w),-
741 device, pointerType, buttons, pressure,-
742 xTilt, yTilt, tangentialPressure, rotation, z, uid, modifiers);-
743 QWindowSystemInterfacePrivate::handleWindowSystemEvent(e);-
744}
never executed: end of block
0
745-
746void QWindowSystemInterface::handleTabletEvent(QWindow *w, const QPointF &local, const QPointF &global,-
747 int device, int pointerType, Qt::MouseButtons buttons, qreal pressure, int xTilt, int yTilt,-
748 qreal tangentialPressure, qreal rotation, int z, qint64 uid,-
749 Qt::KeyboardModifiers modifiers)-
750{-
751 ulong time = QWindowSystemInterfacePrivate::eventTime.elapsed();-
752 handleTabletEvent(w, time, local, global, device, pointerType, buttons, pressure,-
753 xTilt, yTilt, tangentialPressure, rotation, z, uid, modifiers);-
754}
never executed: end of block
0
755-
756void QWindowSystemInterface::handleTabletEvent(QWindow *w, ulong timestamp, bool down, const QPointF &local, const QPointF &global,-
757 int device, int pointerType, qreal pressure, int xTilt, int yTilt,-
758 qreal tangentialPressure, qreal rotation, int z, qint64 uid,-
759 Qt::KeyboardModifiers modifiers)-
760{-
761 handleTabletEvent(w, timestamp, local, global, device, pointerType, (down ? Qt::LeftButton : Qt::NoButton), pressure,-
762 xTilt, yTilt, tangentialPressure, rotation, z, uid, modifiers);-
763}
never executed: end of block
0
764-
765void QWindowSystemInterface::handleTabletEvent(QWindow *w, bool down, const QPointF &local, const QPointF &global,-
766 int device, int pointerType, qreal pressure, int xTilt, int yTilt,-
767 qreal tangentialPressure, qreal rotation, int z, qint64 uid,-
768 Qt::KeyboardModifiers modifiers)-
769{-
770 handleTabletEvent(w, local, global, device, pointerType, (down ? Qt::LeftButton : Qt::NoButton), pressure,-
771 xTilt, yTilt, tangentialPressure, rotation, z, uid, modifiers);-
772}
never executed: end of block
0
773-
774void QWindowSystemInterface::handleTabletEnterProximityEvent(ulong timestamp, int device, int pointerType, qint64 uid)-
775{-
776 QWindowSystemInterfacePrivate::TabletEnterProximityEvent *e =-
777 new QWindowSystemInterfacePrivate::TabletEnterProximityEvent(timestamp, device, pointerType, uid);-
778 QWindowSystemInterfacePrivate::handleWindowSystemEvent(e);-
779}
never executed: end of block
0
780-
781void QWindowSystemInterface::handleTabletEnterProximityEvent(int device, int pointerType, qint64 uid)-
782{-
783 ulong time = QWindowSystemInterfacePrivate::eventTime.elapsed();-
784 handleTabletEnterProximityEvent(time, device, pointerType, uid);-
785}
never executed: end of block
0
786-
787void QWindowSystemInterface::handleTabletLeaveProximityEvent(ulong timestamp, int device, int pointerType, qint64 uid)-
788{-
789 QWindowSystemInterfacePrivate::TabletLeaveProximityEvent *e =-
790 new QWindowSystemInterfacePrivate::TabletLeaveProximityEvent(timestamp, device, pointerType, uid);-
791 QWindowSystemInterfacePrivate::handleWindowSystemEvent(e);-
792}
never executed: end of block
0
793-
794void QWindowSystemInterface::handleTabletLeaveProximityEvent(int device, int pointerType, qint64 uid)-
795{-
796 ulong time = QWindowSystemInterfacePrivate::eventTime.elapsed();-
797 handleTabletLeaveProximityEvent(time, device, pointerType, uid);-
798}
never executed: end of block
0
799-
800#ifndef QT_NO_GESTURES-
801void QWindowSystemInterface::handleGestureEvent(QWindow *window, ulong timestamp, Qt::NativeGestureType type,-
802 QPointF &local, QPointF &global)-
803{-
804 QWindowSystemInterfacePrivate::GestureEvent *e =-
805 new QWindowSystemInterfacePrivate::GestureEvent(window, timestamp, type, local, global);-
806 QWindowSystemInterfacePrivate::handleWindowSystemEvent(e);-
807}
never executed: end of block
0
808-
809void QWindowSystemInterface::handleGestureEventWithRealValue(QWindow *window, ulong timestamp, Qt::NativeGestureType type,-
810 qreal value, QPointF &local, QPointF &global)-
811{-
812 QWindowSystemInterfacePrivate::GestureEvent *e =-
813 new QWindowSystemInterfacePrivate::GestureEvent(window, timestamp, type, local, global);-
814 e->realValue = value;-
815 QWindowSystemInterfacePrivate::handleWindowSystemEvent(e);-
816}
never executed: end of block
0
817-
818void QWindowSystemInterface::handleGestureEventWithSequenceIdAndValue(QWindow *window, ulong timestamp, Qt::NativeGestureType type,-
819 ulong sequenceId, quint64 value, QPointF &local, QPointF &global)-
820{-
821 QWindowSystemInterfacePrivate::GestureEvent *e =-
822 new QWindowSystemInterfacePrivate::GestureEvent(window, timestamp, type, local, global);-
823 e->sequenceId = sequenceId;-
824 e->intValue = value;-
825 QWindowSystemInterfacePrivate::handleWindowSystemEvent(e);-
826}
never executed: end of block
0
827#endif // QT_NO_GESTURES-
828-
829void QWindowSystemInterface::handlePlatformPanelEvent(QWindow *w)-
830{-
831 QWindowSystemInterfacePrivate::PlatformPanelEvent *e =-
832 new QWindowSystemInterfacePrivate::PlatformPanelEvent(w);-
833 QWindowSystemInterfacePrivate::handleWindowSystemEvent(e);-
834}
never executed: end of block
0
835-
836#ifndef QT_NO_CONTEXTMENU-
837void QWindowSystemInterface::handleContextMenuEvent(QWindow *w, bool mouseTriggered,-
838 const QPoint &pos, const QPoint &globalPos,-
839 Qt::KeyboardModifiers modifiers)-
840{-
841 QWindowSystemInterfacePrivate::ContextMenuEvent *e =-
842 new QWindowSystemInterfacePrivate::ContextMenuEvent(w, mouseTriggered, pos,-
843 globalPos, modifiers);-
844 QWindowSystemInterfacePrivate::handleWindowSystemEvent(e);-
845}
never executed: end of block
0
846#endif-
847-
848#ifndef QT_NO_WHATSTHIS-
849void QWindowSystemInterface::handleEnterWhatsThisEvent()-
850{-
851 QWindowSystemInterfacePrivate::WindowSystemEvent *e =-
852 new QWindowSystemInterfacePrivate::WindowSystemEvent(QWindowSystemInterfacePrivate::EnterWhatsThisMode);-
853 QWindowSystemInterfacePrivate::handleWindowSystemEvent(e);-
854}
never executed: end of block
0
855#endif-
856-
857#ifndef QT_NO_DEBUG_STREAM-
858Q_GUI_EXPORT QDebug operator<<(QDebug dbg, const QWindowSystemInterface::TouchPoint &p)-
859{-
860 QDebugStateSaver saver(dbg);-
861 dbg.nospace() << "TouchPoint(" << p.id << " @" << p.area << " normalized " << p.normalPosition-
862 << " press " << p.pressure << " vel " << p.velocity << " state " << (int)p.state;-
863 return dbg;
never executed: return dbg;
0
864}-
865#endif-
866-
867// The following functions are used by testlib, and need to be synchronous to avoid-
868// race conditions with plugins delivering native events from secondary threads.-
869-
870Q_GUI_EXPORT void qt_handleMouseEvent(QWindow *w, const QPointF &local, const QPointF &global, Qt::MouseButtons b, Qt::KeyboardModifiers mods, int timestamp)-
871{-
872 bool wasSynchronous = QWindowSystemInterfacePrivate::synchronousWindowSystemEvents;-
873 QWindowSystemInterface::setSynchronousWindowSystemEvents(true);-
874 const qreal factor = QHighDpiScaling::factor(w);-
875 QWindowSystemInterface::handleMouseEvent(w, timestamp, local * factor,-
876 global * factor, b, mods);-
877 QWindowSystemInterface::setSynchronousWindowSystemEvents(wasSynchronous);-
878}
never executed: end of block
0
879-
880Q_GUI_EXPORT void qt_handleKeyEvent(QWindow *w, QEvent::Type t, int k, Qt::KeyboardModifiers mods, const QString & text = QString(), bool autorep = false, ushort count = 1)-
881{-
882 bool wasSynchronous = QWindowSystemInterfacePrivate::synchronousWindowSystemEvents;-
883 QWindowSystemInterface::setSynchronousWindowSystemEvents(true);-
884 QWindowSystemInterface::handleKeyEvent(w, t, k, mods, text, autorep, count);-
885 QWindowSystemInterface::setSynchronousWindowSystemEvents(wasSynchronous);-
886}
never executed: end of block
0
887-
888Q_GUI_EXPORT bool qt_sendShortcutOverrideEvent(QObject *o, ulong timestamp, int k, Qt::KeyboardModifiers mods, const QString &text = QString(), bool autorep = false, ushort count = 1)-
889{-
890#ifndef QT_NO_SHORTCUT-
891-
892 // FIXME: This method should not allow targeting a specific object, but should-
893 // instead forward the event to a window, which then takes care of normal event-
894 // propagation. We need to fix a lot of tests before we can refactor this (the-
895 // window needs to be exposed and active and have a focus object), so we leave-
896 // it as is for now. See QTBUG-48577.-
897-
898 QGuiApplicationPrivate::modifier_buttons = mods;-
899-
900 QKeyEvent qevent(QEvent::ShortcutOverride, k, mods, text, autorep, count);-
901 qevent.setTimestamp(timestamp);-
902-
903 QShortcutMap &shortcutMap = QGuiApplicationPrivate::instance()->shortcutMap;-
904 if (shortcutMap.state() == QKeySequence::NoMatch) {
shortcutMap.st...uence::NoMatchDescription
TRUEnever evaluated
FALSEnever evaluated
0
905 // Try sending as QKeyEvent::ShortcutOverride first-
906 QCoreApplication::sendEvent(o, &qevent);-
907 if (qevent.isAccepted())
qevent.isAccepted()Description
TRUEnever evaluated
FALSEnever evaluated
0
908 return false;
never executed: return false;
0
909 }
never executed: end of block
0
910-
911 // Then as QShortcutEvent-
912 return shortcutMap.tryShortcut(&qevent);
never executed: return shortcutMap.tryShortcut(&qevent);
0
913#else-
914 Q_UNUSED(o)-
915 Q_UNUSED(timestamp)-
916 Q_UNUSED(k)-
917 Q_UNUSED(mods)-
918 Q_UNUSED(text)-
919 Q_UNUSED(autorep)-
920 Q_UNUSED(count)-
921 return false;-
922#endif-
923}-
924-
925Q_GUI_EXPORT void qt_handleTouchEvent(QWindow *w, QTouchDevice *device,-
926 const QList<QTouchEvent::TouchPoint> &points,-
927 Qt::KeyboardModifiers mods = Qt::NoModifier)-
928{-
929 bool wasSynchronous = QWindowSystemInterfacePrivate::synchronousWindowSystemEvents;-
930 QWindowSystemInterface::setSynchronousWindowSystemEvents(true);-
931 QWindowSystemInterface::handleTouchEvent(w, device,-
932 QWindowSystemInterfacePrivate::toNativeTouchPoints(points, w), mods);-
933 QWindowSystemInterface::setSynchronousWindowSystemEvents(wasSynchronous);-
934}
never executed: end of block
0
935-
936QWindowSystemEventHandler::~QWindowSystemEventHandler()-
937{-
938 QWindowSystemInterfacePrivate::removeWindowSystemEventhandler(this);-
939}
never executed: end of block
0
940-
941bool QWindowSystemEventHandler::sendEvent(QWindowSystemInterfacePrivate::WindowSystemEvent *e)-
942{-
943 QGuiApplicationPrivate::processWindowSystemEvent(e);-
944 return true;
never executed: return true;
0
945}-
946-
947QWindowSystemInterfacePrivate::WheelEvent::WheelEvent(QWindow *w, ulong time, const QPointF &local, const QPointF &global, QPoint pixelD,-
948 QPoint angleD, int qt4D, Qt::Orientation qt4O, Qt::KeyboardModifiers mods, Qt::ScrollPhase phase, Qt::MouseEventSource src, bool inverted)-
949 : InputEvent(w, time, Wheel, mods), pixelDelta(pixelD), angleDelta(angleD), qt4Delta(qt4D),-
950 qt4Orientation(qt4O), localPos(local), globalPos(global), phase(phase), source(src), inverted(inverted)-
951{-
952}
never executed: end of block
0
953-
954void QWindowSystemInterfacePrivate::TabletEvent::setPlatformSynthesizesMouse(bool v)-
955{-
956 platformSynthesizesMouse = v;-
957}
never executed: end of block
0
958-
959QT_END_NAMESPACE-
Source codeSwitch to Preprocessed file

Generated by Squish Coco Non-Commercial 4.3.0-BETA-master-30-08-2018-4cb69e9