From 07818c429c6abaa7b7246d3e7cdcfbe642304145 Mon Sep 17 00:00:00 2001 From: Olli Werwolff Date: Wed, 25 May 2011 09:52:25 +0200 Subject: [PATCH] Declaration of QEventDispatcherWin32Private in private header file As the class will be used as a base class for QEventDispatcherQPA its declaration has to be accessible from there. Reviewed-by: Friedemann Kleint --- src/corelib/kernel/qeventdispatcher_win.cpp | 72 ++------------------- src/corelib/kernel/qeventdispatcher_win_p.h | 71 ++++++++++++++++++++ 2 files changed, 75 insertions(+), 68 deletions(-) diff --git a/src/corelib/kernel/qeventdispatcher_win.cpp b/src/corelib/kernel/qeventdispatcher_win.cpp index d80b0ef560..fc66e9bfd6 100644 --- a/src/corelib/kernel/qeventdispatcher_win.cpp +++ b/src/corelib/kernel/qeventdispatcher_win.cpp @@ -50,7 +50,6 @@ #include "qvarlengtharray.h" #include "qwineventnotifier_p.h" -#include "qabstracteventdispatcher_p.h" #include "qcoreapplication_p.h" #include #include @@ -280,32 +279,6 @@ int WSAAsyncSelect(SOCKET, HWND, unsigned int, long) class QEventDispatcherWin32Private; -struct QSockNot { - QSocketNotifier *obj; - int fd; -}; -typedef QHash QSNDict; - -struct WinTimerInfo { // internal timer info - QObject *dispatcher; - int timerId; - int interval; - QObject *obj; // - object to receive events - bool inTimerEvent; - int fastTimerId; -}; - -class QZeroTimerEvent : public QTimerEvent -{ -public: - inline QZeroTimerEvent(int timerId) - : QTimerEvent(timerId) - { t = QEvent::ZeroTimerEvent; } -}; - -typedef QList WinTimerVec; // vector of TimerInfo structs -typedef QHash WinTimerDict; // fast dict of timers - #if !defined(DWORD_PTR) && !defined(Q_OS_WIN64) #define DWORD_PTR DWORD #endif @@ -338,47 +311,6 @@ static void resolveTimerAPI() } } - -class QEventDispatcherWin32Private : public QAbstractEventDispatcherPrivate -{ - Q_DECLARE_PUBLIC(QEventDispatcherWin32) -public: - QEventDispatcherWin32Private(); - ~QEventDispatcherWin32Private(); - - DWORD threadId; - - bool interrupt; - - // internal window handle used for socketnotifiers/timers/etc - HWND internalHwnd; - HHOOK getMessageHook; - - // for controlling when to send posted events - QAtomicInt serialNumber; - int lastSerialNumber, sendPostedEventsWindowsTimerId; - QAtomicInt wakeUps; - - // timers - WinTimerVec timerVec; - WinTimerDict timerDict; - void registerTimer(WinTimerInfo *t); - void unregisterTimer(WinTimerInfo *t, bool closingDown = false); - void sendTimerEvent(int timerId); - - // socket notifiers - QSNDict sn_read; - QSNDict sn_write; - QSNDict sn_except; - void doWsaAsyncSelect(int socket); - - QList winEventNotifierList; - void activateEventNotifier(QWinEventNotifier * wen); - - QList queuedUserInputEvents; - QList queuedSocketEvents; -}; - QEventDispatcherWin32Private::QEventDispatcherWin32Private() : threadId(GetCurrentThreadId()), interrupt(false), internalHwnd(0), getMessageHook(0), serialNumber(0), lastSerialNumber(0), sendPostedEventsWindowsTimerId(0), wakeUps(0) @@ -703,6 +635,10 @@ QEventDispatcherWin32::QEventDispatcherWin32(QObject *parent) { } +QEventDispatcherWin32::QEventDispatcherWin32(QEventDispatcherWin32Private &dd, QObject *parent) + : QAbstractEventDispatcher(dd, parent) +{ } + QEventDispatcherWin32::~QEventDispatcherWin32() { } diff --git a/src/corelib/kernel/qeventdispatcher_win_p.h b/src/corelib/kernel/qeventdispatcher_win_p.h index 8fa77fdc4e..4a7aac0c04 100644 --- a/src/corelib/kernel/qeventdispatcher_win_p.h +++ b/src/corelib/kernel/qeventdispatcher_win_p.h @@ -56,6 +56,8 @@ #include "QtCore/qabstracteventdispatcher.h" #include "QtCore/qt_windows.h" +#include "qabstracteventdispatcher_p.h" + QT_BEGIN_NAMESPACE class QWinEventNotifier; @@ -100,11 +102,80 @@ public: bool event(QEvent *e); +protected: + QEventDispatcherWin32(QEventDispatcherWin32Private &dd, QObject *parent = 0); + private: friend LRESULT QT_WIN_CALLBACK qt_internal_proc(HWND hwnd, UINT message, WPARAM wp, LPARAM lp); friend LRESULT QT_WIN_CALLBACK qt_GetMessageHook(int, WPARAM, LPARAM); }; +struct QSockNot { + QSocketNotifier *obj; + int fd; +}; +typedef QHash QSNDict; + +struct WinTimerInfo { // internal timer info + QObject *dispatcher; + int timerId; + int interval; + QObject *obj; // - object to receive events + bool inTimerEvent; + int fastTimerId; +}; + +class QZeroTimerEvent : public QTimerEvent +{ +public: + inline QZeroTimerEvent(int timerId) + : QTimerEvent(timerId) + { t = QEvent::ZeroTimerEvent; } +}; + +typedef QList WinTimerVec; // vector of TimerInfo structs +typedef QHash WinTimerDict; // fast dict of timers + +class Q_CORE_EXPORT QEventDispatcherWin32Private : public QAbstractEventDispatcherPrivate +{ + Q_DECLARE_PUBLIC(QEventDispatcherWin32) +public: + QEventDispatcherWin32Private(); + ~QEventDispatcherWin32Private(); + + DWORD threadId; + + bool interrupt; + + // internal window handle used for socketnotifiers/timers/etc + HWND internalHwnd; + HHOOK getMessageHook; + + // for controlling when to send posted events + QAtomicInt serialNumber; + int lastSerialNumber, sendPostedEventsWindowsTimerId; + QAtomicInt wakeUps; + + // timers + WinTimerVec timerVec; + WinTimerDict timerDict; + void registerTimer(WinTimerInfo *t); + void unregisterTimer(WinTimerInfo *t, bool closingDown = false); + void sendTimerEvent(int timerId); + + // socket notifiers + QSNDict sn_read; + QSNDict sn_write; + QSNDict sn_except; + void doWsaAsyncSelect(int socket); + + QList winEventNotifierList; + void activateEventNotifier(QWinEventNotifier * wen); + + QList queuedUserInputEvents; + QList queuedSocketEvents; +}; + QT_END_NAMESPACE #endif // QEVENTDISPATCHER_WIN_P_H