qt/qt-everywhere-opensource-sr...

99 lines
4.8 KiB
Diff

--- qt-opensource-4.8.0.old/src/gui/kernel/qapplication_x11.cpp 2011-12-16 03:22:33.918428374 -0500
+++ qt-opensource-4.8.0.new/src/gui/kernel/qapplication_x11.cpp 2012-01-07 18:18:40.258246384 -0500
@@ -4244,7 +4205,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.8.0.old/src/gui/kernel/qclipboard_x11.cpp 2011-12-08 00:06:02.000000000 -0500
+++ qt-opensource-4.8.0.new/src/gui/kernel/qclipboard_x11.cpp 2012-01-07 18:30:35.298287639 -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.8.0.old/src/gui/kernel/qdnd_x11.cpp 2011-12-08 00:06:02.000000000 -0500
+++ qt-opensource-4.8.0.new/src/gui/kernel/qdnd_x11.cpp 2012-01-07 18:28:13.841279478 -0500
@@ -42,6 +42,7 @@
#include "qplatformdefs.h"
#include "qapplication.h"
+#include "qabstracteventdispatcher.h"
#ifndef QT_NO_DRAGANDDROP
@@ -1941,7 +1942,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.8.0.old/src/gui/kernel/qwidget_x11.cpp 2011-12-08 00:06:02.000000000 -0500
+++ qt-opensource-4.8.0.new/src/gui/kernel/qwidget_x11.cpp 2012-01-07 18:29:26.286283657 -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"
@@ -376,17 +377,22 @@ void qt_x11_wait_for_window_manager(QWid
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))