diff options
Diffstat (limited to 'src/gui/kernel/qapplication_p.h')
-rw-r--r-- | src/gui/kernel/qapplication_p.h | 74 |
1 files changed, 70 insertions, 4 deletions
diff --git a/src/gui/kernel/qapplication_p.h b/src/gui/kernel/qapplication_p.h index a93fd63..955a3fc 100644 --- a/src/gui/kernel/qapplication_p.h +++ b/src/gui/kernel/qapplication_p.h @@ -65,8 +65,9 @@ #include "QtCore/qhash.h" #include "QtCore/qpointer.h" #include "private/qcoreapplication_p.h" -#include "private/qshortcutmap_p.h" +#include "QtGui/private/qshortcutmap_p.h" #include <private/qthread_p.h> +#include "QtCore/qpoint.h" #ifdef Q_WS_QWS #include "QtGui/qscreen_qws.h" #include <private/qgraphicssystem_qws_p.h> @@ -564,11 +565,72 @@ public: #endif #ifdef Q_WS_LITE - static void handleMouseEvent(QWidget *tlw, const QMouseEvent &ev); - static void handleKeyEvent(QWidget *tlw, QKeyEvent *e); + + class UserEvent { + public: + UserEvent(QWidget *w) { tlw = w; } + QWidget * tlw; + QEvent::Type type; + }; + + class MouseEvent : public UserEvent { + public: + MouseEvent(QWidget *w, const QPoint & local, const QPoint & global, Qt::MouseButtons b) + : UserEvent(w){ localPos = local; globalPos = global; buttons = b; type = QEvent::MouseMove; } + QPoint localPos; + QPoint globalPos; + Qt::MouseButtons buttons; + }; + + class WheelEvent : public UserEvent { + public: + WheelEvent(QWidget *w, const QPoint & local, const QPoint & global, int d, Qt::Orientation o) + : UserEvent(w) { localPos = local; globalPos = global; delta = d; orient = o; type = QEvent::Wheel; } + int delta; + QPoint localPos; + QPoint globalPos; + Qt::Orientation orient; + }; + + class KeyEvent : public UserEvent { + public: + KeyEvent(QWidget *w, QEvent::Type t, int k, Qt::KeyboardModifiers mods, const QString & text = QString(), bool autorep = false, ushort count = 1) + :UserEvent(w){ type = t; key = k; unicode = text; repeat = autorep; repeatCount = count; modifiers = mods; } + int key; + QString unicode; + bool repeat; + ushort repeatCount; + Qt::KeyboardModifiers modifiers; + }; + + static void handleMouseEvent(QWidget *w, const QPoint & local, const QPoint & global, Qt::MouseButtons b) { + MouseEvent * e = new MouseEvent(w, local, global, b); + queueUserEvent(e); + } + + static void handleKeyEvent(QWidget *w, QEvent::Type t, int k, Qt::KeyboardModifiers mods, const QString & text = QString(), bool autorep = false, ushort count = 1) { + KeyEvent * e = new KeyEvent(w, t, k, mods, text, autorep, count); + queueUserEvent(e); + } + + static void handleWheelEvent(QWidget *w, const QPoint & local, const QPoint & global, int d, Qt::Orientation o) { + WheelEvent *e = new WheelEvent(w, local, global, d, o); + queueUserEvent(e); + } + + static void queueUserEvent(UserEvent *ev) { userEventQueue.append(ev); } + static void processUserEvent(UserEvent *e); + static int userEventsQueued() { return userEventQueue.count(); } + static UserEvent * getUserEvent() { return userEventQueue.takeFirst(); } + + // could be private, should only be used by deliverUserEvents() + static void processMouseEvent(MouseEvent *e); + static void processKeyEvent(KeyEvent *e); + static void processWheelEvent(WheelEvent *e); + + // delivered directly by the plugin via spontaneous events static void handleGeometryChange(QWidget *tlw, const QRect &newRect); static void handleCloseEvent(QWidget *tlw); - static void handleWheelEvent(QWidget *tlw, QWheelEvent &e); static void handleEnterEvent(QWidget *tlw); static void handleLeaveEvent(QWidget *tlw); #endif @@ -587,6 +649,10 @@ private: static QHash<TInt, TUint> scanCodeCache; #endif +#ifdef Q_WS_LITE + static QList<UserEvent *> userEventQueue; +#endif + static QApplicationPrivate *self; static void giveFocusAccordingToFocusPolicy(QWidget *w, |