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 <faure@kde.org>
This commit is contained in:
parent
0026b80cd2
commit
bcb5e564ff
@ -877,7 +877,7 @@ void QGuiApplicationPrivate::init()
|
||||
|
||||
is_app_running = true;
|
||||
init_plugins(pluginList);
|
||||
QWindowSystemInterface::sendWindowSystemEvents(QCoreApplicationPrivate::eventDispatcher, QEventLoop::AllEvents);
|
||||
QWindowSystemInterface::sendWindowSystemEvents(QEventLoop::AllEvents);
|
||||
}
|
||||
|
||||
extern void qt_cleanupFontDatabase();
|
||||
|
@ -499,7 +499,7 @@ void QWindowSystemInterface::handleSynchronousExposeEvent(QWindow *tlw, const QR
|
||||
QGuiApplicationPrivate::processWindowSystemEvent(&e); // send event immediately.
|
||||
}
|
||||
|
||||
bool QWindowSystemInterface::sendWindowSystemEvents(QAbstractEventDispatcher *eventDispatcher, QEventLoop::ProcessEventsFlags flags)
|
||||
bool QWindowSystemInterface::sendWindowSystemEvents(QEventLoop::ProcessEventsFlags flags)
|
||||
{
|
||||
int nevents = 0;
|
||||
|
||||
|
@ -178,7 +178,7 @@ public:
|
||||
|
||||
|
||||
// For event dispatcher implementations
|
||||
static bool sendWindowSystemEvents(QAbstractEventDispatcher *eventDispatcher, QEventLoop::ProcessEventsFlags flags);
|
||||
static bool sendWindowSystemEvents(QEventLoop::ProcessEventsFlags flags);
|
||||
static int windowSystemEventsQueued();
|
||||
};
|
||||
|
||||
|
@ -71,10 +71,9 @@ static gboolean userEventSourceCheck(GSource *source)
|
||||
return userEventSourcePrepare(source, 0);
|
||||
}
|
||||
|
||||
static gboolean userEventSourceDispatch(GSource *s, GSourceFunc, gpointer)
|
||||
static gboolean userEventSourceDispatch(GSource *, GSourceFunc, gpointer)
|
||||
{
|
||||
GUserEventSource * source = reinterpret_cast<GUserEventSource *>(s);
|
||||
QWindowSystemInterface::sendWindowSystemEvents(source->q, QEventLoop::AllEvents);
|
||||
QWindowSystemInterface::sendWindowSystemEvents(QEventLoop::AllEvents);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -67,7 +67,7 @@ QUnixEventDispatcherQPA::~QUnixEventDispatcherQPA()
|
||||
|
||||
bool QUnixEventDispatcherQPA::processEvents(QEventLoop::ProcessEventsFlags flags)
|
||||
{
|
||||
bool didSendEvents = QWindowSystemInterface::sendWindowSystemEvents(this, flags);
|
||||
const bool didSendEvents = QWindowSystemInterface::sendWindowSystemEvents(flags);
|
||||
|
||||
if (QEventDispatcherUNIX::processEvents(flags)) {
|
||||
return true;
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
@ -64,35 +64,18 @@ QT_BEGIN_NAMESPACE
|
||||
\ingroup qt-lighthouse-win
|
||||
*/
|
||||
|
||||
typedef QStack<QWindowsGuiEventDispatcher::DispatchContext> DispatchContextStack;
|
||||
|
||||
Q_GLOBAL_STATIC(DispatchContextStack, dispatchContextStack)
|
||||
|
||||
QWindowsGuiEventDispatcher::QWindowsGuiEventDispatcher(QObject *parent) :
|
||||
QEventDispatcherWin32(parent)
|
||||
QEventDispatcherWin32(parent), m_flags(0)
|
||||
{
|
||||
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()
|
||||
{
|
||||
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.
|
||||
|
@ -46,6 +46,7 @@
|
||||
#include "qtwindows_additional.h"
|
||||
|
||||
#include <QtCore/QPair>
|
||||
#include <QtCore/QEventLoop>
|
||||
#include <QtCore/private/qeventdispatcher_win_p.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
@ -55,16 +56,14 @@ class QWindowsGuiEventDispatcher : public QEventDispatcherWin32
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit QWindowsGuiEventDispatcher(QObject *parent = 0);
|
||||
~QWindowsGuiEventDispatcher();
|
||||
|
||||
typedef QPair<QAbstractEventDispatcher *, QEventLoop::ProcessEventsFlags> 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
|
||||
|
@ -306,13 +306,13 @@ void tst_QGuiApplication::keyboardModifiers()
|
||||
QPoint global = window->mapToGlobal(center);
|
||||
QPoint delta(0, 1);
|
||||
QWindowSystemInterface::handleWheelEvent(window, center, global, delta, delta, Qt::NoModifier);
|
||||
QWindowSystemInterface::sendWindowSystemEvents(app.eventDispatcher(), QEventLoop::AllEvents);
|
||||
QWindowSystemInterface::sendWindowSystemEvents(QEventLoop::AllEvents);
|
||||
QCOMPARE(QGuiApplication::keyboardModifiers(), Qt::NoModifier);
|
||||
QWindowSystemInterface::handleWheelEvent(window, center, global, delta, delta, Qt::AltModifier);
|
||||
QWindowSystemInterface::sendWindowSystemEvents(app.eventDispatcher(), QEventLoop::AllEvents);
|
||||
QWindowSystemInterface::sendWindowSystemEvents(QEventLoop::AllEvents);
|
||||
QCOMPARE(QGuiApplication::keyboardModifiers(), Qt::AltModifier);
|
||||
QWindowSystemInterface::handleWheelEvent(window, center, global, delta, delta, Qt::ControlModifier);
|
||||
QWindowSystemInterface::sendWindowSystemEvents(app.eventDispatcher(), QEventLoop::AllEvents);
|
||||
QWindowSystemInterface::sendWindowSystemEvents(QEventLoop::AllEvents);
|
||||
QCOMPARE(QGuiApplication::keyboardModifiers(), Qt::ControlModifier);
|
||||
|
||||
// touch events
|
||||
|
Loading…
Reference in New Issue
Block a user