Contents of /trunk/qt4/patches/qt-4.8.0-improved-filter-event.patch
Parent Directory | Revision Log
Revision 1668 -
(show annotations)
(download)
Fri Mar 2 19:29:32 2012 UTC (12 years, 6 months ago) by niro
File size: 4948 byte(s)
Fri Mar 2 19:29:32 2012 UTC (12 years, 6 months ago) by niro
File size: 4948 byte(s)
-added qt-4.8 patches
1 | --- qt-opensource-4.8.0.old/src/gui/kernel/qapplication_x11.cpp 2011-12-16 03:22:33.918428374 -0500 |
2 | +++ qt-opensource-4.8.0.new/src/gui/kernel/qapplication_x11.cpp 2012-01-07 18:18:40.258246384 -0500 |
3 | @@ -4244,7 +4205,12 @@ bool QETWidget::translateMouseEvent(cons |
4 | && (nextEvent.xclient.message_type == ATOM(_QT_SCROLL_DONE) || |
5 | (nextEvent.xclient.message_type == ATOM(WM_PROTOCOLS) && |
6 | (Atom)nextEvent.xclient.data.l[0] == ATOM(_NET_WM_SYNC_REQUEST))))) { |
7 | - qApp->x11ProcessEvent(&nextEvent); |
8 | + // As we may run through a significant number of a large class of non-MotionNotify |
9 | + // events here, without returning to the event loop, first pass nextEvent to |
10 | + // QAbstractEventDispatcher::filterEvent() to allow applications which override |
11 | + // QAbstractEventDispatcher::filterEvent() to handle the event first. |
12 | + if (!QAbstractEventDispatcher::instance()->filterEvent(&nextEvent)) |
13 | + qApp->x11ProcessEvent(&nextEvent); |
14 | continue; |
15 | } else if (nextEvent.type != MotionNotify || |
16 | nextEvent.xmotion.window != event->xmotion.window || |
17 | --- qt-opensource-4.8.0.old/src/gui/kernel/qclipboard_x11.cpp 2011-12-08 00:06:02.000000000 -0500 |
18 | +++ qt-opensource-4.8.0.new/src/gui/kernel/qclipboard_x11.cpp 2012-01-07 18:30:35.298287639 -0500 |
19 | @@ -573,7 +573,11 @@ bool QX11Data::clipboardWaitForEvent(Win |
20 | |
21 | // process other clipboard events, since someone is probably requesting data from us |
22 | XEvent e; |
23 | - if (XCheckIfEvent(X11->display, &e, checkForClipboardEvents, 0)) |
24 | + // Some applications may override QAbstractEventDispatcher::filterEvent(), so |
25 | + // pass event to QAbstractEventDispatcher::filterEvent() before processing in |
26 | + // x11ProcessEvent(). |
27 | + if (XCheckIfEvent(X11->display, &e, checkForClipboardEvents, 0) && |
28 | + !QAbstractEventDispatcher::instance()->filterEvent(&e)) |
29 | qApp->x11ProcessEvent(&e); |
30 | |
31 | now.start(); |
32 | --- qt-opensource-4.8.0.old/src/gui/kernel/qdnd_x11.cpp 2011-12-08 00:06:02.000000000 -0500 |
33 | +++ qt-opensource-4.8.0.new/src/gui/kernel/qdnd_x11.cpp 2012-01-07 18:28:13.841279478 -0500 |
34 | @@ -42,6 +42,7 @@ |
35 | #include "qplatformdefs.h" |
36 | |
37 | #include "qapplication.h" |
38 | +#include "qabstracteventdispatcher.h" |
39 | |
40 | #ifndef QT_NO_DRAGANDDROP |
41 | |
42 | @@ -1941,7 +1942,11 @@ Qt::DropAction QDragManager::drag(QDrag |
43 | timer.start(); |
44 | do { |
45 | XEvent event; |
46 | - if (XCheckTypedEvent(X11->display, ClientMessage, &event)) |
47 | + // Some applications may override QAbstractEventDispatcher::filterEvent(), so |
48 | + // pass event to QAbstractEventDispatcher::filterEvent() before processing in |
49 | + // x11ProcessEvent(). |
50 | + if (XCheckTypedEvent(X11->display, ClientMessage, &event) && |
51 | + !QAbstractEventDispatcher::instance()->filterEvent(&event)) |
52 | qApp->x11ProcessEvent(&event); |
53 | |
54 | // sleep 50 ms, so we don't use up CPU cycles all the time. |
55 | --- qt-opensource-4.8.0.old/src/gui/kernel/qwidget_x11.cpp 2011-12-08 00:06:02.000000000 -0500 |
56 | +++ qt-opensource-4.8.0.new/src/gui/kernel/qwidget_x11.cpp 2012-01-07 18:29:26.286283657 -0500 |
57 | @@ -44,6 +44,7 @@ |
58 | #include "qdesktopwidget.h" |
59 | #include "qapplication.h" |
60 | #include "qapplication_p.h" |
61 | +#include "qabstracteventdispatcher.h" |
62 | #include "qnamespace.h" |
63 | #include "qpainter.h" |
64 | #include "qbitmap.h" |
65 | @@ -376,17 +377,22 @@ void qt_x11_wait_for_window_manager(QWid |
66 | do { |
67 | if (XEventsQueued(X11->display, QueuedAlready)) { |
68 | XNextEvent(X11->display, &ev); |
69 | - qApp->x11ProcessEvent(&ev); |
70 | - |
71 | - switch (state) { |
72 | - case Initial: |
73 | - if (ev.type == MapNotify && ev.xany.window == winid) |
74 | - state = Mapped; |
75 | - break; |
76 | - case Mapped: |
77 | - if (ev.type == Expose && ev.xany.window == winid) |
78 | - return; |
79 | - break; |
80 | + // Some applications may override QAbstractEventDispatcher::filterEvent(), so |
81 | + // pass event to QAbstractEventDispatcher::filterEvent() before processing in |
82 | + // x11ProcessEvent(). |
83 | + if (!QAbstractEventDispatcher::instance()->filterEvent(&ev)) { |
84 | + qApp->x11ProcessEvent(&ev); |
85 | + |
86 | + switch (state) { |
87 | + case Initial: |
88 | + if (ev.type == MapNotify && ev.xany.window == winid) |
89 | + state = Mapped; |
90 | + break; |
91 | + case Mapped: |
92 | + if (ev.type == Expose && ev.xany.window == winid) |
93 | + return; |
94 | + break; |
95 | + } |
96 | } |
97 | } else { |
98 | if (!XEventsQueued(X11->display, QueuedAfterFlush)) |