From 9cfda3493ce4086313072a216d6a5b4f796c40d3 Mon Sep 17 00:00:00 2001 From: Robert Griebl Date: Mon, 22 Mar 2010 16:00:23 +0100 Subject: Add a new WA_X11DoNotAcceptFocus attribute for top-level widgets (part 2). Forgot the documentation and ignoring WM_TAKE_FOCUS messages for modal windows in part 1 (9da453e5579ebb6fb0361e4df4cfa7107e560b23) Reviewed-by: bhughes --- src/corelib/global/qnamespace.qdoc | 4 ++++ src/gui/kernel/qapplication_x11.cpp | 2 ++ 2 files changed, 6 insertions(+) diff --git a/src/corelib/global/qnamespace.qdoc b/src/corelib/global/qnamespace.qdoc index f8f3c49..775c0f3 100644 --- a/src/corelib/global/qnamespace.qdoc +++ b/src/corelib/global/qnamespace.qdoc @@ -1255,6 +1255,10 @@ window boundary (widget without parent or dialog) is found. This attribute currently has effect only on Symbian platforms + \value WA_X11DoNoAcceptFocus Asks the window manager to not give focus + to this top level window. This attribute has no effect on non-X11 + platforms. + \omitvalue WA_SetLayoutDirection \omitvalue WA_InputMethodTransparent \omitvalue WA_WState_CompressKeys diff --git a/src/gui/kernel/qapplication_x11.cpp b/src/gui/kernel/qapplication_x11.cpp index e276ed2..67e0865 100644 --- a/src/gui/kernel/qapplication_x11.cpp +++ b/src/gui/kernel/qapplication_x11.cpp @@ -3060,6 +3060,8 @@ int QApplication::x11ClientMessage(QWidget* w, XEvent* event, bool passive_only) if ((ulong) event->xclient.data.l[1] > X11->time) X11->time = event->xclient.data.l[1]; QWidget *amw = activeModalWidget(); + if (amw && amw->testAttribute(Qt::WA_X11DoNotAcceptFocus)) + amw = 0; if (amw && !QApplicationPrivate::tryModalHelper(widget, 0)) { QWidget *p = amw->parentWidget(); while (p && p != widget) -- cgit v0.12