From 5645dc9f8a5264bde855d5b14c619198cfedf3a5 Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Wed, 25 Nov 2015 11:07:51 +0100 Subject: [PATCH] Xcb: propagate stays-on-top or -below hints from window flags Before, you had to first hide a window, then set the flags, then show it again as the flags were only applied when showing the window. This is unintuitive. Task-number: QTBUG-49628 Change-Id: I240e633ac2581c0ff0e4f35dead1b79e15e15350 Reviewed-by: Laszlo Agocs --- src/plugins/platforms/xcb/qxcbwindow.cpp | 10 ++++++++++ src/plugins/platforms/xcb/qxcbwindow.h | 1 + 2 files changed, 11 insertions(+) diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp index d76f1245e89..5d052a7ca16 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.cpp +++ b/src/plugins/platforms/xcb/qxcbwindow.cpp @@ -1098,6 +1098,7 @@ void QXcbWindow::setWindowFlags(Qt::WindowFlags flags) } setWmWindowType(wmWindowTypes, flags); + setNetWmStateWindowFlags(flags); setMotifWindowFlags(flags); setTransparentForMouseEvents(flags & Qt::WindowTransparentForInput); @@ -1333,6 +1334,15 @@ void QXcbWindow::updateNetWmStateBeforeMap() setNetWmStates(states); } +void QXcbWindow::setNetWmStateWindowFlags(Qt::WindowFlags flags) +{ + changeNetWmState(flags & Qt::WindowStaysOnTopHint, + atom(QXcbAtom::_NET_WM_STATE_ABOVE), + atom(QXcbAtom::_NET_WM_STATE_STAYS_ON_TOP)); + changeNetWmState(flags & Qt::WindowStaysOnBottomHint, + atom(QXcbAtom::_NET_WM_STATE_BELOW)); +} + void QXcbWindow::updateNetWmUserTime(xcb_timestamp_t timestamp) { xcb_window_t wid = m_window; diff --git a/src/plugins/platforms/xcb/qxcbwindow.h b/src/plugins/platforms/xcb/qxcbwindow.h index 41c4b4443de..1a8e031779a 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.h +++ b/src/plugins/platforms/xcb/qxcbwindow.h @@ -184,6 +184,7 @@ protected: void setNetWmStates(NetWmStates); void setMotifWindowFlags(Qt::WindowFlags flags); + void setNetWmStateWindowFlags(Qt::WindowFlags flags); void updateMotifWmHintsBeforeMap(); void updateNetWmStateBeforeMap();