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 <laszlo.agocs@theqtcompany.com>
This commit is contained in:
Ulf Hermann 2015-11-25 11:07:51 +01:00
parent 1e761c80cf
commit 5645dc9f8a
2 changed files with 11 additions and 0 deletions

View File

@ -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;

View File

@ -184,6 +184,7 @@ protected:
void setNetWmStates(NetWmStates);
void setMotifWindowFlags(Qt::WindowFlags flags);
void setNetWmStateWindowFlags(Qt::WindowFlags flags);
void updateMotifWmHintsBeforeMap();
void updateNetWmStateBeforeMap();