--- qt-opensource-4.7.4.old/src/gui/kernel/qapplication_x11.cpp 2011-08-23 08:02:27.000000000 -0400
+++ qt-opensource-4.7.4.new/src/gui/kernel/qapplication_x11.cpp 2012-01-07 18:19:21.978248791 -0500
@@ -4190,7 +4151,12 @@ bool QETWidget::translateMouseEvent(cons
&& (nextEvent.xclient.message_type == ATOM(_QT_SCROLL_DONE) ||
(nextEvent.xclient.message_type == ATOM(WM_PROTOCOLS) &&
(Atom)nextEvent.xclient.data.l[0] == ATOM(_NET_WM_SYNC_REQUEST))))) {
- qApp->x11ProcessEvent(&nextEvent);
+ // As we may run through a significant number of a large class of non-MotionNotify
+ // events here, without returning to the event loop, first pass nextEvent to
+ // QAbstractEventDispatcher::filterEvent() to allow applications which override
+ // QAbstractEventDispatcher::filterEvent() to handle the event first.
+ if (!QAbstractEventDispatcher::instance()->filterEvent(&nextEvent))
+ qApp->x11ProcessEvent(&nextEvent);
continue;
} else if (nextEvent.type != MotionNotify ||
nextEvent.xmotion.window != event->xmotion.window ||
--- qt-opensource-4.7.4.old/src/gui/kernel/qclipboard_x11.cpp 2011-08-23 08:02:27.000000000 -0400
+++ qt-opensource-4.7.4.new/src/gui/kernel/qclipboard_x11.cpp 2012-01-07 18:30:51.266288560 -0500
@@ -573,7 +573,11 @@ bool QX11Data::clipboardWaitForEvent(Win
// process other clipboard events, since someone is probably requesting data from us
XEvent e;
- if (XCheckIfEvent(X11->display, &e, checkForClipboardEvents, 0))
+ // Some applications may override QAbstractEventDispatcher::filterEvent(), so
+ // pass event to QAbstractEventDispatcher::filterEvent() before processing in
+ // x11ProcessEvent().
+ if (XCheckIfEvent(X11->display, &e, checkForClipboardEvents, 0) &&
+ !QAbstractEventDispatcher::instance()->filterEvent(&e))
qApp->x11ProcessEvent(&e);
now.start();
--- qt-opensource-4.7.4.old/src/gui/kernel/qdnd_x11.cpp 2011-08-23 08:02:27.000000000 -0400
+++ qt-opensource-4.7.4.new/src/gui/kernel/qdnd_x11.cpp 2012-01-07 18:28:56.115281917 -0500
@@ -42,6 +42,7 @@
#include "qplatformdefs.h"
#include "qapplication.h"
+#include "qabstracteventdispatcher.h"
#ifndef QT_NO_DRAGANDDROP
@@ -1940,7 +1941,11 @@ Qt::DropAction QDragManager::drag(QDrag
timer.start();
do {
XEvent event;
- if (XCheckTypedEvent(X11->display, ClientMessage, &event))
+ // Some applications may override QAbstractEventDispatcher::filterEvent(), so
+ // pass event to QAbstractEventDispatcher::filterEvent() before processing in
+ // x11ProcessEvent().
+ if (XCheckTypedEvent(X11->display, ClientMessage, &event) &&
+ !QAbstractEventDispatcher::instance()->filterEvent(&event))
qApp->x11ProcessEvent(&event);
// sleep 50 ms, so we don't use up CPU cycles all the time.
--- qt-opensource-4.7.4.old/src/gui/kernel/qwidget_x11.cpp 2011-08-23 08:02:27.000000000 -0400
+++ qt-opensource-4.7.4.new/src/gui/kernel/qwidget_x11.cpp 2012-01-07 18:29:41.915284562 -0500
@@ -44,6 +44,7 @@
#include "qdesktopwidget.h"
#include "qapplication.h"
#include "qapplication_p.h"
+#include "qabstracteventdispatcher.h"
#include "qnamespace.h"
#include "qpainter.h"
#include "qbitmap.h"
@@ -375,17 +376,22 @@ Q_GUI_EXPORT void qt_x11_wait_for_window
do {
if (XEventsQueued(X11->display, QueuedAlready)) {
XNextEvent(X11->display, &ev);
- qApp->x11ProcessEvent(&ev);
-
- switch (state) {
- case Initial:
- if (ev.type == MapNotify && ev.xany.window == winid)
- state = Mapped;
- break;
- case Mapped:
- if (ev.type == Expose && ev.xany.window == winid)
- return;
- break;
+ // Some applications may override QAbstractEventDispatcher::filterEvent(), so
+ // pass event to QAbstractEventDispatcher::filterEvent() before processing in
+ // x11ProcessEvent().
+ if (!QAbstractEventDispatcher::instance()->filterEvent(&ev)) {
+ qApp->x11ProcessEvent(&ev);
+
+ switch (state) {
+ case Initial:
+ if (ev.type == MapNotify && ev.xany.window == winid)
+ state = Mapped;
+ break;
+ case Mapped:
+ if (ev.type == Expose && ev.xany.window == winid)
+ return;
+ break;
+ }
}
} else {
if (!XEventsQueued(X11->display, QueuedAfterFlush))