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

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