Commit 62701cf2 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont Committed by Rémi Denis-Courmont
Browse files

X11 common: code factorization

parent 3d819f9c
...@@ -3315,47 +3315,28 @@ static int ConvertKey( int i_key ) ...@@ -3315,47 +3315,28 @@ static int ConvertKey( int i_key )
*****************************************************************************/ *****************************************************************************/
static int WindowOnTop( vout_thread_t *p_vout, bool b_on_top ) static int WindowOnTop( vout_thread_t *p_vout, bool b_on_top )
{ {
if( p_vout->p_sys->b_net_wm_state_stays_on_top ) XClientMessageEvent event;
{
XClientMessageEvent event;
memset( &event, 0, sizeof( XClientMessageEvent ) ); memset( &event, 0, sizeof( XClientMessageEvent ) );
event.type = ClientMessage;
event.message_type = p_vout->p_sys->net_wm_state;
event.display = p_vout->p_sys->p_display;
event.window = p_vout->p_sys->p_win->base_window;
event.format = 32;
event.data.l[ 0 ] = b_on_top; /* set property */
event.type = ClientMessage; if( p_vout->p_sys->b_net_wm_state_stays_on_top )
event.message_type = p_vout->p_sys->net_wm_state;
event.display = p_vout->p_sys->p_display;
event.window = p_vout->p_sys->p_win->base_window;
event.format = 32;
event.data.l[ 0 ] = b_on_top; /* set property */
event.data.l[ 1 ] = p_vout->p_sys->net_wm_state_stays_on_top; event.data.l[ 1 ] = p_vout->p_sys->net_wm_state_stays_on_top;
XSendEvent( p_vout->p_sys->p_display,
DefaultRootWindow( p_vout->p_sys->p_display ),
False, SubstructureRedirectMask,
(XEvent*)&event );
}
/* use _NET_WM_STATE_ABOVE if window manager
* doesn't handle _NET_WM_STATE_STAYS_ON_TOP */
else if( p_vout->p_sys->b_net_wm_state_above ) else if( p_vout->p_sys->b_net_wm_state_above )
{ /* use _NET_WM_STATE_ABOVE if window manager
XClientMessageEvent event; * doesn't handle _NET_WM_STATE_STAYS_ON_TOP */
memset( &event, 0, sizeof( XClientMessageEvent ) );
event.type = ClientMessage;
event.message_type = p_vout->p_sys->net_wm_state;
event.display = p_vout->p_sys->p_display;
event.window = p_vout->p_sys->p_win->base_window;
event.format = 32;
event.data.l[ 0 ] = b_on_top; /* set property */
event.data.l[ 1 ] = p_vout->p_sys->net_wm_state_above; event.data.l[ 1 ] = p_vout->p_sys->net_wm_state_above;
else
return VLC_EGENERIC;
XSendEvent( p_vout->p_sys->p_display, XSendEvent( p_vout->p_sys->p_display,
DefaultRootWindow( p_vout->p_sys->p_display ), DefaultRootWindow( p_vout->p_sys->p_display ),
False, SubstructureRedirectMask, False, SubstructureRedirectMask,
(XEvent*)&event ); (XEvent*)&event );
}
return VLC_SUCCESS; return VLC_SUCCESS;
} }
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