From bcb5e564ff302517156d881e57577f77bdc30f6e Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Mon, 23 Jul 2012 16:56:11 +0200 Subject: WindowSystemInterface::sendWindowSystemEvents(): Remove unused parameter. No need to pass the dispatcher. Get rid of Windows logic to maintain a stack of dispatcher associated with flags. Change-Id: Ic2daad4b6762a46fac3274937effc188af436c9a Reviewed-by: David Faure --- .../platforms/cocoa/qcocoaeventdispatcher.mm | 2 +- .../qnx/qqnxeventdispatcher_blackberry.cpp | 2 +- .../windows/qwindowsguieventdispatcher.cpp | 39 +++------------------- .../platforms/windows/qwindowsguieventdispatcher.h | 9 +++-- 4 files changed, 11 insertions(+), 41 deletions(-) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm b/src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm index a00f3eb076..3e527c3b7c 100644 --- a/src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm +++ b/src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm @@ -1032,7 +1032,7 @@ void QCocoaEventDispatcherPrivate::processPostedEvents() int serial = serialNumber.load(); if (!threadData->canWait || (serial != lastSerial)) { lastSerial = serial; - QWindowSystemInterface::sendWindowSystemEvents(q_func(), QEventLoop::AllEvents); + QWindowSystemInterface::sendWindowSystemEvents(QEventLoop::AllEvents); } } diff --git a/src/plugins/platforms/qnx/qqnxeventdispatcher_blackberry.cpp b/src/plugins/platforms/qnx/qqnxeventdispatcher_blackberry.cpp index 630171a4ea..39f23c0d6e 100644 --- a/src/plugins/platforms/qnx/qqnxeventdispatcher_blackberry.cpp +++ b/src/plugins/platforms/qnx/qqnxeventdispatcher_blackberry.cpp @@ -58,7 +58,7 @@ QQnxEventDispatcherBlackberry::~QQnxEventDispatcherBlackberry() bool QQnxEventDispatcherBlackberry::processEvents(QEventLoop::ProcessEventsFlags flags) { - bool didSendEvents = QWindowSystemInterface::sendWindowSystemEvents(this, flags); + const bool didSendEvents = QWindowSystemInterface::sendWindowSystemEvents(flags); if (QEventDispatcherBlackberry::processEvents(flags)) return true; diff --git a/src/plugins/platforms/windows/qwindowsguieventdispatcher.cpp b/src/plugins/platforms/windows/qwindowsguieventdispatcher.cpp index dc8c432f27..2ebb3cefbd 100644 --- a/src/plugins/platforms/windows/qwindowsguieventdispatcher.cpp +++ b/src/plugins/platforms/windows/qwindowsguieventdispatcher.cpp @@ -64,35 +64,18 @@ QT_BEGIN_NAMESPACE \ingroup qt-lighthouse-win */ -typedef QStack DispatchContextStack; - -Q_GLOBAL_STATIC(DispatchContextStack, dispatchContextStack) - QWindowsGuiEventDispatcher::QWindowsGuiEventDispatcher(QObject *parent) : - QEventDispatcherWin32(parent) -{ - setObjectName(QStringLiteral("QWindowsGuiEventDispatcher_0x") + QString::number((quintptr)this, 16)); - if (QWindowsContext::verboseEvents) - qDebug("%s %s", __FUNCTION__, qPrintable(objectName())); - dispatchContextStack()->push(DispatchContext(this, QEventLoop::AllEvents)); -} - -QWindowsGuiEventDispatcher::~QWindowsGuiEventDispatcher() + QEventDispatcherWin32(parent), m_flags(0) { - if (QWindowsContext::verboseEvents) - qDebug("%s %s", __FUNCTION__, qPrintable(objectName())); - if (!dispatchContextStack()->isEmpty()) - dispatchContextStack()->pop(); + setObjectName(QStringLiteral("QWindowsGuiEventDispatcher")); } bool QWindowsGuiEventDispatcher::processEvents(QEventLoop::ProcessEventsFlags flags) { - DispatchContextStack &stack = *dispatchContextStack(); + m_flags = flags; if (QWindowsContext::verboseEvents > 2) - qDebug(">%s %s %d", __FUNCTION__, qPrintable(objectName()), stack.size()); - stack.push(DispatchContext(this, flags)); + qDebug(">%s %s %d", __FUNCTION__, qPrintable(objectName()), int(flags)); const bool rc = QEventDispatcherWin32::processEvents(flags); - stack.pop(); if (QWindowsContext::verboseEvents > 2) qDebug("<%s %s returns %d", __FUNCTION__, qPrintable(objectName()), rc); return rc; @@ -100,19 +83,7 @@ bool QWindowsGuiEventDispatcher::processEvents(QEventLoop::ProcessEventsFlags fl void QWindowsGuiEventDispatcher::sendPostedEvents() { - QWindowsGuiEventDispatcher::DispatchContext context = currentDispatchContext(); - Q_ASSERT(context.first != 0); - QWindowSystemInterface::sendWindowSystemEvents(context.first, context.second); -} - -QWindowsGuiEventDispatcher::DispatchContext QWindowsGuiEventDispatcher::currentDispatchContext() -{ - const DispatchContextStack &stack = *dispatchContextStack(); - if (stack.isEmpty()) { - qWarning("%s: No dispatch context", __FUNCTION__); - return DispatchContext(0, 0); - } - return stack.top(); + QWindowSystemInterface::sendWindowSystemEvents(m_flags); } // Helpers for printing debug output for WM_* messages. diff --git a/src/plugins/platforms/windows/qwindowsguieventdispatcher.h b/src/plugins/platforms/windows/qwindowsguieventdispatcher.h index 49c5d8b490..563e613a0e 100644 --- a/src/plugins/platforms/windows/qwindowsguieventdispatcher.h +++ b/src/plugins/platforms/windows/qwindowsguieventdispatcher.h @@ -46,6 +46,7 @@ #include "qtwindows_additional.h" #include +#include #include QT_BEGIN_NAMESPACE @@ -55,16 +56,14 @@ class QWindowsGuiEventDispatcher : public QEventDispatcherWin32 Q_OBJECT public: explicit QWindowsGuiEventDispatcher(QObject *parent = 0); - ~QWindowsGuiEventDispatcher(); - - typedef QPair DispatchContext; - - static DispatchContext currentDispatchContext(); static const char *windowsMessageName(UINT msg); virtual bool QT_ENSURE_STACK_ALIGNED_FOR_SSE processEvents(QEventLoop::ProcessEventsFlags flags); virtual void sendPostedEvents(); + +private: + QEventLoop::ProcessEventsFlags m_flags; }; QT_END_NAMESPACE -- cgit v1.2.3