QWindowSystemInterfacePrivate::queueWindowSystemEvent(e);
}
+bool QWindowSystemInterface::sendWindowSystemEvents(QAbstractEventDispatcher *eventDispatcher, QEventLoop::ProcessEventsFlags flags)
+{
+ int nevents = 0;
+
+ // handle gui and posted events
+ QCoreApplication::sendPostedEvents();
+
+ while (true) {
+ QWindowSystemInterfacePrivate::WindowSystemEvent *event;
+ if (!(flags & QEventLoop::ExcludeUserInputEvents)
+ && QWindowSystemInterfacePrivate::windowSystemEventsQueued() > 0) {
+ // process a pending user input event
+ event = QWindowSystemInterfacePrivate::getWindowSystemEvent();
+ if (!event)
+ break;
+ } else {
+ break;
+ }
+
+ if (eventDispatcher->filterEvent(event)) {
+ delete event;
+ continue;
+ }
+
+ nevents++;
+
+ QGuiApplicationPrivate::processWindowSystemEvent(event);
+ delete event;
+ }
+
+ return (nevents > 0);
+}
+
QT_END_NAMESPACE
#include <QtCore/QTime>
#include <QtGui/qwindowdefs.h>
#include <QtCore/QEvent>
+#include <QtCore/QAbstractEventDispatcher>
#include <QtGui/QWindow>
#include <QtCore/QWeakPointer>
#include <QtCore/QMutex>
#include <QtGui/QTouchEvent>
+#include <QtCore/QEventLoop>
QT_BEGIN_HEADER
static void handleScreenGeometryChange(int screenIndex);
static void handleScreenAvailableGeometryChange(int screenIndex);
static void handleScreenCountChange(int count);
+
+ // For event dispatcher implementations
+ static bool sendWindowSystemEvents(QAbstractEventDispatcher *eventDispatcher, QEventLoop::ProcessEventsFlags flags);
};
QT_END_NAMESPACE
static gboolean userEventSourceDispatch(GSource *s, GSourceFunc, gpointer)
{
GUserEventSource * source = reinterpret_cast<GUserEventSource *>(s);
-
- QWindowSystemInterfacePrivate::WindowSystemEvent * event;
- while (QWindowSystemInterfacePrivate::windowSystemEventsQueued()) {
- event = QWindowSystemInterfacePrivate::getWindowSystemEvent();
- if (!event)
- break;
-
- // send through event filter
- if (source->q->filterEvent(event)) {
- delete event;
- continue;
- }
- QGuiApplicationPrivate::processWindowSystemEvent(event);
- delete event;
- }
-
+ QWindowSystemInterface::sendWindowSystemEvents(source->q, flags);
return true;
}
-
static GSourceFuncs userEventSourceFuncs = {
userEventSourcePrepare,
userEventSourceCheck,
{
Q_D(QEventDispatcherQPA);
- int nevents = 0;
-
- // handle gui and posted events
- d->interrupt = false;
- QCoreApplication::sendPostedEvents();
-
- while (!d->interrupt) { // also flushes output buffer ###can be optimized
- QWindowSystemInterfacePrivate::WindowSystemEvent *event;
- if (!(flags & QEventLoop::ExcludeUserInputEvents)
- && QWindowSystemInterfacePrivate::windowSystemEventsQueued() > 0) {
- // process a pending user input event
- event = QWindowSystemInterfacePrivate::getWindowSystemEvent();
- if (!event)
- break;
- } else {
- break;
- }
-
- if (filterEvent(event)) {
- delete event;
- continue;
- }
- nevents++;
-
- QGuiApplicationPrivate::processWindowSystemEvent(event);
- delete event;
- }
+ bool didSendEvents = QWindowSystemInterface::sendWindowSystemEvents(this, flags);
-#ifdef Q_OS_MAC // (inverted inheritance on mac: QEventDispatcherMac calls QEventDispatcherQPA)
- if (!d->interrupt) {
- if (EVENTDISPATCHERBASE::processEvents(flags)) {
- EVENTDISPATCHERBASE::processEvents(flags);
- return true;
- }
+ if (EVENTDISPATCHERBASE::processEvents(flags)) {
+ EVENTDISPATCHERBASE::processEvents(flags);
+ return true;
}
-#endif
- return (nevents > 0);
+
+ return didSendEvents;
}
bool QEventDispatcherQPA::hasPendingEvents()
#include <QtCore/qhash.h>
#include <QtCore/qstack.h>
#include <QtGui/qwindowdefs.h>
-#include <QtPlatformSupport/private/qeventdispatcher_qpa_p.h>
+#include <QtCore/private/qeventdispatcher_unix_p.h>
#include <CoreFoundation/CoreFoundation.h>
};
class QCocoaEventDispatcherPrivate;
-class QCocoaEventDispatcher : public QEventDispatcherQPA
+class QCocoaEventDispatcher : public QEventDispatcherUNIX
{
Q_OBJECT
Q_DECLARE_PRIVATE(QCocoaEventDispatcher)
};
typedef QHash<int, MacSocketInfo *> MacSocketHash;
-class QCocoaEventDispatcherPrivate : public QEventDispatcherQPAPrivate
+class QCocoaEventDispatcherPrivate : public QEventDispatcherUNIXPrivate
{
Q_DECLARE_PUBLIC(QCocoaEventDispatcher)
}
QCocoaEventDispatcher::QCocoaEventDispatcher(QObject *parent)
- : QEventDispatcherQPA(*new QCocoaEventDispatcherPrivate, parent)
+ : QEventDispatcherUNIX(*new QCocoaEventDispatcherPrivate, parent)
{
Q_D(QCocoaEventDispatcher);
CFRunLoopSourceContext context;
if (!d->threadData->canWait || (d->serialNumber != d->lastSerial)) {
d->lastSerial = d->serialNumber;
- // Call down to the base class event handler, which will send
- // the window system events.
- d->q_func()->QEventDispatcherQPA::processEvents(QEventLoop::AllEvents);
+ QWindowSystemInterface::sendWindowSystemEvents(d->q_func(), QEventLoop::AllEvents);
}
}