From 037238022f3a91a5619709b2c7cf4b38cd4d294b Mon Sep 17 00:00:00 2001 From: Girish Ramakrishnan Date: Tue, 19 Jun 2012 13:21:35 -0700 Subject: Make QWindowSystemInterface part of QPA API MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit As discussed on mailing list and QtCS 2012. Any file starting with qwindowsystem is now marked as QPA API. This change drops _qpa from the filenames and adds gui-private where required for the code to compile. This change is backward compatible otherwise and compat headers are created for the old inclusion headers. Change-Id: I72ea0f394dee74f46e614fcf11ab5500ac9fef2a Reviewed-by: Samuel Rødal --- src/gui/kernel/kernel.pri | 4 +- src/gui/kernel/qguiapplication_p.h | 4 +- src/gui/kernel/qwindowsysteminterface.h | 187 ++++++++++++++ src/gui/kernel/qwindowsysteminterface_p.h | 341 ++++++++++++++++++++++++++ src/gui/kernel/qwindowsysteminterface_qpa.cpp | 4 +- src/gui/kernel/qwindowsysteminterface_qpa.h | 178 -------------- src/gui/kernel/qwindowsysteminterface_qpa_p.h | 341 -------------------------- src/testlib/qtestkeyboard.h | 2 +- src/testlib/qtestmouse.h | 2 +- src/testlib/qtesttouch.h | 2 +- 10 files changed, 537 insertions(+), 528 deletions(-) create mode 100644 src/gui/kernel/qwindowsysteminterface.h create mode 100644 src/gui/kernel/qwindowsysteminterface_p.h delete mode 100644 src/gui/kernel/qwindowsysteminterface_qpa.h delete mode 100644 src/gui/kernel/qwindowsysteminterface_qpa_p.h (limited to 'src') diff --git a/src/gui/kernel/kernel.pri b/src/gui/kernel/kernel.pri index 9825633358..efa79b5cc0 100644 --- a/src/gui/kernel/kernel.pri +++ b/src/gui/kernel/kernel.pri @@ -8,8 +8,8 @@ KERNEL_P= kernel HEADERS += \ kernel/qgenericpluginfactory_qpa.h \ kernel/qgenericplugin_qpa.h \ - kernel/qwindowsysteminterface_qpa.h \ - kernel/qwindowsysteminterface_qpa_p.h \ + kernel/qwindowsysteminterface.h \ + kernel/qwindowsysteminterface_p.h \ kernel/qplatformintegration.h \ kernel/qplatformdrag.h \ kernel/qplatformscreen.h \ diff --git a/src/gui/kernel/qguiapplication_p.h b/src/gui/kernel/qguiapplication_p.h index a9fe118f2b..857dc5390e 100644 --- a/src/gui/kernel/qguiapplication_p.h +++ b/src/gui/kernel/qguiapplication_p.h @@ -49,8 +49,8 @@ #include -#include -#include "private/qwindowsysteminterface_qpa_p.h" +#include +#include #include "private/qshortcutmap_p.h" #include diff --git a/src/gui/kernel/qwindowsysteminterface.h b/src/gui/kernel/qwindowsysteminterface.h new file mode 100644 index 0000000000..0382ac6dbf --- /dev/null +++ b/src/gui/kernel/qwindowsysteminterface.h @@ -0,0 +1,187 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +#ifndef QWINDOWSYSTEMINTERFACE_H +#define QWINDOWSYSTEMINTERFACE_H + +// +// W A R N I N G +// ------------- +// +// This file is part of the QPA API and is not meant to be used +// in applications. Usage of this API may make your code +// source and binary incompatible with future versions of Qt. +// + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +class QMimeData; +class QTouchDevice; +class QPlatformDragQtResponse; +class QPlatformDropQtResponse; + + +class Q_GUI_EXPORT QWindowSystemInterface +{ +public: + static void handleMouseEvent(QWindow *w, const QPointF & local, const QPointF & global, Qt::MouseButtons b, Qt::KeyboardModifiers mods = Qt::NoModifier); + static void handleMouseEvent(QWindow *w, ulong timestamp, const QPointF & local, const QPointF & global, Qt::MouseButtons b, Qt::KeyboardModifiers mods = Qt::NoModifier); + static void handleFrameStrutMouseEvent(QWindow *w, const QPointF & local, const QPointF & global, Qt::MouseButtons b, Qt::KeyboardModifiers mods = Qt::NoModifier); + static void handleFrameStrutMouseEvent(QWindow *w, ulong timestamp, const QPointF & local, const QPointF & global, Qt::MouseButtons b, Qt::KeyboardModifiers mods = Qt::NoModifier); + + static bool tryHandleSynchronousShortcutEvent(QWindow *w, int k, Qt::KeyboardModifiers mods, + const QString & text = QString(), bool autorep = false, ushort count = 1); + static bool tryHandleSynchronousShortcutEvent(QWindow *w, ulong timestamp, int k, Qt::KeyboardModifiers mods, + const QString & text = QString(), bool autorep = false, ushort count = 1); + + static bool tryHandleSynchronousExtendedShortcutEvent(QWindow *w, int k, Qt::KeyboardModifiers mods, + quint32 nativeScanCode, quint32 nativeVirtualKey, quint32 nativeModifiers, + const QString & text = QString(), bool autorep = false, ushort count = 1); + static bool tryHandleSynchronousExtendedShortcutEvent(QWindow *w, ulong timestamp, int k, Qt::KeyboardModifiers mods, + quint32 nativeScanCode, quint32 nativeVirtualKey, quint32 nativeModifiers, + const QString & text = QString(), bool autorep = false, ushort count = 1); + + static void handleKeyEvent(QWindow *w, QEvent::Type t, int k, Qt::KeyboardModifiers mods, const QString & text = QString(), bool autorep = false, ushort count = 1); + static void handleKeyEvent(QWindow *w, ulong timestamp, QEvent::Type t, int k, Qt::KeyboardModifiers mods, const QString & text = QString(), bool autorep = false, ushort count = 1); + + static void handleExtendedKeyEvent(QWindow *w, QEvent::Type type, int key, Qt::KeyboardModifiers modifiers, + quint32 nativeScanCode, quint32 nativeVirtualKey, + quint32 nativeModifiers, + const QString& text = QString(), bool autorep = false, + ushort count = 1); + static void handleExtendedKeyEvent(QWindow *w, ulong timestamp, QEvent::Type type, int key, Qt::KeyboardModifiers modifiers, + quint32 nativeScanCode, quint32 nativeVirtualKey, + quint32 nativeModifiers, + const QString& text = QString(), bool autorep = false, + ushort count = 1); + static void handleWheelEvent(QWindow *w, const QPointF & local, const QPointF & global, QPoint pixelDelta, QPoint angleDelta, Qt::KeyboardModifiers mods = Qt::NoModifier); + static void handleWheelEvent(QWindow *w, ulong timestamp, const QPointF & local, const QPointF & global, QPoint pixelDelta, QPoint angleDelta, Qt::KeyboardModifiers mods = Qt::NoModifier); + + // Wheel event compatibility functions. Will be removed: do not use. + static void handleWheelEvent(QWindow *w, const QPointF & local, const QPointF & global, int d, Qt::Orientation o, Qt::KeyboardModifiers mods = Qt::NoModifier); + static void handleWheelEvent(QWindow *w, ulong timestamp, const QPointF & local, const QPointF & global, int d, Qt::Orientation o, Qt::KeyboardModifiers mods = Qt::NoModifier); + + struct TouchPoint { + TouchPoint() : id(0), pressure(0), state(Qt::TouchPointStationary), flags(0) { } + int id; // for application use + QPointF normalPosition; // touch device coordinates, (0 to 1, 0 to 1) + QRectF area; // the touched area, centered at position in screen coordinates + qreal pressure; // 0 to 1 + Qt::TouchPointState state; //Qt::TouchPoint{Pressed|Moved|Stationary|Released} + QVector2D velocity; // in screen coordinate system, pixels / seconds + QTouchEvent::TouchPoint::InfoFlags flags; + QVector rawPositions; // in screen coordinates + }; + + static void registerTouchDevice(QTouchDevice *device); + static void handleTouchEvent(QWindow *w, QTouchDevice *device, + const QList &points, Qt::KeyboardModifiers mods = Qt::NoModifier); + static void handleTouchEvent(QWindow *w, ulong timestamp, QTouchDevice *device, + const QList &points, Qt::KeyboardModifiers mods = Qt::NoModifier); + static void handleTouchCancelEvent(QWindow *w, QTouchDevice *device, Qt::KeyboardModifiers mods = Qt::NoModifier); + static void handleTouchCancelEvent(QWindow *w, ulong timestamp, QTouchDevice *device, Qt::KeyboardModifiers mods = Qt::NoModifier); + + static void handleGeometryChange(QWindow *w, const QRect &newRect); + static void handleSynchronousGeometryChange(QWindow *w, const QRect &newRect); + static void handleCloseEvent(QWindow *w); + static void handleSynchronousCloseEvent(QWindow *w); + static void handleEnterEvent(QWindow *w); + static void handleLeaveEvent(QWindow *w); + static void handleWindowActivated(QWindow *w); + static void handleWindowStateChanged(QWindow *w, Qt::WindowState newState); + + static void handleExposeEvent(QWindow *tlw, const QRegion ®ion); + static void handleSynchronousExposeEvent(QWindow *tlw, const QRegion ®ion); + +#ifndef QT_NO_DRAGANDDROP + // Drag and drop. These events are sent immediately. + static QPlatformDragQtResponse handleDrag(QWindow *w, const QMimeData *dropData, const QPoint &p, Qt::DropActions supportedActions); + static QPlatformDropQtResponse handleDrop(QWindow *w, const QMimeData *dropData, const QPoint &p, Qt::DropActions supportedActions); +#endif + + static bool handleNativeEvent(QWindow *window, const QByteArray &eventType, void *message, long *result); + + // Changes to the screen + static void handleScreenOrientationChange(QScreen *screen, Qt::ScreenOrientation newOrientation); + static void handleScreenGeometryChange(QScreen *screen, const QRect &newGeometry); + static void handleScreenAvailableGeometryChange(QScreen *screen, const QRect &newAvailableGeometry); + static void handleScreenLogicalDotsPerInchChange(QScreen *screen, qreal newDpiX, qreal newDpiY); + static void handleScreenRefreshRateChange(QScreen *screen, qreal newRefreshRate); + + static void handleThemeChange(QWindow *tlw); + + static void handleFileOpenEvent(const QString& fileName); + + static void handleTabletEvent(QWindow *w, ulong timestamp, bool down, const QPointF &local, const QPointF &global, + int device, int pointerType, qreal pressure, int xTilt, int yTilt, + qreal tangentialPressure, qreal rotation, int z, qint64 uid, + Qt::KeyboardModifiers modifiers = Qt::NoModifier); + static void handleTabletEvent(QWindow *w, bool down, const QPointF &local, const QPointF &global, + int device, int pointerType, qreal pressure, int xTilt, int yTilt, + qreal tangentialPressure, qreal rotation, int z, qint64 uid, + Qt::KeyboardModifiers modifiers = Qt::NoModifier); + static void handleTabletEnterProximityEvent(ulong timestamp, int device, int pointerType, qint64 uid); + static void handleTabletEnterProximityEvent(int device, int pointerType, qint64 uid); + static void handleTabletLeaveProximityEvent(ulong timestamp, int device, int pointerType, qint64 uid); + static void handleTabletLeaveProximityEvent(int device, int pointerType, qint64 uid); + + + // For event dispatcher implementations + static bool sendWindowSystemEvents(QAbstractEventDispatcher *eventDispatcher, QEventLoop::ProcessEventsFlags flags); + static int windowSystemEventsQueued(); +}; + +QT_END_NAMESPACE +QT_END_HEADER +#endif // QWINDOWSYSTEMINTERFACE_H diff --git a/src/gui/kernel/qwindowsysteminterface_p.h b/src/gui/kernel/qwindowsysteminterface_p.h new file mode 100644 index 0000000000..26f4cd68bb --- /dev/null +++ b/src/gui/kernel/qwindowsysteminterface_p.h @@ -0,0 +1,341 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +#ifndef QWINDOWSYSTEMINTERFACE_P_H +#define QWINDOWSYSTEMINTERFACE_P_H + +#include "qwindowsysteminterface.h" + +#include +#include + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +class QWindowSystemInterfacePrivate { +public: + enum EventType { + Close, + GeometryChange, + Enter, + Leave, + ActivatedWindow, + WindowStateChanged, + Mouse, + FrameStrutMouse, + Wheel, + Key, + Touch, + ScreenOrientation, + ScreenGeometry, + ScreenAvailableGeometry, + ScreenLogicalDotsPerInch, + ScreenRefreshRate, + ThemeChange, + Expose, + FileOpen, + Tablet, + TabletEnterProximity, + TabletLeaveProximity + }; + + class WindowSystemEvent { + public: + explicit WindowSystemEvent(EventType t) + : type(t), synthetic(false) { } + virtual ~WindowSystemEvent() { } + EventType type; + bool synthetic; + }; + + class CloseEvent : public WindowSystemEvent { + public: + explicit CloseEvent(QWindow *w) + : WindowSystemEvent(Close), window(w) { } + QPointer window; + }; + + class GeometryChangeEvent : public WindowSystemEvent { + public: + GeometryChangeEvent(QWindow *tlw, const QRect &newGeometry) + : WindowSystemEvent(GeometryChange), tlw(tlw), newGeometry(newGeometry) + { } + QPointer tlw; + QRect newGeometry; + }; + + class EnterEvent : public WindowSystemEvent { + public: + explicit EnterEvent(QWindow *enter) + : WindowSystemEvent(Enter), enter(enter) + { } + QPointer enter; + }; + + class LeaveEvent : public WindowSystemEvent { + public: + explicit LeaveEvent(QWindow *leave) + : WindowSystemEvent(Leave), leave(leave) + { } + QPointer leave; + }; + + class ActivatedWindowEvent : public WindowSystemEvent { + public: + explicit ActivatedWindowEvent(QWindow *activatedWindow) + : WindowSystemEvent(ActivatedWindow), activated(activatedWindow) + { } + QPointer activated; + }; + + class WindowStateChangedEvent : public WindowSystemEvent { + public: + WindowStateChangedEvent(QWindow *_window, Qt::WindowState _newState) + : WindowSystemEvent(WindowStateChanged), window(_window), newState(_newState) + { } + + QPointer window; + Qt::WindowState newState; + }; + + class UserEvent : public WindowSystemEvent { + public: + UserEvent(QWindow * w, ulong time, EventType t) + : WindowSystemEvent(t), window(w), nullWindow(w == 0), timestamp(time) { } + QPointer window; + bool nullWindow; + unsigned long timestamp; + }; + + class InputEvent: public UserEvent { + public: + InputEvent(QWindow * w, ulong time, EventType t, Qt::KeyboardModifiers mods) + : UserEvent(w, time, t), modifiers(mods) {} + Qt::KeyboardModifiers modifiers; + }; + + class MouseEvent : public InputEvent { + public: + MouseEvent(QWindow * w, ulong time, const QPointF & local, const QPointF & global, + Qt::MouseButtons b, Qt::KeyboardModifiers mods) + : InputEvent(w, time, Mouse, mods), localPos(local), globalPos(global), buttons(b) { } + MouseEvent(QWindow * w, ulong time, EventType t, const QPointF & local, const QPointF & global, + Qt::MouseButtons b, Qt::KeyboardModifiers mods) + : InputEvent(w, time, t, mods), localPos(local), globalPos(global), buttons(b) { } + QPointF localPos; + QPointF globalPos; + Qt::MouseButtons buttons; + }; + + class WheelEvent : public InputEvent { + public: + WheelEvent(QWindow *w, ulong time, const QPointF & local, const QPointF & global, QPoint pixelD, QPoint angleD, int qt4D, Qt::Orientation qt4O, + Qt::KeyboardModifiers mods) + : InputEvent(w, time, Wheel, mods), pixelDelta(pixelD), angleDelta(angleD), qt4Delta(qt4D), qt4Orientation(qt4O), localPos(local), globalPos(global) { } + QPoint pixelDelta; + QPoint angleDelta; + int qt4Delta; + Qt::Orientation qt4Orientation; + QPointF localPos; + QPointF globalPos; + }; + + class KeyEvent : public InputEvent { + public: + KeyEvent(QWindow *w, ulong time, QEvent::Type t, int k, Qt::KeyboardModifiers mods, const QString & text = QString(), bool autorep = false, ushort count = 1) + :InputEvent(w, time, Key, mods), key(k), unicode(text), repeat(autorep), + repeatCount(count), keyType(t), + nativeScanCode(0), nativeVirtualKey(0), nativeModifiers(0) { } + KeyEvent(QWindow *w, ulong time, QEvent::Type t, int k, Qt::KeyboardModifiers mods, + quint32 nativeSC, quint32 nativeVK, quint32 nativeMods, + const QString & text = QString(), bool autorep = false, ushort count = 1) + :InputEvent(w, time, Key, mods), key(k), unicode(text), repeat(autorep), + repeatCount(count), keyType(t), + nativeScanCode(nativeSC), nativeVirtualKey(nativeVK), nativeModifiers(nativeMods) { } + int key; + QString unicode; + bool repeat; + ushort repeatCount; + QEvent::Type keyType; + quint32 nativeScanCode; + quint32 nativeVirtualKey; + quint32 nativeModifiers; + }; + + class TouchEvent : public InputEvent { + public: + TouchEvent(QWindow *w, ulong time, QEvent::Type t, QTouchDevice *dev, + const QList &p, Qt::KeyboardModifiers mods) + :InputEvent(w, time, Touch, mods), device(dev), points(p), touchType(t) { } + QTouchDevice *device; + QList points; + QEvent::Type touchType; + }; + + class ScreenOrientationEvent : public WindowSystemEvent { + public: + ScreenOrientationEvent(QScreen *s, Qt::ScreenOrientation o) + : WindowSystemEvent(ScreenOrientation), screen(s), orientation(o) { } + QPointer screen; + Qt::ScreenOrientation orientation; + }; + + class ScreenGeometryEvent : public WindowSystemEvent { + public: + ScreenGeometryEvent(QScreen *s, const QRect &g) + : WindowSystemEvent(ScreenGeometry), screen(s), geometry(g) { } + QPointer screen; + QRect geometry; + }; + + class ScreenAvailableGeometryEvent : public WindowSystemEvent { + public: + ScreenAvailableGeometryEvent(QScreen *s, const QRect &g) + : WindowSystemEvent(ScreenAvailableGeometry), screen(s), availableGeometry(g) { } + QPointer screen; + QRect availableGeometry; + }; + + class ScreenLogicalDotsPerInchEvent : public WindowSystemEvent { + public: + ScreenLogicalDotsPerInchEvent(QScreen *s, qreal dx, qreal dy) + : WindowSystemEvent(ScreenLogicalDotsPerInch), screen(s), dpiX(dx), dpiY(dy) { } + QPointer screen; + qreal dpiX; + qreal dpiY; + }; + + class ScreenRefreshRateEvent : public WindowSystemEvent { + public: + ScreenRefreshRateEvent(QScreen *s, qreal r) + : WindowSystemEvent(ScreenRefreshRate), screen(s), rate(r) { } + QPointer screen; + qreal rate; + }; + + class ThemeChangeEvent : public WindowSystemEvent { + public: + explicit ThemeChangeEvent(QWindow * w) + : WindowSystemEvent(ThemeChange), window(w) { } + QPointer window; + }; + + class ExposeEvent : public WindowSystemEvent { + public: + ExposeEvent(QWindow *exposed, const QRegion ®ion); + QPointer exposed; + bool isExposed; + QRegion region; + }; + + class FileOpenEvent : public WindowSystemEvent { + public: + FileOpenEvent(const QString& fileName) + : WindowSystemEvent(FileOpen), fileName(fileName) + { } + QString fileName; + }; + + class TabletEvent : public InputEvent { + public: + static void handleTabletEvent(QWindow *w, bool down, const QPointF &local, const QPointF &global, + int device, int pointerType, qreal pressure, int xTilt, int yTilt, + qreal tangentialPressure, qreal rotation, int z, qint64 uid, + Qt::KeyboardModifiers modifiers = Qt::NoModifier); + + TabletEvent(QWindow *w, ulong time, bool down, const QPointF &local, const QPointF &global, + int device, int pointerType, qreal pressure, int xTilt, int yTilt, qreal tpressure, + qreal rotation, int z, qint64 uid, Qt::KeyboardModifiers mods) + : InputEvent(w, time, Tablet, Qt::NoModifier), + down(down), local(local), global(global), device(device), pointerType(pointerType), + pressure(pressure), xTilt(xTilt), yTilt(yTilt), tangentialPressure(tpressure), + rotation(rotation), z(z), uid(uid), mods(mods) { } + bool down; + QPointF local; + QPointF global; + int device; + int pointerType; + qreal pressure; + int xTilt; + int yTilt; + qreal tangentialPressure; + qreal rotation; + int z; + qint64 uid; + Qt::KeyboardModifiers mods; + }; + + class TabletEnterProximityEvent : public InputEvent { + public: + TabletEnterProximityEvent(ulong time, int device, int pointerType, qint64 uid) + : InputEvent(0, time, TabletEnterProximity, Qt::NoModifier), + device(device), pointerType(pointerType), uid(uid) { } + int device; + int pointerType; + qint64 uid; + }; + + class TabletLeaveProximityEvent : public InputEvent { + public: + TabletLeaveProximityEvent(ulong time, int device, int pointerType, qint64 uid) + : InputEvent(0, time, TabletLeaveProximity, Qt::NoModifier), + device(device), pointerType(pointerType), uid(uid) { } + int device; + int pointerType; + qint64 uid; + }; + + static QList windowSystemEventQueue; + static QMutex queueMutex; + + static int windowSystemEventsQueued(); + static WindowSystemEvent * getWindowSystemEvent(); + static void queueWindowSystemEvent(WindowSystemEvent *ev); + + static QElapsedTimer eventTime; + + static QList convertTouchPoints(const QList &points, QEvent::Type *type); +}; + +QT_END_HEADER +QT_END_NAMESPACE + +#endif // QWINDOWSYSTEMINTERFACE_P_H diff --git a/src/gui/kernel/qwindowsysteminterface_qpa.cpp b/src/gui/kernel/qwindowsysteminterface_qpa.cpp index 139df98daf..e884d7caf9 100644 --- a/src/gui/kernel/qwindowsysteminterface_qpa.cpp +++ b/src/gui/kernel/qwindowsysteminterface_qpa.cpp @@ -38,9 +38,9 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -#include "qwindowsysteminterface_qpa.h" +#include "qwindowsysteminterface.h" #include -#include "qwindowsysteminterface_qpa_p.h" +#include "qwindowsysteminterface_p.h" #include "private/qguiapplication_p.h" #include "private/qevent_p.h" #include "private/qtouchdevice_p.h" diff --git a/src/gui/kernel/qwindowsysteminterface_qpa.h b/src/gui/kernel/qwindowsysteminterface_qpa.h deleted file mode 100644 index b55f3e3f33..0000000000 --- a/src/gui/kernel/qwindowsysteminterface_qpa.h +++ /dev/null @@ -1,178 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#ifndef QWINDOWSYSTEMINTERFACE_H -#define QWINDOWSYSTEMINTERFACE_H - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -class QMimeData; -class QTouchDevice; -class QPlatformDragQtResponse; -class QPlatformDropQtResponse; - - -class Q_GUI_EXPORT QWindowSystemInterface -{ -public: - static void handleMouseEvent(QWindow *w, const QPointF & local, const QPointF & global, Qt::MouseButtons b, Qt::KeyboardModifiers mods = Qt::NoModifier); - static void handleMouseEvent(QWindow *w, ulong timestamp, const QPointF & local, const QPointF & global, Qt::MouseButtons b, Qt::KeyboardModifiers mods = Qt::NoModifier); - static void handleFrameStrutMouseEvent(QWindow *w, const QPointF & local, const QPointF & global, Qt::MouseButtons b, Qt::KeyboardModifiers mods = Qt::NoModifier); - static void handleFrameStrutMouseEvent(QWindow *w, ulong timestamp, const QPointF & local, const QPointF & global, Qt::MouseButtons b, Qt::KeyboardModifiers mods = Qt::NoModifier); - - static bool tryHandleSynchronousShortcutEvent(QWindow *w, int k, Qt::KeyboardModifiers mods, - const QString & text = QString(), bool autorep = false, ushort count = 1); - static bool tryHandleSynchronousShortcutEvent(QWindow *w, ulong timestamp, int k, Qt::KeyboardModifiers mods, - const QString & text = QString(), bool autorep = false, ushort count = 1); - - static bool tryHandleSynchronousExtendedShortcutEvent(QWindow *w, int k, Qt::KeyboardModifiers mods, - quint32 nativeScanCode, quint32 nativeVirtualKey, quint32 nativeModifiers, - const QString & text = QString(), bool autorep = false, ushort count = 1); - static bool tryHandleSynchronousExtendedShortcutEvent(QWindow *w, ulong timestamp, int k, Qt::KeyboardModifiers mods, - quint32 nativeScanCode, quint32 nativeVirtualKey, quint32 nativeModifiers, - const QString & text = QString(), bool autorep = false, ushort count = 1); - - static void handleKeyEvent(QWindow *w, QEvent::Type t, int k, Qt::KeyboardModifiers mods, const QString & text = QString(), bool autorep = false, ushort count = 1); - static void handleKeyEvent(QWindow *w, ulong timestamp, QEvent::Type t, int k, Qt::KeyboardModifiers mods, const QString & text = QString(), bool autorep = false, ushort count = 1); - - static void handleExtendedKeyEvent(QWindow *w, QEvent::Type type, int key, Qt::KeyboardModifiers modifiers, - quint32 nativeScanCode, quint32 nativeVirtualKey, - quint32 nativeModifiers, - const QString& text = QString(), bool autorep = false, - ushort count = 1); - static void handleExtendedKeyEvent(QWindow *w, ulong timestamp, QEvent::Type type, int key, Qt::KeyboardModifiers modifiers, - quint32 nativeScanCode, quint32 nativeVirtualKey, - quint32 nativeModifiers, - const QString& text = QString(), bool autorep = false, - ushort count = 1); - static void handleWheelEvent(QWindow *w, const QPointF & local, const QPointF & global, QPoint pixelDelta, QPoint angleDelta, Qt::KeyboardModifiers mods = Qt::NoModifier); - static void handleWheelEvent(QWindow *w, ulong timestamp, const QPointF & local, const QPointF & global, QPoint pixelDelta, QPoint angleDelta, Qt::KeyboardModifiers mods = Qt::NoModifier); - - // Wheel event compatibility functions. Will be removed: do not use. - static void handleWheelEvent(QWindow *w, const QPointF & local, const QPointF & global, int d, Qt::Orientation o, Qt::KeyboardModifiers mods = Qt::NoModifier); - static void handleWheelEvent(QWindow *w, ulong timestamp, const QPointF & local, const QPointF & global, int d, Qt::Orientation o, Qt::KeyboardModifiers mods = Qt::NoModifier); - - struct TouchPoint { - TouchPoint() : id(0), pressure(0), state(Qt::TouchPointStationary), flags(0) { } - int id; // for application use - QPointF normalPosition; // touch device coordinates, (0 to 1, 0 to 1) - QRectF area; // the touched area, centered at position in screen coordinates - qreal pressure; // 0 to 1 - Qt::TouchPointState state; //Qt::TouchPoint{Pressed|Moved|Stationary|Released} - QVector2D velocity; // in screen coordinate system, pixels / seconds - QTouchEvent::TouchPoint::InfoFlags flags; - QVector rawPositions; // in screen coordinates - }; - - static void registerTouchDevice(QTouchDevice *device); - static void handleTouchEvent(QWindow *w, QTouchDevice *device, - const QList &points, Qt::KeyboardModifiers mods = Qt::NoModifier); - static void handleTouchEvent(QWindow *w, ulong timestamp, QTouchDevice *device, - const QList &points, Qt::KeyboardModifiers mods = Qt::NoModifier); - static void handleTouchCancelEvent(QWindow *w, QTouchDevice *device, Qt::KeyboardModifiers mods = Qt::NoModifier); - static void handleTouchCancelEvent(QWindow *w, ulong timestamp, QTouchDevice *device, Qt::KeyboardModifiers mods = Qt::NoModifier); - - static void handleGeometryChange(QWindow *w, const QRect &newRect); - static void handleSynchronousGeometryChange(QWindow *w, const QRect &newRect); - static void handleCloseEvent(QWindow *w); - static void handleSynchronousCloseEvent(QWindow *w); - static void handleEnterEvent(QWindow *w); - static void handleLeaveEvent(QWindow *w); - static void handleWindowActivated(QWindow *w); - static void handleWindowStateChanged(QWindow *w, Qt::WindowState newState); - - static void handleExposeEvent(QWindow *tlw, const QRegion ®ion); - static void handleSynchronousExposeEvent(QWindow *tlw, const QRegion ®ion); - -#ifndef QT_NO_DRAGANDDROP - // Drag and drop. These events are sent immediately. - static QPlatformDragQtResponse handleDrag(QWindow *w, const QMimeData *dropData, const QPoint &p, Qt::DropActions supportedActions); - static QPlatformDropQtResponse handleDrop(QWindow *w, const QMimeData *dropData, const QPoint &p, Qt::DropActions supportedActions); -#endif - - static bool handleNativeEvent(QWindow *window, const QByteArray &eventType, void *message, long *result); - - // Changes to the screen - static void handleScreenOrientationChange(QScreen *screen, Qt::ScreenOrientation newOrientation); - static void handleScreenGeometryChange(QScreen *screen, const QRect &newGeometry); - static void handleScreenAvailableGeometryChange(QScreen *screen, const QRect &newAvailableGeometry); - static void handleScreenLogicalDotsPerInchChange(QScreen *screen, qreal newDpiX, qreal newDpiY); - static void handleScreenRefreshRateChange(QScreen *screen, qreal newRefreshRate); - - static void handleThemeChange(QWindow *tlw); - - static void handleFileOpenEvent(const QString& fileName); - - static void handleTabletEvent(QWindow *w, ulong timestamp, bool down, const QPointF &local, const QPointF &global, - int device, int pointerType, qreal pressure, int xTilt, int yTilt, - qreal tangentialPressure, qreal rotation, int z, qint64 uid, - Qt::KeyboardModifiers modifiers = Qt::NoModifier); - static void handleTabletEvent(QWindow *w, bool down, const QPointF &local, const QPointF &global, - int device, int pointerType, qreal pressure, int xTilt, int yTilt, - qreal tangentialPressure, qreal rotation, int z, qint64 uid, - Qt::KeyboardModifiers modifiers = Qt::NoModifier); - static void handleTabletEnterProximityEvent(ulong timestamp, int device, int pointerType, qint64 uid); - static void handleTabletEnterProximityEvent(int device, int pointerType, qint64 uid); - static void handleTabletLeaveProximityEvent(ulong timestamp, int device, int pointerType, qint64 uid); - static void handleTabletLeaveProximityEvent(int device, int pointerType, qint64 uid); - - - // For event dispatcher implementations - static bool sendWindowSystemEvents(QAbstractEventDispatcher *eventDispatcher, QEventLoop::ProcessEventsFlags flags); - static int windowSystemEventsQueued(); -}; - -QT_END_NAMESPACE -QT_END_HEADER -#endif // QWINDOWSYSTEMINTERFACE_H diff --git a/src/gui/kernel/qwindowsysteminterface_qpa_p.h b/src/gui/kernel/qwindowsysteminterface_qpa_p.h deleted file mode 100644 index 8fb0652eb6..0000000000 --- a/src/gui/kernel/qwindowsysteminterface_qpa_p.h +++ /dev/null @@ -1,341 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#ifndef QWINDOWSYSTEMINTERFACE_QPA_P_H -#define QWINDOWSYSTEMINTERFACE_QPA_P_H - -#include "qwindowsysteminterface_qpa.h" - -#include -#include - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -class QWindowSystemInterfacePrivate { -public: - enum EventType { - Close, - GeometryChange, - Enter, - Leave, - ActivatedWindow, - WindowStateChanged, - Mouse, - FrameStrutMouse, - Wheel, - Key, - Touch, - ScreenOrientation, - ScreenGeometry, - ScreenAvailableGeometry, - ScreenLogicalDotsPerInch, - ScreenRefreshRate, - ThemeChange, - Expose, - FileOpen, - Tablet, - TabletEnterProximity, - TabletLeaveProximity - }; - - class WindowSystemEvent { - public: - explicit WindowSystemEvent(EventType t) - : type(t), synthetic(false) { } - virtual ~WindowSystemEvent() { } - EventType type; - bool synthetic; - }; - - class CloseEvent : public WindowSystemEvent { - public: - explicit CloseEvent(QWindow *w) - : WindowSystemEvent(Close), window(w) { } - QPointer window; - }; - - class GeometryChangeEvent : public WindowSystemEvent { - public: - GeometryChangeEvent(QWindow *tlw, const QRect &newGeometry) - : WindowSystemEvent(GeometryChange), tlw(tlw), newGeometry(newGeometry) - { } - QPointer tlw; - QRect newGeometry; - }; - - class EnterEvent : public WindowSystemEvent { - public: - explicit EnterEvent(QWindow *enter) - : WindowSystemEvent(Enter), enter(enter) - { } - QPointer enter; - }; - - class LeaveEvent : public WindowSystemEvent { - public: - explicit LeaveEvent(QWindow *leave) - : WindowSystemEvent(Leave), leave(leave) - { } - QPointer leave; - }; - - class ActivatedWindowEvent : public WindowSystemEvent { - public: - explicit ActivatedWindowEvent(QWindow *activatedWindow) - : WindowSystemEvent(ActivatedWindow), activated(activatedWindow) - { } - QPointer activated; - }; - - class WindowStateChangedEvent : public WindowSystemEvent { - public: - WindowStateChangedEvent(QWindow *_window, Qt::WindowState _newState) - : WindowSystemEvent(WindowStateChanged), window(_window), newState(_newState) - { } - - QPointer window; - Qt::WindowState newState; - }; - - class UserEvent : public WindowSystemEvent { - public: - UserEvent(QWindow * w, ulong time, EventType t) - : WindowSystemEvent(t), window(w), nullWindow(w == 0), timestamp(time) { } - QPointer window; - bool nullWindow; - unsigned long timestamp; - }; - - class InputEvent: public UserEvent { - public: - InputEvent(QWindow * w, ulong time, EventType t, Qt::KeyboardModifiers mods) - : UserEvent(w, time, t), modifiers(mods) {} - Qt::KeyboardModifiers modifiers; - }; - - class MouseEvent : public InputEvent { - public: - MouseEvent(QWindow * w, ulong time, const QPointF & local, const QPointF & global, - Qt::MouseButtons b, Qt::KeyboardModifiers mods) - : InputEvent(w, time, Mouse, mods), localPos(local), globalPos(global), buttons(b) { } - MouseEvent(QWindow * w, ulong time, EventType t, const QPointF & local, const QPointF & global, - Qt::MouseButtons b, Qt::KeyboardModifiers mods) - : InputEvent(w, time, t, mods), localPos(local), globalPos(global), buttons(b) { } - QPointF localPos; - QPointF globalPos; - Qt::MouseButtons buttons; - }; - - class WheelEvent : public InputEvent { - public: - WheelEvent(QWindow *w, ulong time, const QPointF & local, const QPointF & global, QPoint pixelD, QPoint angleD, int qt4D, Qt::Orientation qt4O, - Qt::KeyboardModifiers mods) - : InputEvent(w, time, Wheel, mods), pixelDelta(pixelD), angleDelta(angleD), qt4Delta(qt4D), qt4Orientation(qt4O), localPos(local), globalPos(global) { } - QPoint pixelDelta; - QPoint angleDelta; - int qt4Delta; - Qt::Orientation qt4Orientation; - QPointF localPos; - QPointF globalPos; - }; - - class KeyEvent : public InputEvent { - public: - KeyEvent(QWindow *w, ulong time, QEvent::Type t, int k, Qt::KeyboardModifiers mods, const QString & text = QString(), bool autorep = false, ushort count = 1) - :InputEvent(w, time, Key, mods), key(k), unicode(text), repeat(autorep), - repeatCount(count), keyType(t), - nativeScanCode(0), nativeVirtualKey(0), nativeModifiers(0) { } - KeyEvent(QWindow *w, ulong time, QEvent::Type t, int k, Qt::KeyboardModifiers mods, - quint32 nativeSC, quint32 nativeVK, quint32 nativeMods, - const QString & text = QString(), bool autorep = false, ushort count = 1) - :InputEvent(w, time, Key, mods), key(k), unicode(text), repeat(autorep), - repeatCount(count), keyType(t), - nativeScanCode(nativeSC), nativeVirtualKey(nativeVK), nativeModifiers(nativeMods) { } - int key; - QString unicode; - bool repeat; - ushort repeatCount; - QEvent::Type keyType; - quint32 nativeScanCode; - quint32 nativeVirtualKey; - quint32 nativeModifiers; - }; - - class TouchEvent : public InputEvent { - public: - TouchEvent(QWindow *w, ulong time, QEvent::Type t, QTouchDevice *dev, - const QList &p, Qt::KeyboardModifiers mods) - :InputEvent(w, time, Touch, mods), device(dev), points(p), touchType(t) { } - QTouchDevice *device; - QList points; - QEvent::Type touchType; - }; - - class ScreenOrientationEvent : public WindowSystemEvent { - public: - ScreenOrientationEvent(QScreen *s, Qt::ScreenOrientation o) - : WindowSystemEvent(ScreenOrientation), screen(s), orientation(o) { } - QPointer screen; - Qt::ScreenOrientation orientation; - }; - - class ScreenGeometryEvent : public WindowSystemEvent { - public: - ScreenGeometryEvent(QScreen *s, const QRect &g) - : WindowSystemEvent(ScreenGeometry), screen(s), geometry(g) { } - QPointer screen; - QRect geometry; - }; - - class ScreenAvailableGeometryEvent : public WindowSystemEvent { - public: - ScreenAvailableGeometryEvent(QScreen *s, const QRect &g) - : WindowSystemEvent(ScreenAvailableGeometry), screen(s), availableGeometry(g) { } - QPointer screen; - QRect availableGeometry; - }; - - class ScreenLogicalDotsPerInchEvent : public WindowSystemEvent { - public: - ScreenLogicalDotsPerInchEvent(QScreen *s, qreal dx, qreal dy) - : WindowSystemEvent(ScreenLogicalDotsPerInch), screen(s), dpiX(dx), dpiY(dy) { } - QPointer screen; - qreal dpiX; - qreal dpiY; - }; - - class ScreenRefreshRateEvent : public WindowSystemEvent { - public: - ScreenRefreshRateEvent(QScreen *s, qreal r) - : WindowSystemEvent(ScreenRefreshRate), screen(s), rate(r) { } - QPointer screen; - qreal rate; - }; - - class ThemeChangeEvent : public WindowSystemEvent { - public: - explicit ThemeChangeEvent(QWindow * w) - : WindowSystemEvent(ThemeChange), window(w) { } - QPointer window; - }; - - class ExposeEvent : public WindowSystemEvent { - public: - ExposeEvent(QWindow *exposed, const QRegion ®ion); - QPointer exposed; - bool isExposed; - QRegion region; - }; - - class FileOpenEvent : public WindowSystemEvent { - public: - FileOpenEvent(const QString& fileName) - : WindowSystemEvent(FileOpen), fileName(fileName) - { } - QString fileName; - }; - - class TabletEvent : public InputEvent { - public: - static void handleTabletEvent(QWindow *w, bool down, const QPointF &local, const QPointF &global, - int device, int pointerType, qreal pressure, int xTilt, int yTilt, - qreal tangentialPressure, qreal rotation, int z, qint64 uid, - Qt::KeyboardModifiers modifiers = Qt::NoModifier); - - TabletEvent(QWindow *w, ulong time, bool down, const QPointF &local, const QPointF &global, - int device, int pointerType, qreal pressure, int xTilt, int yTilt, qreal tpressure, - qreal rotation, int z, qint64 uid, Qt::KeyboardModifiers mods) - : InputEvent(w, time, Tablet, Qt::NoModifier), - down(down), local(local), global(global), device(device), pointerType(pointerType), - pressure(pressure), xTilt(xTilt), yTilt(yTilt), tangentialPressure(tpressure), - rotation(rotation), z(z), uid(uid), mods(mods) { } - bool down; - QPointF local; - QPointF global; - int device; - int pointerType; - qreal pressure; - int xTilt; - int yTilt; - qreal tangentialPressure; - qreal rotation; - int z; - qint64 uid; - Qt::KeyboardModifiers mods; - }; - - class TabletEnterProximityEvent : public InputEvent { - public: - TabletEnterProximityEvent(ulong time, int device, int pointerType, qint64 uid) - : InputEvent(0, time, TabletEnterProximity, Qt::NoModifier), - device(device), pointerType(pointerType), uid(uid) { } - int device; - int pointerType; - qint64 uid; - }; - - class TabletLeaveProximityEvent : public InputEvent { - public: - TabletLeaveProximityEvent(ulong time, int device, int pointerType, qint64 uid) - : InputEvent(0, time, TabletLeaveProximity, Qt::NoModifier), - device(device), pointerType(pointerType), uid(uid) { } - int device; - int pointerType; - qint64 uid; - }; - - static QList windowSystemEventQueue; - static QMutex queueMutex; - - static int windowSystemEventsQueued(); - static WindowSystemEvent * getWindowSystemEvent(); - static void queueWindowSystemEvent(WindowSystemEvent *ev); - - static QElapsedTimer eventTime; - - static QList convertTouchPoints(const QList &points, QEvent::Type *type); -}; - -QT_END_HEADER -QT_END_NAMESPACE - -#endif // QWINDOWSYSTEMINTERFACE_QPA_P_H diff --git a/src/testlib/qtestkeyboard.h b/src/testlib/qtestkeyboard.h index 2e43e864d5..7c37d07a0b 100644 --- a/src/testlib/qtestkeyboard.h +++ b/src/testlib/qtestkeyboard.h @@ -56,7 +56,7 @@ #include #include #include -#include +#include #ifdef QT_WIDGETS_LIB #include diff --git a/src/testlib/qtestmouse.h b/src/testlib/qtestmouse.h index 4ee31ff47f..910914bdbc 100644 --- a/src/testlib/qtestmouse.h +++ b/src/testlib/qtestmouse.h @@ -54,7 +54,7 @@ #include #include #include -#include +#include #ifdef QT_WIDGETS_LIB #include diff --git a/src/testlib/qtesttouch.h b/src/testlib/qtesttouch.h index 6e456f375c..e19c60f812 100644 --- a/src/testlib/qtesttouch.h +++ b/src/testlib/qtesttouch.h @@ -51,7 +51,7 @@ #include #include #include -#include +#include #include #include #ifdef QT_WIDGETS_LIB -- cgit v1.2.3