summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJørgen Lind <jorgen.lind@nokia.com>2010-07-20 12:38:12 (GMT)
committerJørgen Lind <jorgen.lind@nokia.com>2010-07-21 06:38:10 (GMT)
commitbc786ded04aa316f99cf9ac4cf8b714ee46575b5 (patch)
treed7bfc3959b767428da8e69d683cdf81e1be616ea
parenta7182f757e5414d7baf21fdc098f3f6649e6a1d6 (diff)
downloadQt-bc786ded04aa316f99cf9ac4cf8b714ee46575b5.zip
Qt-bc786ded04aa316f99cf9ac4cf8b714ee46575b5.tar.gz
Qt-bc786ded04aa316f99cf9ac4cf8b714ee46575b5.tar.bz2
Made the rest of QWindowSystemInterface callback functions thread safe
and cleaned up the headerfile
-rw-r--r--src/gui/kernel/kernel.pri7
-rw-r--r--src/gui/kernel/qapplication_p.h29
-rw-r--r--src/gui/kernel/qapplication_qpa.cpp133
-rw-r--r--src/gui/kernel/qeventdispatcher_glib_qpa.cpp10
-rw-r--r--src/gui/kernel/qeventdispatcher_qpa.cpp10
-rw-r--r--src/gui/kernel/qwindowsysteminterface.cpp186
-rw-r--r--src/gui/kernel/qwindowsysteminterface_qpa.cpp246
-rw-r--r--src/gui/kernel/qwindowsysteminterface_qpa.h (renamed from src/gui/kernel/qwindowsysteminterface.h)81
-rw-r--r--src/gui/kernel/qwindowsysteminterface_qpa_p.h201
9 files changed, 565 insertions, 338 deletions
diff --git a/src/gui/kernel/kernel.pri b/src/gui/kernel/kernel.pri
index ba86c1c..43b1ab8 100644
--- a/src/gui/kernel/kernel.pri
+++ b/src/gui/kernel/kernel.pri
@@ -48,7 +48,7 @@ HEADERS += \
kernel/qgesturemanager_p.h \
kernel/qsoftkeymanager_p.h \
kernel/qsoftkeymanager_common_p.h \
- kernel/qguiplatformplugin_p.h
+ kernel/qguiplatformplugin_p.h \
SOURCES += \
kernel/qaction.cpp \
@@ -211,7 +211,8 @@ qpa {
kernel/qgenericpluginfactory_qpa.h \
kernel/qgenericplugin_qpa.h \
kernel/qeventdispatcher_qpa_p.h \
- kernel/qwindowsysteminterface.h \
+ kernel/qwindowsysteminterface_qpa.h \
+ kernel/qwindowsysteminterface_qpa_p.h \
kernel/qplatformintegration_qpa.h \
kernel/qplatformscreen_qpa.h \
kernel/qplatformintegrationfactory_qpa_p.h \
@@ -233,7 +234,7 @@ qpa {
kernel/qkeymapper_qws.cpp \
kernel/qwidget_qpa.cpp \
kernel/qeventdispatcher_qpa.cpp \
- kernel/qwindowsysteminterface.cpp \
+ kernel/qwindowsysteminterface_qpa.cpp \
kernel/qplatformintegration_qpa.cpp \
kernel/qplatformscreen_qpa.cpp \
kernel/qplatformintegrationfactory_qpa.cpp \
diff --git a/src/gui/kernel/qapplication_p.h b/src/gui/kernel/qapplication_p.h
index 68ec648..0602d82 100644
--- a/src/gui/kernel/qapplication_p.h
+++ b/src/gui/kernel/qapplication_p.h
@@ -78,6 +78,7 @@
#endif
#ifdef Q_WS_QPA
#include <QWindowSystemInterface>
+#include "qwindowsysteminterface_qpa_p.h"
#include "QtGui/qplatformintegration_qpa.h"
#endif
@@ -490,19 +491,27 @@ public:
#endif
#ifdef Q_WS_QPA
- static void processMouseEvent(QWindowSystemInterface::MouseEvent *e);
- static void processKeyEvent(QWindowSystemInterface::KeyEvent *e);
- static void processWheelEvent(QWindowSystemInterface::WheelEvent *e);
- static void processTouchEvent(QWindowSystemInterface::TouchEvent *e);
+ static void processMouseEvent(QWindowSystemInterfacePrivate::MouseEvent *e);
+ static void processKeyEvent(QWindowSystemInterfacePrivate::KeyEvent *e);
+ static void processWheelEvent(QWindowSystemInterfacePrivate::WheelEvent *e);
+ static void processTouchEvent(QWindowSystemInterfacePrivate::TouchEvent *e);
- static void processCloseEvent(QWidget *tlw);
- static void processGeometryChange(QWidget *tlw, const QRect &newRect);
+ static void processCloseEvent(QWindowSystemInterfacePrivate::CloseEvent *e);
- static void processUserEvent(QWindowSystemInterface::UserEvent *e);
+ static void processMoveEvent(QWindowSystemInterfacePrivate::MoveEvent *e);
+ static void processResizeEvent(QWindowSystemInterfacePrivate::ResizeEvent *e);
- static void reportScreenCount(int count);
- static void reportGeometryChange(int screenIndex);
- static void reportAvailableGeometryChange(int screenIndex);
+ static void processEnterEvent(QWindowSystemInterfacePrivate::EnterEvent *e);
+ static void processLeaveEvent(QWindowSystemInterfacePrivate::LeaveEvent *e);
+
+ static void processWindowSystemEvent(QWindowSystemInterfacePrivate::WindowSystemEvent *e);
+
+// static void reportScreenCount(int count);
+ static void reportScreenCount(QWindowSystemInterfacePrivate::ScreenCountEvent *e);
+// static void reportGeometryChange(int screenIndex);
+ static void reportGeometryChange(QWindowSystemInterfacePrivate::ScreenGeometryEvent *e);
+// static void reportAvailableGeometryChange(int screenIndex);
+ static void reportAvailableGeometryChange(QWindowSystemInterfacePrivate::ScreenAvailableGeometryEvent *e);
#endif
diff --git a/src/gui/kernel/qapplication_qpa.cpp b/src/gui/kernel/qapplication_qpa.cpp
index 2adcfc1..42907ae 100644
--- a/src/gui/kernel/qapplication_qpa.cpp
+++ b/src/gui/kernel/qapplication_qpa.cpp
@@ -60,6 +60,7 @@
#include <QPlatformCursor>
#include <qdebug.h>
#include <QWindowSystemInterface>
+#include "qwindowsysteminterface_qpa_p.h"
#include <QPlatformIntegration>
#include "qdesktopwidget_qpa_p.h"
@@ -86,26 +87,48 @@ static int mousePressX;
static int mousePressY;
static int mouse_double_click_distance = 5;
-void QApplicationPrivate::processUserEvent(QWindowSystemInterface::UserEvent *e)
+void QApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePrivate::WindowSystemEvent *e)
{
switch(e->type) {
- case QEvent::MouseButtonDblClick: // if mouse event, calculate appropriate widget and local coordinates
- case QEvent::MouseButtonPress:
- case QEvent::MouseButtonRelease:
- case QEvent::MouseMove:
- QApplicationPrivate::processMouseEvent(static_cast<QWindowSystemInterface::MouseEvent *>(e));
+ case QWindowSystemInterfacePrivate::Mouse:
+ QApplicationPrivate::processMouseEvent(static_cast<QWindowSystemInterfacePrivate::MouseEvent *>(e));
break;
- case QEvent::Wheel:
- QApplicationPrivate::processWheelEvent(static_cast<QWindowSystemInterface::WheelEvent *>(e));
+ case QWindowSystemInterfacePrivate::Wheel:
+ QApplicationPrivate::processWheelEvent(static_cast<QWindowSystemInterfacePrivate::WheelEvent *>(e));
break;
- case QEvent::KeyPress:
- case QEvent::KeyRelease:
- QApplicationPrivate::processKeyEvent(static_cast<QWindowSystemInterface::KeyEvent *>(e));
+ case QWindowSystemInterfacePrivate::Key:
+ QApplicationPrivate::processKeyEvent(static_cast<QWindowSystemInterfacePrivate::KeyEvent *>(e));
+ break;
+ case QWindowSystemInterfacePrivate::Touch:
+ QApplicationPrivate::processTouchEvent(static_cast<QWindowSystemInterfacePrivate::TouchEvent *>(e));
+ break;
+ case QWindowSystemInterfacePrivate::Move:
+ QApplicationPrivate::processMoveEvent(static_cast<QWindowSystemInterfacePrivate::MoveEvent *>(e));
+ break;
+ case QWindowSystemInterfacePrivate::Resize:
+ QApplicationPrivate::processResizeEvent(static_cast<QWindowSystemInterfacePrivate::ResizeEvent *>(e));
+ break;
+ case QWindowSystemInterfacePrivate::Enter:
+ QApplicationPrivate::processEnterEvent(static_cast<QWindowSystemInterfacePrivate::EnterEvent *>(e));
+ break;
+ case QWindowSystemInterfacePrivate::Leave:
+ QApplicationPrivate::processLeaveEvent(static_cast<QWindowSystemInterfacePrivate::LeaveEvent *>(e));
+ break;
+ case QWindowSystemInterfacePrivate::Close:
+ QApplicationPrivate::processCloseEvent(
+ static_cast<QWindowSystemInterfacePrivate::CloseEvent *>(e));
+ break;
+ case QWindowSystemInterfacePrivate::ScreenCountChange:
+ QApplicationPrivate::reportScreenCount(
+ static_cast<QWindowSystemInterfacePrivate::ScreenCountEvent *>(e));
break;
- case QEvent::TouchBegin:
- case QEvent::TouchUpdate:
- case QEvent::TouchEnd:
- QApplicationPrivate::processTouchEvent(static_cast<QWindowSystemInterface::TouchEvent *>(e));
+ case QWindowSystemInterfacePrivate::ScreenGeometry:
+ QApplicationPrivate::reportGeometryChange(
+ static_cast<QWindowSystemInterfacePrivate::ScreenGeometryEvent *>(e));
+ break;
+ case QWindowSystemInterfacePrivate::ScreenAvailableGeometry:
+ QApplicationPrivate::reportAvailableGeometryChange(
+ static_cast<QWindowSystemInterfacePrivate::ScreenAvailableGeometryEvent *>(e));
break;
default:
qWarning() << "Unknown user input event type:" << e->type;
@@ -570,7 +593,7 @@ void QApplication::setMainWidget(QWidget *mainWidget)
}
#endif
-void QApplicationPrivate::processMouseEvent(QWindowSystemInterface::MouseEvent *e)
+void QApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::MouseEvent *e)
{
// qDebug() << "handleMouseEvent" << tlw << ev.pos() << ev.globalPos() << hex << ev.buttons();
static QWeakPointer<QWidget> implicit_mouse_grabber;
@@ -579,8 +602,9 @@ void QApplicationPrivate::processMouseEvent(QWindowSystemInterface::MouseEvent *
// move first
Qt::MouseButtons stateChange = e->buttons ^ buttons;
if (e->globalPos != QPoint(qt_last_x, qt_last_y) && (stateChange != Qt::NoButton)) {
- QWindowSystemInterface::MouseEvent * newMouseEvent = new QWindowSystemInterface::MouseEvent(e->widget.data(), e->timestamp, e->localPos, e->globalPos, e->buttons);
- QWindowSystemInterfacePrivate::userEventQueue.prepend(newMouseEvent); // just in case the move triggers a new event loop
+ QWindowSystemInterfacePrivate::MouseEvent * newMouseEvent =
+ new QWindowSystemInterfacePrivate::MouseEvent(e->widget.data(), e->timestamp, e->localPos, e->globalPos, e->buttons);
+ QWindowSystemInterfacePrivate::windowSystemEventQueue.prepend(newMouseEvent); // just in case the move triggers a new event loop
stateChange = Qt::NoButton;
}
@@ -639,7 +663,7 @@ void QApplicationPrivate::processMouseEvent(QWindowSystemInterface::MouseEvent *
implicit_mouse_grabber.clear();
//### how should popup mode and implicit mouse grab interact?
- } else if (tlw && app_do_modal && !qt_try_modal(tlw, e->type) ) {
+ } else if (tlw && app_do_modal && !qt_try_modal(tlw, QEvent::MouseButtonRelease) ) {
//even if we're blocked by modality, we should deliver the mouse release event..
//### this code is not completely correct: multiple buttons can be pressed simultaneously
if (!(implicit_mouse_grabber && buttons == Qt::NoButton)) {
@@ -717,7 +741,7 @@ void QApplicationPrivate::processMouseEvent(QWindowSystemInterface::MouseEvent *
//### there's a lot of duplicated logic here -- refactoring required!
-void QApplicationPrivate::processWheelEvent(QWindowSystemInterface::WheelEvent *e)
+void QApplicationPrivate::processWheelEvent(QWindowSystemInterfacePrivate::WheelEvent *e)
{
// QPoint localPoint = ev.pos();
QPoint globalPoint = e->globalPos;
@@ -739,7 +763,7 @@ void QApplicationPrivate::processWheelEvent(QWindowSystemInterface::WheelEvent *
mouseWidget = mouseWindow;
- if (app_do_modal && !qt_try_modal(mouseWindow, e->type) ) {
+ if (app_do_modal && !qt_try_modal(mouseWindow, QEvent::Wheel) ) {
qDebug() << "modal blocked wheel event" << mouseWindow;
return;
}
@@ -759,7 +783,7 @@ void QApplicationPrivate::processWheelEvent(QWindowSystemInterface::WheelEvent *
// Remember, Qt convention is: keyboard state is state *before*
-void QApplicationPrivate::processKeyEvent(QWindowSystemInterface::KeyEvent *e)
+void QApplicationPrivate::processKeyEvent(QWindowSystemInterfacePrivate::KeyEvent *e)
{
QWidget *focusW = 0;
if (self->inPopupMode()) {
@@ -778,50 +802,54 @@ void QApplicationPrivate::processKeyEvent(QWindowSystemInterface::KeyEvent *e)
if (!focusW)
return;
- if (app_do_modal && !qt_try_modal(focusW, e->type))
+ if (app_do_modal && !qt_try_modal(focusW, e->keyType))
return;
modifiers = e->modifiers;
- QKeyEvent ev(e->type, e->key, e->modifiers, e->unicode, e->repeat, e->repeatCount);
+ QKeyEvent ev(e->keyType, e->key, e->modifiers, e->unicode, e->repeat, e->repeatCount);
QApplication::sendSpontaneousEvent(focusW, &ev);
}
-void QApplicationPrivate::processGeometryChange(QWidget *tlw, const QRect &newRect)
+void QApplicationPrivate::processEnterEvent(QWindowSystemInterfacePrivate::EnterEvent *e)
{
- if (!tlw->isWindow())
- return; //geo of native child widgets is controlled by lighthouse
- //so we already have sent the events; besides this new rect
- //is not mapped to parent
+ QApplicationPrivate::dispatchEnterLeave(e->enter.data(),0);
+ qt_last_mouse_receiver = e->enter.data();
+}
- QRect cr(tlw->geometry());
+void QApplicationPrivate::processLeaveEvent(QWindowSystemInterfacePrivate::LeaveEvent *e)
+{
+ QApplicationPrivate::dispatchEnterLeave(0,qt_last_mouse_receiver);
- bool isResize = cr.size() != newRect.size();
- bool isMove = cr.topLeft() != newRect.topLeft();
- tlw->data->crect = newRect;
- if (isResize) {
- QResizeEvent e(tlw->data->crect.size(), cr.size());
- QApplication::sendSpontaneousEvent(tlw, &e);
- tlw->update();
- }
+ if (e->leave.data() && !e->leave.data()->isAncestorOf(qt_last_mouse_receiver)) //(???) this should not happen
+ QApplicationPrivate::dispatchEnterLeave(0, e->leave.data());
+ qt_last_mouse_receiver = 0;
- if (isMove) {
- //### frame geometry
- QMoveEvent e(tlw->data->crect.topLeft(), cr.topLeft());
- QApplication::sendSpontaneousEvent(tlw, &e);
- }
}
-void QApplicationPrivate::processCloseEvent(QWidget *tlw)
+void QApplicationPrivate::processMoveEvent(QWindowSystemInterfacePrivate::MoveEvent *moveEvent)
+{
+ QMoveEvent e(moveEvent->moved.data()->geometry().topLeft(), moveEvent->newPos);
+ QApplication::sendSpontaneousEvent(moveEvent->moved.data(), &e);
+}
+
+void QApplicationPrivate::processResizeEvent(QWindowSystemInterfacePrivate::ResizeEvent *e)
+{
+ QResizeEvent resizeEvent(e->sizeChanged.data()->data->crect.size(), e->newSize);
+ QApplication::sendSpontaneousEvent(e->sizeChanged.data(), &resizeEvent);
+ e->sizeChanged.data()->update();
+}
+
+void QApplicationPrivate::processCloseEvent(QWindowSystemInterfacePrivate::CloseEvent *e)
{
- tlw->d_func()->close_helper(QWidgetPrivate::CloseWithSpontaneousEvent);
+ e->topLevel.data()->d_func()->close_helper(QWidgetPrivate::CloseWithSpontaneousEvent);
}
-void QApplicationPrivate::processTouchEvent(QWindowSystemInterface::TouchEvent *e)
+void QApplicationPrivate::processTouchEvent(QWindowSystemInterfacePrivate::TouchEvent *e)
{
translateRawTouchEvent(e->widget.data(), e->devType, e->points);
}
-void QApplicationPrivate::reportScreenCount(int count)
+void QApplicationPrivate::reportScreenCount(QWindowSystemInterfacePrivate::ScreenCountEvent *e)
{
// This operation only makes sense after the QApplication constructor runs
if (QCoreApplication::startingUp())
@@ -830,10 +858,10 @@ void QApplicationPrivate::reportScreenCount(int count)
QApplication::desktop()->d_func()->updateScreenList();
// signal anything listening for creation or deletion of screens
QDesktopWidget *desktop = QApplication::desktop();
- emit desktop->screenCountChanged(count);
+ emit desktop->screenCountChanged(e->count);
}
-void QApplicationPrivate::reportGeometryChange(int screenIndex)
+void QApplicationPrivate::reportGeometryChange(QWindowSystemInterfacePrivate::ScreenGeometryEvent *e)
{
// This operation only makes sense after the QApplication constructor runs
if (QCoreApplication::startingUp())
@@ -843,7 +871,7 @@ void QApplicationPrivate::reportGeometryChange(int screenIndex)
// signal anything listening for screen geometry changes
QDesktopWidget *desktop = QApplication::desktop();
- emit desktop->resized(screenIndex);
+ emit desktop->resized(e->index);
// make sure maximized and fullscreen windows are updated
QWidgetList list = QApplication::topLevelWidgets();
@@ -856,7 +884,8 @@ void QApplicationPrivate::reportGeometryChange(int screenIndex)
}
}
-void QApplicationPrivate::reportAvailableGeometryChange(int screenIndex)
+void QApplicationPrivate::reportAvailableGeometryChange(
+ QWindowSystemInterfacePrivate::ScreenAvailableGeometryEvent *e)
{
// This operation only makes sense after the QApplication constructor runs
if (QCoreApplication::startingUp())
@@ -866,7 +895,7 @@ void QApplicationPrivate::reportAvailableGeometryChange(int screenIndex)
// signal anything listening for screen geometry changes
QDesktopWidget *desktop = QApplication::desktop();
- emit desktop->workAreaResized(screenIndex);
+ emit desktop->workAreaResized(e->index);
// make sure maximized and fullscreen windows are updated
QWidgetList list = QApplication::topLevelWidgets();
diff --git a/src/gui/kernel/qeventdispatcher_glib_qpa.cpp b/src/gui/kernel/qeventdispatcher_glib_qpa.cpp
index 981991d..01d40ca 100644
--- a/src/gui/kernel/qeventdispatcher_glib_qpa.cpp
+++ b/src/gui/kernel/qeventdispatcher_glib_qpa.cpp
@@ -64,7 +64,7 @@ static gboolean userEventSourcePrepare(GSource *s, gint *timeout)
Q_UNUSED(s)
Q_UNUSED(timeout)
- return QWindowSystemInterfacePrivate::userEventsQueued() > 0;
+ return QWindowSystemInterfacePrivate::windowSystemEventsQueued() > 0;
}
static gboolean userEventSourceCheck(GSource *source)
@@ -76,9 +76,9 @@ static gboolean userEventSourceDispatch(GSource *s, GSourceFunc, gpointer)
{
GUserEventSource * source = reinterpret_cast<GUserEventSource *>(s);
- QWindowSystemInterface::UserEvent * event;
- while (QWindowSystemInterfacePrivate::userEventsQueued()) {
- event = QWindowSystemInterfacePrivate::getUserEvent();
+ QWindowSystemInterfacePrivate::WindowSystemEvent * event;
+ while (QWindowSystemInterfacePrivate::windowSystemEventsQueued()) {
+ event = QWindowSystemInterfacePrivate::getWindowSystemEvent();
if (!event)
break;
@@ -87,7 +87,7 @@ static gboolean userEventSourceDispatch(GSource *s, GSourceFunc, gpointer)
delete event;
continue;
}
- QApplicationPrivate::processUserEvent(event);
+ QApplicationPrivate::processWindowSystemEvent(event);
delete event;
}
diff --git a/src/gui/kernel/qeventdispatcher_qpa.cpp b/src/gui/kernel/qeventdispatcher_qpa.cpp
index f7f3db3..4464036 100644
--- a/src/gui/kernel/qeventdispatcher_qpa.cpp
+++ b/src/gui/kernel/qeventdispatcher_qpa.cpp
@@ -191,11 +191,11 @@ bool QEventDispatcherQPA::processEvents(QEventLoop::ProcessEventsFlags flags)
QApplication::sendPostedEvents();
while (!d->interrupt) { // also flushes output buffer ###can be optimized
- QWindowSystemInterface::UserEvent *event;
+ QWindowSystemInterfacePrivate::WindowSystemEvent *event;
if (!(flags & QEventLoop::ExcludeUserInputEvents)
- && QWindowSystemInterfacePrivate::userEventsQueued() > 0) {
+ && QWindowSystemInterfacePrivate::windowSystemEventsQueued() > 0) {
// process a pending user input event
- event = QWindowSystemInterfacePrivate::getUserEvent();
+ event = QWindowSystemInterfacePrivate::getWindowSystemEvent();
if (!event)
break;
} else {
@@ -208,7 +208,7 @@ bool QEventDispatcherQPA::processEvents(QEventLoop::ProcessEventsFlags flags)
}
nevents++;
- QApplicationPrivate::processUserEvent(event);
+ QApplicationPrivate::processWindowSystemEvent(event);
delete event;
}
@@ -222,7 +222,7 @@ bool QEventDispatcherQPA::processEvents(QEventLoop::ProcessEventsFlags flags)
bool QEventDispatcherQPA::hasPendingEvents()
{
extern uint qGlobalPostedEventsCount(); // from qapplication.cpp
- return qGlobalPostedEventsCount() || QWindowSystemInterfacePrivate::userEventsQueued();
+ return qGlobalPostedEventsCount() || QWindowSystemInterfacePrivate::windowSystemEventsQueued();
}
void QEventDispatcherQPA::registerSocketNotifier(QSocketNotifier *notifier)
diff --git a/src/gui/kernel/qwindowsysteminterface.cpp b/src/gui/kernel/qwindowsysteminterface.cpp
deleted file mode 100644
index 4cf9ded..0000000
--- a/src/gui/kernel/qwindowsysteminterface.cpp
+++ /dev/null
@@ -1,186 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, 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.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-#include "qwindowsysteminterface.h"
-#include "qapplication_p.h"
-#include <QAbstractEventDispatcher>
-
-QT_BEGIN_NAMESPACE
-
-
-QTime QWindowSystemInterface::eventTime;
-
-//------------------------------------------------------------
-//
-// Callback functions for plugins:
-//
-
-QList<QWindowSystemInterface::UserEvent *> QWindowSystemInterfacePrivate::userEventQueue;
-QMutex QWindowSystemInterfacePrivate::queueMutex;
-
-extern QPointer<QWidget> qt_last_mouse_receiver;
-/*!
-
-\a tlw == 0 means that \a ev is in global coords only
-
-
-*/
-
-
-void QWindowSystemInterface::handleEnterEvent(QWidget *tlw)
-{
- if (tlw) {
- QApplicationPrivate::dispatchEnterLeave(tlw, 0);
- qt_last_mouse_receiver = tlw;
- }
-}
-
-void QWindowSystemInterface::handleLeaveEvent(QWidget *tlw)
-{
- QApplicationPrivate::dispatchEnterLeave(0, qt_last_mouse_receiver);
- if (tlw && !tlw->isAncestorOf(qt_last_mouse_receiver)) //(???) this should not happen
- QApplicationPrivate::dispatchEnterLeave(0, tlw);
- qt_last_mouse_receiver = 0;
-}
-
-void QWindowSystemInterface::handleGeometryChange(QWidget *tlw, const QRect &newRect)
-{
- if (tlw)
- QApplicationPrivate::processGeometryChange(tlw, newRect);
-}
-
-
-void QWindowSystemInterface::handleCloseEvent(QWidget *tlw)
-{
- if (tlw)
- QApplicationPrivate::processCloseEvent(tlw);
-}
-
-void QWindowSystemInterface::handleMouseEvent(QWidget *tlw, ulong timestamp, const QPoint & local, const QPoint & global, Qt::MouseButtons b)
-{
- MouseEvent * e = new MouseEvent(tlw, timestamp, local, global, b);
- QWindowSystemInterfacePrivate::queueUserEvent(e);
-}
-
-void QWindowSystemInterface::handleKeyEvent(QWidget *tlw, ulong timestamp, QEvent::Type t, int k, Qt::KeyboardModifiers mods, const QString & text, bool autorep, ushort count)
-{
- KeyEvent * e = new KeyEvent(tlw, timestamp, t, k, mods, text, autorep, count);
- QWindowSystemInterfacePrivate::queueUserEvent(e);
-}
-
-void QWindowSystemInterface::handleWheelEvent(QWidget *tlw, ulong timestamp, const QPoint & local, const QPoint & global, int d, Qt::Orientation o)
-{
- WheelEvent *e = new WheelEvent(tlw, timestamp, local, global, d, o);
- QWindowSystemInterfacePrivate::queueUserEvent(e);
-}
-
-QWindowSystemInterface::UserEvent * QWindowSystemInterfacePrivate::getUserEvent()
-{
- queueMutex.lock();
- QWindowSystemInterface::UserEvent *ret;
- if (userEventQueue.isEmpty())
- ret = 0;
- else
- ret = userEventQueue.takeFirst();
- queueMutex.unlock();
- return ret;
-}
-
-void QWindowSystemInterfacePrivate::queueUserEvent(QWindowSystemInterface::UserEvent *ev)
-{
- queueMutex.lock();
- userEventQueue.append(ev);
- queueMutex.unlock();
-
- QAbstractEventDispatcher *dispatcher = QApplicationPrivate::qt_qpa_core_dispatcher();
- if (dispatcher)
- dispatcher->wakeUp();
-}
-
-void QWindowSystemInterface::handleTouchEvent(QWidget *tlw, ulong timestamp, QEvent::Type type, QTouchEvent::DeviceType devType, const QList<struct TouchPoint> &points)
-{
- if (!points.size()) // Touch events must have at least one point
- return;
-
- QList<QTouchEvent::TouchPoint> touchPoints;
- Qt::TouchPointStates states;
- QTouchEvent::TouchPoint p;
-
- int primaryPoint = -1;
- QList<struct TouchPoint>::const_iterator point = points.constBegin();
- QList<struct TouchPoint>::const_iterator end = points.constEnd();
- while (point != end) {
- p.setId(point->id);
- p.setPressure(point->pressure);
- states |= point->state;
- Qt::TouchPointStates state = point->state;
- if (point->isPrimary) {
- state |= Qt::TouchPointPrimary;
- primaryPoint = point->id;
- }
- p.setState(state);
- p.setRect(point->area);
- p.setScreenPos(point->area.center());
- p.setNormalizedPos(point->normalPosition);
-
- touchPoints.append(p);
- ++point;
- }
-
- TouchEvent *e = new TouchEvent(tlw, timestamp, type, devType, touchPoints);
- QWindowSystemInterfacePrivate::queueUserEvent(e);
-}
-
-void QWindowSystemInterface::handleScreenGeometryChange(int screenIndex)
-{
- QApplicationPrivate::reportGeometryChange(screenIndex);
-}
-
-void QWindowSystemInterface::handleScreenAvailableGeometryChange(int screenIndex)
-{
- QApplicationPrivate::reportAvailableGeometryChange(screenIndex);
-}
-
-void QWindowSystemInterface::handleScreenCountChange(int count)
-{
- QApplicationPrivate::reportScreenCount(count);
-}
-
-QT_END_NAMESPACE
diff --git a/src/gui/kernel/qwindowsysteminterface_qpa.cpp b/src/gui/kernel/qwindowsysteminterface_qpa.cpp
new file mode 100644
index 0000000..dd78e8e
--- /dev/null
+++ b/src/gui/kernel/qwindowsysteminterface_qpa.cpp
@@ -0,0 +1,246 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtGui module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include "qwindowsysteminterface_qpa.h"
+#include "qwindowsysteminterface_qpa_p.h"
+#include "qapplication_p.h"
+#include <QAbstractEventDispatcher>
+
+QT_BEGIN_NAMESPACE
+
+
+QTime QWindowSystemInterfacePrivate::eventTime;
+
+//------------------------------------------------------------
+//
+// Callback functions for plugins:
+//
+
+QList<QWindowSystemInterfacePrivate::WindowSystemEvent *> QWindowSystemInterfacePrivate::windowSystemEventQueue;
+QMutex QWindowSystemInterfacePrivate::queueMutex;
+
+extern QPointer<QWidget> qt_last_mouse_receiver;
+
+
+void QWindowSystemInterface::handleEnterEvent(QWidget *tlw)
+{
+ if (tlw) {
+ QWindowSystemInterfacePrivate::EnterEvent *e = new QWindowSystemInterfacePrivate::EnterEvent(tlw);
+ QWindowSystemInterfacePrivate::queueWindowSystemEvent(e);
+ }
+}
+
+void QWindowSystemInterface::handleLeaveEvent(QWidget *tlw)
+{
+ QWindowSystemInterfacePrivate::LeaveEvent *e = new QWindowSystemInterfacePrivate::LeaveEvent(tlw);
+ QWindowSystemInterfacePrivate::queueWindowSystemEvent(e);
+}
+
+void QWindowSystemInterface::handleGeometryChange(QWidget *tlw, const QRect &newRect)
+{
+ if (!tlw)
+ return;
+ if (!tlw->isWindow())
+ return; //geo of native child widgets is controlled by lighthouse
+ //so we already have sent the events; besides this new rect
+ //is not mapped to parent
+
+ QRect cr(tlw->geometry());
+
+ bool isResize = cr.size() != newRect.size();
+ bool isMove = cr.topLeft() != newRect.topLeft();
+ if (isResize) {
+ QWindowSystemInterfacePrivate::ResizeEvent *resizeEvent =
+ new QWindowSystemInterfacePrivate::ResizeEvent(tlw,newRect.size());
+ QWindowSystemInterfacePrivate::queueWindowSystemEvent(resizeEvent);
+ }
+
+ if (isMove) {
+ QWindowSystemInterfacePrivate::MoveEvent *moveEvent =
+ new QWindowSystemInterfacePrivate::MoveEvent(tlw,newRect.topLeft());
+ QWindowSystemInterfacePrivate::queueWindowSystemEvent(moveEvent);
+ }
+}
+
+
+void QWindowSystemInterface::handleCloseEvent(QWidget *tlw)
+{
+ if (tlw) {
+ QWindowSystemInterfacePrivate::CloseEvent *e =
+ new QWindowSystemInterfacePrivate::CloseEvent(tlw);
+ QWindowSystemInterfacePrivate::queueWindowSystemEvent(e);
+ }
+}
+
+/*!
+
+\a tlw == 0 means that \a ev is in global coords only
+
+
+*/
+void QWindowSystemInterface::handleMouseEvent(QWidget *w, const QPoint & local, const QPoint & global, Qt::MouseButtons b) {
+ unsigned long time = QWindowSystemInterfacePrivate::eventTime.elapsed();
+ handleMouseEvent(w, time, local, global, b);
+}
+
+void QWindowSystemInterface::handleMouseEvent(QWidget *tlw, ulong timestamp, const QPoint & local, const QPoint & global, Qt::MouseButtons b)
+{
+ QWindowSystemInterfacePrivate::MouseEvent * e =
+ new QWindowSystemInterfacePrivate::MouseEvent(tlw, timestamp, local, global, b);
+ QWindowSystemInterfacePrivate::queueWindowSystemEvent(e);
+}
+
+void QWindowSystemInterface::handleKeyEvent(QWidget *w, QEvent::Type t, int k, Qt::KeyboardModifiers mods, const QString & text, bool autorep, ushort count) {
+ unsigned long time = QWindowSystemInterfacePrivate::eventTime.elapsed();
+ handleKeyEvent(w, time, t, k, mods, text, autorep, count);
+}
+
+void QWindowSystemInterface::handleKeyEvent(QWidget *tlw, ulong timestamp, QEvent::Type t, int k, Qt::KeyboardModifiers mods, const QString & text, bool autorep, ushort count)
+{
+ QWindowSystemInterfacePrivate::KeyEvent * e =
+ new QWindowSystemInterfacePrivate::KeyEvent(tlw, timestamp, t, k, mods, text, autorep, count);
+ QWindowSystemInterfacePrivate::queueWindowSystemEvent(e);
+}
+
+void QWindowSystemInterface::handleWheelEvent(QWidget *w, const QPoint & local, const QPoint & global, int d, Qt::Orientation o) {
+ unsigned long time = QWindowSystemInterfacePrivate::eventTime.elapsed();
+ handleWheelEvent(w, time, local, global, d, o);
+}
+
+void QWindowSystemInterface::handleWheelEvent(QWidget *tlw, ulong timestamp, const QPoint & local, const QPoint & global, int d, Qt::Orientation o)
+{
+ QWindowSystemInterfacePrivate::WheelEvent *e =
+ new QWindowSystemInterfacePrivate::WheelEvent(tlw, timestamp, local, global, d, o);
+ QWindowSystemInterfacePrivate::queueWindowSystemEvent(e);
+}
+
+int QWindowSystemInterfacePrivate::windowSystemEventsQueued()
+{
+ queueMutex.lock();
+ int ret = windowSystemEventQueue.count();
+ queueMutex.unlock();
+ return ret;
+}
+
+QWindowSystemInterfacePrivate::WindowSystemEvent * QWindowSystemInterfacePrivate::getWindowSystemEvent()
+{
+ queueMutex.lock();
+ QWindowSystemInterfacePrivate::WindowSystemEvent *ret;
+ if (windowSystemEventQueue.isEmpty())
+ ret = 0;
+ else
+ ret = windowSystemEventQueue.takeFirst();
+ queueMutex.unlock();
+ return ret;
+}
+
+void QWindowSystemInterfacePrivate::queueWindowSystemEvent(QWindowSystemInterfacePrivate::WindowSystemEvent *ev)
+{
+ queueMutex.lock();
+ windowSystemEventQueue.append(ev);
+ queueMutex.unlock();
+
+ QAbstractEventDispatcher *dispatcher = QApplicationPrivate::qt_qpa_core_dispatcher();
+ if (dispatcher)
+ dispatcher->wakeUp();
+}
+
+void QWindowSystemInterface::handleTouchEvent(QWidget *w, QEvent::Type type, QTouchEvent::DeviceType devType, const QList<struct TouchPoint> &points) {
+ unsigned long time = QWindowSystemInterfacePrivate::eventTime.elapsed();
+ handleTouchEvent(w, time, type, devType, points);
+}
+
+void QWindowSystemInterface::handleTouchEvent(QWidget *tlw, ulong timestamp, QEvent::Type type, QTouchEvent::DeviceType devType, const QList<struct TouchPoint> &points)
+{
+ if (!points.size()) // Touch events must have at least one point
+ return;
+
+ QList<QTouchEvent::TouchPoint> touchPoints;
+ Qt::TouchPointStates states;
+ QTouchEvent::TouchPoint p;
+
+ int primaryPoint = -1;
+ QList<struct TouchPoint>::const_iterator point = points.constBegin();
+ QList<struct TouchPoint>::const_iterator end = points.constEnd();
+ while (point != end) {
+ p.setId(point->id);
+ p.setPressure(point->pressure);
+ states |= point->state;
+ Qt::TouchPointStates state = point->state;
+ if (point->isPrimary) {
+ state |= Qt::TouchPointPrimary;
+ primaryPoint = point->id;
+ }
+ p.setState(state);
+ p.setRect(point->area);
+ p.setScreenPos(point->area.center());
+ p.setNormalizedPos(point->normalPosition);
+
+ touchPoints.append(p);
+ ++point;
+ }
+
+ QWindowSystemInterfacePrivate::TouchEvent *e =
+ new QWindowSystemInterfacePrivate::TouchEvent(tlw, timestamp, type, devType, touchPoints);
+ QWindowSystemInterfacePrivate::queueWindowSystemEvent(e);
+}
+
+void QWindowSystemInterface::handleScreenGeometryChange(int screenIndex)
+{
+ QWindowSystemInterfacePrivate::ScreenGeometryEvent *e =
+ new QWindowSystemInterfacePrivate::ScreenGeometryEvent(screenIndex);
+ QWindowSystemInterfacePrivate::queueWindowSystemEvent(e);
+}
+
+void QWindowSystemInterface::handleScreenAvailableGeometryChange(int screenIndex)
+{
+ QWindowSystemInterfacePrivate::ScreenAvailableGeometryEvent *e =
+ new QWindowSystemInterfacePrivate::ScreenAvailableGeometryEvent(screenIndex);
+ QWindowSystemInterfacePrivate::queueWindowSystemEvent(e);
+}
+
+void QWindowSystemInterface::handleScreenCountChange(int count)
+{
+ QWindowSystemInterfacePrivate::ScreenCountEvent *e =
+ new QWindowSystemInterfacePrivate::ScreenCountEvent(count);
+ QWindowSystemInterfacePrivate::queueWindowSystemEvent(e);
+}
+
+QT_END_NAMESPACE
diff --git a/src/gui/kernel/qwindowsysteminterface.h b/src/gui/kernel/qwindowsysteminterface_qpa.h
index 614f983..e57fa8e 100644
--- a/src/gui/kernel/qwindowsysteminterface.h
+++ b/src/gui/kernel/qwindowsysteminterface_qpa.h
@@ -58,22 +58,13 @@ QT_MODULE(Gui)
class Q_GUI_EXPORT QWindowSystemInterface
{
public:
- static void handleMouseEvent(QWidget *w, const QPoint & local, const QPoint & global, Qt::MouseButtons b) {
- handleMouseEvent(w, eventTime.elapsed(), local, global, b);
- }
-
+ static void handleMouseEvent(QWidget *w, const QPoint & local, const QPoint & global, Qt::MouseButtons b);
static void handleMouseEvent(QWidget *w, ulong timestamp, const QPoint & local, const QPoint & global, Qt::MouseButtons b);
- static void handleKeyEvent(QWidget *w, QEvent::Type t, int k, Qt::KeyboardModifiers mods, const QString & text = QString(), bool autorep = false, ushort count = 1) {
- handleKeyEvent(w, eventTime.elapsed(), t, k, mods, text, autorep, count);
- }
-
+ static void handleKeyEvent(QWidget *w, QEvent::Type t, int k, Qt::KeyboardModifiers mods, const QString & text = QString(), bool autorep = false, ushort count = 1);
static void handleKeyEvent(QWidget *w, ulong timestamp, QEvent::Type t, int k, Qt::KeyboardModifiers mods, const QString & text = QString(), bool autorep = false, ushort count = 1);
- static void handleWheelEvent(QWidget *w, const QPoint & local, const QPoint & global, int d, Qt::Orientation o) {
- handleWheelEvent(w, eventTime.elapsed(), local, global, d, o);
- }
-
+ static void handleWheelEvent(QWidget *w, const QPoint & local, const QPoint & global, int d, Qt::Orientation o);
static void handleWheelEvent(QWidget *w, ulong timestamp, const QPoint & local, const QPoint & global, int d, Qt::Orientation o);
struct TouchPoint {
@@ -85,10 +76,7 @@ public:
Qt::TouchPointStates state; //Qt::TouchPoint{Pressed|Moved|Stationary|Released}
};
- static void handleTouchEvent(QWidget *w, QEvent::Type type, QTouchEvent::DeviceType devType, const QList<struct TouchPoint> &points) {
- handleTouchEvent(w, eventTime.elapsed(), type, devType, points);
- }
-
+ static void handleTouchEvent(QWidget *w, QEvent::Type type, QTouchEvent::DeviceType devType, const QList<struct TouchPoint> &points);
static void handleTouchEvent(QWidget *w, ulong timestamp, QEvent::Type type, QTouchEvent::DeviceType devType, const QList<struct TouchPoint> &points);
// delivered directly by the plugin via spontaneous events
@@ -101,67 +89,6 @@ public:
static void handleScreenGeometryChange(int screenIndex);
static void handleScreenAvailableGeometryChange(int screenIndex);
static void handleScreenCountChange(int count);
-
- class UserEvent {
- public:
- UserEvent(QWidget * w, ulong time, QEvent::Type t)
- { widget = QWeakPointer<QWidget>(w); type = t; timestamp = time; }
- QWeakPointer<QWidget> widget;
- QEvent::Type type;
- unsigned long timestamp;
- };
-
- class MouseEvent : public UserEvent {
- public:
- MouseEvent(QWidget * w, ulong time, const QPoint & local, const QPoint & global, Qt::MouseButtons b)
- : UserEvent(w, time, QEvent::MouseMove){ localPos = local; globalPos = global; buttons = b; }
- QPoint localPos;
- QPoint globalPos;
- Qt::MouseButtons buttons;
- };
-
- class WheelEvent : public UserEvent {
- public:
- WheelEvent(QWidget *w, ulong time, const QPoint & local, const QPoint & global, int d, Qt::Orientation o)
- : UserEvent(w, time, QEvent::Wheel) { localPos = local; globalPos = global; delta = d; orient = o; }
- int delta;
- QPoint localPos;
- QPoint globalPos;
- Qt::Orientation orient;
- };
-
- class KeyEvent : public UserEvent {
- public:
- KeyEvent(QWidget *w, ulong time, QEvent::Type t, int k, Qt::KeyboardModifiers mods, const QString & text = QString(), bool autorep = false, ushort count = 1)
- :UserEvent(w, time, t){ key = k; unicode = text; repeat = autorep; repeatCount = count; modifiers = mods; }
- int key;
- QString unicode;
- bool repeat;
- ushort repeatCount;
- Qt::KeyboardModifiers modifiers;
- };
-
- class TouchEvent : public UserEvent {
- public:
- TouchEvent(QWidget *w, ulong time, QEvent::Type t, QTouchEvent::DeviceType d, const QList<QTouchEvent::TouchPoint> &p)
- :UserEvent(w, time, t) { devType = d; points = p; }
- QTouchEvent::DeviceType devType;
- QList<QTouchEvent::TouchPoint> points;
- };
-
-private:
- static QTime eventTime;
-
-};
-
-class QWindowSystemInterfacePrivate {
-public:
- static QList<QWindowSystemInterface::UserEvent *> userEventQueue;
- static QMutex queueMutex;
-
- static int userEventsQueued() { queueMutex.lock(); int ret = userEventQueue.count(); queueMutex.unlock(); return ret; }
- static QWindowSystemInterface::UserEvent * getUserEvent();
- static void queueUserEvent(QWindowSystemInterface::UserEvent *ev);
};
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qwindowsysteminterface_qpa_p.h b/src/gui/kernel/qwindowsysteminterface_qpa_p.h
new file mode 100644
index 0000000..90d1702
--- /dev/null
+++ b/src/gui/kernel/qwindowsysteminterface_qpa_p.h
@@ -0,0 +1,201 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtGui module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#ifndef QWINDOWSYSTEMINTERFACE_QPA_P_H
+#define QWINDOWSYSTEMINTERFACE_QPA_P_H
+
+#include "qwindowsysteminterface_qpa.h"
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+class QWindowSystemInterfacePrivate {
+public:
+ Q_ENUMS(EventType);
+
+ enum EventType {
+ Close,
+ Resize,
+ Move,
+ Enter,
+ Leave,
+ Mouse,
+ Wheel,
+ Key,
+ Touch,
+ ScreenGeometry,
+ ScreenAvailableGeometry,
+ ScreenCountChange
+ };
+
+ class WindowSystemEvent {
+ public:
+ WindowSystemEvent(EventType t)
+ : type(t) { }
+ EventType type;
+ };
+
+ class CloseEvent : public WindowSystemEvent {
+ public:
+ CloseEvent(QWidget *tlw)
+ : WindowSystemEvent(Close), topLevel(tlw) { }
+ QWeakPointer<QWidget> topLevel;
+ };
+
+ class ResizeEvent : public WindowSystemEvent {
+ public:
+ ResizeEvent(QWidget *sizeChanged, const QSize &newSize)
+ : WindowSystemEvent(Resize), sizeChanged(sizeChanged), newSize(newSize)
+ { }
+ QWeakPointer<QWidget> sizeChanged;
+ QSize newSize;
+ };
+
+ class MoveEvent : public WindowSystemEvent {
+ public:
+ MoveEvent(QWidget *moved, const QPoint &newPos)
+ : WindowSystemEvent(Move), moved(moved), newPos(newPos)
+ { }
+ QWeakPointer<QWidget> moved;
+ QPoint newPos;
+ };
+
+ class EnterEvent : public WindowSystemEvent {
+ public:
+ EnterEvent(QWidget *enter)
+ : WindowSystemEvent(Enter), enter(enter)
+ { }
+ QWeakPointer<QWidget> enter;
+ };
+
+ class LeaveEvent : public WindowSystemEvent {
+ public:
+ LeaveEvent(QWidget *leave)
+ : WindowSystemEvent(Leave), leave(leave)
+ { }
+ QWeakPointer<QWidget> leave;
+ };
+
+ class UserEvent : public WindowSystemEvent {
+ public:
+ UserEvent(QWidget * w, ulong time, EventType t)
+ : WindowSystemEvent(t), widget(w), timestamp(time) { }
+ QWeakPointer<QWidget> widget;
+ unsigned long timestamp;
+ };
+
+ class MouseEvent : public UserEvent {
+ public:
+ MouseEvent(QWidget * w, ulong time, const QPoint & local, const QPoint & global, Qt::MouseButtons b)
+ : UserEvent(w, time, Mouse), localPos(local), globalPos(global), buttons(b) { }
+ QPoint localPos;
+ QPoint globalPos;
+ Qt::MouseButtons buttons;
+ };
+
+ class WheelEvent : public UserEvent {
+ public:
+ WheelEvent(QWidget *w, ulong time, const QPoint & local, const QPoint & global, int d, Qt::Orientation o)
+ : UserEvent(w, time, Wheel), delta(d), localPos(local), globalPos(global), orient(o) { }
+ int delta;
+ QPoint localPos;
+ QPoint globalPos;
+ Qt::Orientation orient;
+ };
+
+ class KeyEvent : public UserEvent {
+ public:
+ KeyEvent(QWidget *w, ulong time, QEvent::Type t, int k, Qt::KeyboardModifiers mods, const QString & text = QString(), bool autorep = false, ushort count = 1)
+ :UserEvent(w, time, Key), key(k), unicode(text), repeat(autorep),
+ repeatCount(count), modifiers(mods), keyType(t) { }
+ int key;
+ QString unicode;
+ bool repeat;
+ ushort repeatCount;
+ Qt::KeyboardModifiers modifiers;
+ QEvent::Type keyType;
+ };
+
+ class TouchEvent : public UserEvent {
+ public:
+ TouchEvent(QWidget *w, ulong time, QEvent::Type t, QTouchEvent::DeviceType d, const QList<QTouchEvent::TouchPoint> &p)
+ :UserEvent(w, time, Touch), devType(d), points(p), touchType(t) { }
+ QTouchEvent::DeviceType devType;
+ QList<QTouchEvent::TouchPoint> points;
+ QEvent::Type touchType;
+
+ };
+
+ class ScreenCountEvent : public WindowSystemEvent {
+ public:
+ ScreenCountEvent (int count)
+ : WindowSystemEvent(ScreenCountChange) , count(count) { }
+ int count;
+ };
+
+ class ScreenGeometryEvent : public WindowSystemEvent {
+ public:
+ ScreenGeometryEvent(int index)
+ : WindowSystemEvent(ScreenGeometry), index(index) { }
+ int index;
+ };
+
+ class ScreenAvailableGeometryEvent : public WindowSystemEvent {
+ public:
+ ScreenAvailableGeometryEvent(int index)
+ : WindowSystemEvent(ScreenAvailableGeometry), index(index) { }
+ int index;
+ };
+
+ static QList<WindowSystemEvent *> windowSystemEventQueue;
+ static QMutex queueMutex;
+
+ static int windowSystemEventsQueued();
+ static WindowSystemEvent * getWindowSystemEvent();
+ static void queueWindowSystemEvent(WindowSystemEvent *ev);
+
+ static QTime eventTime;
+};
+
+QT_END_HEADER
+QT_END_NAMESPACE
+
+#endif // QWINDOWSYSTEMINTERFACE_QPA_P_H