From 196ca2202d74538ab8d34e47ec8966d4b0a0b8e2 Mon Sep 17 00:00:00 2001 From: "Bradley T. Hughes" Date: Mon, 28 Sep 2009 12:19:10 +0200 Subject: QEventLoop::ExcludeUserInputEvents should not allow the user to close the window These types of input events are not handled by the normal mouse and key event handlers on X11 and Windows. Add special cases for them to make sure that they are not delivered while ExcludeUserInputEvents is set. Task-number: QTBUG-4242 Reviewed-by: Simon Hausmann --- src/corelib/kernel/qeventdispatcher_win.cpp | 3 ++- src/gui/kernel/qeventdispatcher_x11.cpp | 2 +- src/gui/kernel/qguieventdispatcher_glib.cpp | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/corelib/kernel/qeventdispatcher_win.cpp b/src/corelib/kernel/qeventdispatcher_win.cpp index 83114dc..0474bf3 100644 --- a/src/corelib/kernel/qeventdispatcher_win.cpp +++ b/src/corelib/kernel/qeventdispatcher_win.cpp @@ -678,7 +678,8 @@ bool QEventDispatcherWin32::processEvents(QEventLoop::ProcessEventsFlags flags) || (msg.message >= WM_MOUSEFIRST && msg.message <= WM_MOUSELAST) || msg.message == WM_MOUSEWHEEL - || msg.message == WM_MOUSEHWHEEL)) { + || msg.message == WM_MOUSEHWHEEL + || msg.message == WM_CLOSE)) { // queue user input events for later processing haveMessage = false; d->queuedUserInputEvents.append(msg); diff --git a/src/gui/kernel/qeventdispatcher_x11.cpp b/src/gui/kernel/qeventdispatcher_x11.cpp index ce1a11f..59977ec 100644 --- a/src/gui/kernel/qeventdispatcher_x11.cpp +++ b/src/gui/kernel/qeventdispatcher_x11.cpp @@ -105,7 +105,7 @@ bool QEventDispatcherX11::processEvents(QEventLoop::ProcessEventsFlags flags) // _qt_scrolldone protocols, queue all other // client messages if (event.xclient.format == 32) { - if (event.xclient.message_type == ATOM(WM_PROTOCOLS) || + if (event.xclient.message_type == ATOM(WM_PROTOCOLS) && (Atom) event.xclient.data.l[0] == ATOM(WM_TAKE_FOCUS)) { break; } else if (event.xclient.message_type == ATOM(_QT_SCROLL_DONE)) { diff --git a/src/gui/kernel/qguieventdispatcher_glib.cpp b/src/gui/kernel/qguieventdispatcher_glib.cpp index 6e98428..f8a638c 100644 --- a/src/gui/kernel/qguieventdispatcher_glib.cpp +++ b/src/gui/kernel/qguieventdispatcher_glib.cpp @@ -120,7 +120,7 @@ static gboolean x11EventSourceDispatch(GSource *s, GSourceFunc callback, gpointe // _qt_scrolldone protocols, queue all other // client messages if (event.xclient.format == 32) { - if (event.xclient.message_type == ATOM(WM_PROTOCOLS) || + if (event.xclient.message_type == ATOM(WM_PROTOCOLS) && (Atom) event.xclient.data.l[0] == ATOM(WM_TAKE_FOCUS)) { break; } else if (event.xclient.message_type == ATOM(_QT_SCROLL_DONE)) { -- cgit v0.12