summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms
diff options
context:
space:
mode:
authorSamuel Rødal <samuel.rodal@nokia.com>2011-04-08 07:44:34 (GMT)
committerSamuel Rødal <samuel.rodal@nokia.com>2011-04-08 07:47:48 (GMT)
commitb42914ba7b2c2ec08abeb4ec658ffaea019e3e3f (patch)
tree8f8d26206b2274dc13996051a85ca64604e1e8c4 /src/plugins/platforms
parent7cad215190414cc2a146d95f4077dffa3bd4e6a5 (diff)
downloadQt-b42914ba7b2c2ec08abeb4ec658ffaea019e3e3f.zip
Qt-b42914ba7b2c2ec08abeb4ec658ffaea019e3e3f.tar.gz
Qt-b42914ba7b2c2ec08abeb4ec658ffaea019e3e3f.tar.bz2
Set the _NET_WM_WINDOW_TYPE property in the XCB backend.
Diffstat (limited to 'src/plugins/platforms')
-rw-r--r--src/plugins/platforms/xcb/qxcbwindow.cpp38
-rw-r--r--src/plugins/platforms/xcb/qxcbwindow.h1
2 files changed, 39 insertions, 0 deletions
diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp
index f0b9e32..ad91602 100644
--- a/src/plugins/platforms/xcb/qxcbwindow.cpp
+++ b/src/plugins/platforms/xcb/qxcbwindow.cpp
@@ -304,6 +304,8 @@ Qt::WindowFlags QXcbWindow::setWindowFlags(Qt::WindowFlags flags)
{
Qt::WindowType type = static_cast<Qt::WindowType>(int(flags & Qt::WindowType_Mask));
+ setNetWmWindowTypes(flags);
+
if (type == Qt::ToolTip)
flags |= Qt::WindowStaysOnTopHint | Qt::FramelessWindowHint | Qt::X11BypassWindowManagerHint;
if (type == Qt::Popup)
@@ -407,6 +409,42 @@ Qt::WindowFlags QXcbWindow::setWindowFlags(Qt::WindowFlags flags)
return QPlatformWindow::setWindowFlags(flags);
}
+void QXcbWindow::setNetWmWindowTypes(Qt::WindowFlags flags)
+{
+ // in order of decreasing priority
+ QVector<uint> windowTypes;
+
+ Qt::WindowType type = static_cast<Qt::WindowType>(int(flags & Qt::WindowType_Mask));
+
+ switch (type) {
+ case Qt::Dialog:
+ case Qt::Sheet:
+ windowTypes.append(atom(QXcbAtom::_NET_WM_WINDOW_TYPE_DIALOG));
+ break;
+ case Qt::Tool:
+ case Qt::Drawer:
+ windowTypes.append(atom(QXcbAtom::_NET_WM_WINDOW_TYPE_UTILITY));
+ break;
+ case Qt::ToolTip:
+ windowTypes.append(atom(QXcbAtom::_NET_WM_WINDOW_TYPE_TOOLTIP));
+ break;
+ case Qt::SplashScreen:
+ windowTypes.append(atom(QXcbAtom::_NET_WM_WINDOW_TYPE_SPLASH));
+ break;
+ default:
+ break;
+ }
+
+ if (flags & Qt::FramelessWindowHint)
+ windowTypes.append(atom(QXcbAtom::_KDE_NET_WM_WINDOW_TYPE_OVERRIDE));
+
+ windowTypes.append(atom(QXcbAtom::_NET_WM_WINDOW_TYPE_NORMAL));
+
+ Q_XCB_CALL(xcb_change_property(xcb_connection(), XCB_PROP_MODE_REPLACE, m_window,
+ atom(QXcbAtom::_NET_WM_WINDOW_TYPE), XCB_ATOM_ATOM, 32,
+ windowTypes.count(), windowTypes.constData()));
+}
+
WId QXcbWindow::winId() const
{
return m_window;
diff --git a/src/plugins/platforms/xcb/qxcbwindow.h b/src/plugins/platforms/xcb/qxcbwindow.h
index 0fa4d0f..e049837 100644
--- a/src/plugins/platforms/xcb/qxcbwindow.h
+++ b/src/plugins/platforms/xcb/qxcbwindow.h
@@ -92,6 +92,7 @@ public:
void updateSyncRequestCounter();
private:
+ void setNetWmWindowTypes(Qt::WindowFlags flags);
QXcbScreen *m_screen;