Commit 394b2dcb authored by gbazin's avatar gbazin

* modules/gui/skins2/x11/x11_window.cpp: "stay on top" support if window...

* modules/gui/skins2/x11/x11_window.cpp: "stay on top" support if window manager supports _NET_WM_STATE_STAYS_ON_TOP.
parent 16ebdc99
......@@ -174,7 +174,47 @@ void X11Window::setOpacity( uint8_t value ) const
void X11Window::toggleOnTop( bool onTop ) const
{
// TODO
int i_ret, i_format;
unsigned long i, i_items, i_bytesafter;
Atom net_wm_supported, net_wm_state, net_wm_state_on_top, *p_args = NULL;
net_wm_supported = XInternAtom( XDISPLAY, "_NET_SUPPORTED", False );
i_ret = XGetWindowProperty( XDISPLAY, DefaultRootWindow( XDISPLAY ),
net_wm_supported,
0, 16384, False, AnyPropertyType,
&net_wm_supported,
&i_format, &i_items, &i_bytesafter,
(unsigned char **)(intptr_t)&p_args );
if( i_ret != Success || i_items == 0 ) return; /* Not supported */
net_wm_state = XInternAtom( XDISPLAY, "_NET_WM_STATE", False );
net_wm_state_on_top = XInternAtom( XDISPLAY, "_NET_WM_STATE_STAYS_ON_TOP",
False );
for( i = 0; i < i_items; i++ )
{
if( p_args[i] == net_wm_state_on_top ) break;
}
XFree( p_args );
if( i == i_items ) return; /* Not supported */
/* Switch "on top" status */
XClientMessageEvent event;
memset( &event, 0, sizeof( XClientMessageEvent ) );
event.type = ClientMessage;
event.message_type = net_wm_state;
event.display = XDISPLAY;
event.window = m_wnd;
event.format = 32;
event.data.l[ 0 ] = onTop; /* set property */
event.data.l[ 1 ] = net_wm_state_on_top;
XSendEvent( XDISPLAY, DefaultRootWindow( XDISPLAY ),
False, SubstructureRedirectMask, (XEvent*)&event );
}
#endif
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment