summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorJohn Stanley <jpsinthemix@verizon.net>2012-01-18 01:04:59 (GMT)
committerQt by Nokia <qt-info@nokia.com>2012-02-10 15:11:54 (GMT)
commit1095252559a937efcaaf012d8dfbb4e13c4fd6b5 (patch)
treeb595f56246fed2c8768d9149429b801e775c789a /src/gui
parent7252bda693ab99cb2e8013a1c7a051ae17ba7956 (diff)
downloadQt-1095252559a937efcaaf012d8dfbb4e13c4fd6b5.zip
Qt-1095252559a937efcaaf012d8dfbb4e13c4fd6b5.tar.gz
Qt-1095252559a937efcaaf012d8dfbb4e13c4fd6b5.tar.bz2
Pass events to installed event dispatcher event filters before passing them to x11ProcessEvent()
Change-Id: If551c732b520b0105a3d4578db1b039c1b5d49fd Pass events to eventFilter first Change-Id: If551c732b520b0105a3d4578db1b039c1b5d49fd Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/kernel/qclipboard_x11.cpp5
-rw-r--r--src/gui/kernel/qdnd_x11.cpp6
-rw-r--r--src/gui/kernel/qwidget_x11.cpp27
3 files changed, 25 insertions, 13 deletions
diff --git a/src/gui/kernel/qclipboard_x11.cpp b/src/gui/kernel/qclipboard_x11.cpp
index 803b1ba..72110ed 100644
--- a/src/gui/kernel/qclipboard_x11.cpp
+++ b/src/gui/kernel/qclipboard_x11.cpp
@@ -579,7 +579,10 @@ bool QX11Data::clipboardWaitForEvent(Window win, int type, XEvent *event, int ti
// process other clipboard events, since someone is probably requesting data from us
XEvent e;
- if (XCheckIfEvent(X11->display, &e, checkForClipboardEvents, 0))
+ // Pass the event through the event dispatcher filter so that applications
+ // which install an event filter on the dispatcher get to handle it first.
+ if (XCheckIfEvent(X11->display, &e, checkForClipboardEvents, 0) &&
+ !QAbstractEventDispatcher::instance()->filterEvent(&e))
qApp->x11ProcessEvent(&e);
now.start();
diff --git a/src/gui/kernel/qdnd_x11.cpp b/src/gui/kernel/qdnd_x11.cpp
index 2b14743..d2050d1 100644
--- a/src/gui/kernel/qdnd_x11.cpp
+++ b/src/gui/kernel/qdnd_x11.cpp
@@ -42,6 +42,7 @@
#include "qplatformdefs.h"
#include "qapplication.h"
+#include "qabstracteventdispatcher.h"
#ifndef QT_NO_DRAGANDDROP
@@ -1967,7 +1968,10 @@ Qt::DropAction QDragManager::drag(QDrag * o)
timer.start();
do {
XEvent event;
- if (XCheckTypedEvent(X11->display, ClientMessage, &event))
+ // Pass the event through the event dispatcher filter so that applications
+ // which install an event filter on the dispatcher get to handle it first.
+ 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.
diff --git a/src/gui/kernel/qwidget_x11.cpp b/src/gui/kernel/qwidget_x11.cpp
index 4cdd6e7..3cff3ee 100644
--- a/src/gui/kernel/qwidget_x11.cpp
+++ b/src/gui/kernel/qwidget_x11.cpp
@@ -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,21 @@ void qt_x11_wait_for_window_manager(QWidget *w, bool sendPostedEvents)
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;
+ // Pass the event through the event dispatcher filter so that applications
+ // which install an event filter on the dispatcher get to handle it first.
+ 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))