[qt/f15] improved filter_event patch (kde#275469)

Rex Dieter rdieter at fedoraproject.org
Tue Jan 10 13:39:47 UTC 2012


commit 06c0842112c1652bb5a7903ff4e5850269f430c3
Author: Rex Dieter <rdieter at fedoraproject.org>
Date:   Tue Jan 10 07:39:50 2012 -0600

    improved filter_event patch (kde#275469)

 ...rywhere-opensource-src-4.7.4-filter_event.patch |   99 ++++++++++++++++++--
 qt.spec                                            |    8 +-
 2 files changed, 97 insertions(+), 10 deletions(-)
---
diff --git a/qt-everywhere-opensource-src-4.7.4-filter_event.patch b/qt-everywhere-opensource-src-4.7.4-filter_event.patch
index 4c0c824..ad18ce6 100644
--- a/qt-everywhere-opensource-src-4.7.4-filter_event.patch
+++ b/qt-everywhere-opensource-src-4.7.4-filter_event.patch
@@ -1,15 +1,98 @@
 --- 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	2011-12-27 07:16:23.631320047 -0500
-@@ -4190,6 +4190,12 @@ bool QETWidget::translateMouseEvent(cons
++++ 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, just before processing nextEvent,
-+                // pass it through QAbstractEventDispatcher::filterEvent().  Note that this issue may
-+                // exist elsewhere, wherever events are compressed in a similar manner.
-+                if (QAbstractEventDispatcher::instance()->filterEvent(&nextEvent))
-+                    continue;
-                 qApp->x11ProcessEvent(&nextEvent);
++                // 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))
diff --git a/qt.spec b/qt.spec
index 8bfa602..cf31cfc 100644
--- a/qt.spec
+++ b/qt.spec
@@ -18,7 +18,7 @@ Summary: Qt toolkit
 Name:    qt
 Epoch:   1
 Version: 4.7.4
-Release: 9%{?dist}
+Release: 10%{?dist}
 
 # See LGPL_EXCEPTIONS.txt, LICENSE.GPL3, respectively, for exception details
 License: (LGPLv2 with exceptions or GPLv3 with exceptions) and ASL 2.0 and BSD and FTL and MIT
@@ -96,6 +96,7 @@ Patch73: qt-everywhere-opensource-src-4.7.4-qml_no_strict_aliasing.patch
 Patch74: qt-everywhere-opensource-src-4.7.4-tds_no_strict_aliasing.patch
 
 # avoid dropping events, which lead to "ghost entries in kde task manager" problem
+# https://bugs.kde.org/275469
 Patch75: qt-everywhere-opensource-src-4.7.4-filter_event.patch
 
 # upstream patches
@@ -1309,11 +1310,14 @@ fi
 
 
 %changelog
+* Tue Jan 10 2012 Rex Dieter <rdieter at fedoraproject.org> 1:4.7.4-10
+- improved filter_event patch (kde#275469)
+
 * Mon Jan 09 2012 Than Ngo <than at redhat.com> - 1:4.7.4-9
 - bz#772128, CVE-2011-3922, Stack-based buffer overflow in embedded harfbuzz code
 
 * Tue Dec 27 2011 Rex Dieter <rdieter at fedoraproject.org> 1:4.7.4-8
-- filter event patch, an attempt to avoid "ghost entries in kde taskbar" problem
+- filter event patch, an attempt to avoid "ghost entries in kde taskbar" (kde#275469)
 
 * Wed Nov 16 2011 Rex Dieter <rdieter at fedoraproject.org> 1:4.7.4-7
 - drop kde-qt 0012 patch, it's broken if not upstream (#704882)


More information about the scm-commits mailing list