summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDenis Dzyubenko <denis.dzyubenko@nokia.com>2010-03-24 12:20:19 (GMT)
committerDenis Dzyubenko <denis.dzyubenko@nokia.com>2010-03-24 15:04:37 (GMT)
commit661bcc601502125ca29930394daf90682f454612 (patch)
tree9d028f800f5006cdee59ed2d1a19fa992b67ef7b
parent71ced8e9d2a8cc363a6e8a039e9431ecf8cf9a01 (diff)
downloadQt-661bcc601502125ca29930394daf90682f454612.zip
Qt-661bcc601502125ca29930394daf90682f454612.tar.gz
Qt-661bcc601502125ca29930394daf90682f454612.tar.bz2
Revert "Revert "Make QWidget::activateWindow() NET window manager aware.""
This reverts commit 555175f9d9e5633b8fcfd6e6f6a11c84faa9946e.
-rw-r--r--src/gui/kernel/qapplication_x11.cpp2
-rw-r--r--src/gui/kernel/qt_x11_p.h2
-rw-r--r--src/gui/kernel/qwidget_x11.cpp22
3 files changed, 25 insertions, 1 deletions
diff --git a/src/gui/kernel/qapplication_x11.cpp b/src/gui/kernel/qapplication_x11.cpp
index ea44173..67e0865 100644
--- a/src/gui/kernel/qapplication_x11.cpp
+++ b/src/gui/kernel/qapplication_x11.cpp
@@ -275,6 +275,8 @@ static const char * x11_atomnames = {
"_NET_SYSTEM_TRAY_VISUAL\0"
+ "_NET_ACTIVE_WINDOW\0"
+
// Property formats
"COMPOUND_TEXT\0"
"TEXT\0"
diff --git a/src/gui/kernel/qt_x11_p.h b/src/gui/kernel/qt_x11_p.h
index e1b2625..7383382 100644
--- a/src/gui/kernel/qt_x11_p.h
+++ b/src/gui/kernel/qt_x11_p.h
@@ -632,6 +632,8 @@ struct QX11Data
_NET_SYSTEM_TRAY_VISUAL,
+ _NET_ACTIVE_WINDOW,
+
// Property formats
COMPOUND_TEXT,
TEXT,
diff --git a/src/gui/kernel/qwidget_x11.cpp b/src/gui/kernel/qwidget_x11.cpp
index 2266379..c1363d2 100644
--- a/src/gui/kernel/qwidget_x11.cpp
+++ b/src/gui/kernel/qwidget_x11.cpp
@@ -1641,7 +1641,27 @@ void QWidget::activateWindow()
if (X11->userTime == 0)
X11->userTime = X11->time;
qt_net_update_user_time(tlw, X11->userTime);
- XSetInputFocus(X11->display, tlw->internalWinId(), XRevertToParent, X11->time);
+
+ if (X11->isSupportedByWM(ATOM(_NET_ACTIVE_WINDOW))) {
+ XEvent e;
+ e.xclient.type = ClientMessage;
+ e.xclient.message_type = ATOM(_NET_ACTIVE_WINDOW);
+ e.xclient.display = X11->display;
+ e.xclient.window = tlw->internalWinId();
+ e.xclient.format = 32;
+ e.xclient.data.l[0] = 1; // 1 == application
+ e.xclient.data.l[1] = X11->userTime;
+ if (QWidget *aw = QApplication::activeWindow())
+ e.xclient.data.l[2] = aw->internalWinId();
+ else
+ e.xclient.data.l[2] = XNone;
+ e.xclient.data.l[3] = 0;
+ e.xclient.data.l[4] = 0;
+ XSendEvent(X11->display, RootWindow(X11->display, tlw->x11Info().screen()),
+ false, SubstructureNotifyMask | SubstructureRedirectMask, &e);
+ } else {
+ XSetInputFocus(X11->display, tlw->internalWinId(), XRevertToParent, X11->time);
+ }
}
}