Commit deddd862 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

XCB/window: create window in fullscreen state (refs #2685)

This avoids visual glitches when fullscreen mode is already enabled
when the video window is created.
parent 18321915
...@@ -116,12 +116,26 @@ static void *Thread (void *data) ...@@ -116,12 +116,26 @@ static void *Thread (void *data)
return NULL; return NULL;
} }
/** Sets the EWMH state of the (unmapped) window */
static void set_wm_state (vout_window_t *wnd, const vout_window_cfg_t *cfg)
{
vout_window_sys_t *sys = wnd->sys;
xcb_atom_t data[1];
uint32_t len = 0;
if (cfg->is_fullscreen)
data[len++] = sys->wm_state_fullscreen;
xcb_change_property (sys->conn, XCB_PROP_MODE_REPLACE, wnd->handle.xid,
sys->wm_state, XA_ATOM, 32, len, data);
}
#define NET_WM_STATE_REMOVE 0 #define NET_WM_STATE_REMOVE 0
#define NET_WM_STATE_ADD 1 #define NET_WM_STATE_ADD 1
#define NET_WM_STATE_TOGGLE 2 #define NET_WM_STATE_TOGGLE 2
/** Changes the EWMH state of the window */ /** Changes the EWMH state of the (mapped) window */
static void set_wm_state (vout_window_t *wnd, bool on, xcb_atom_t state) static void change_wm_state (vout_window_t *wnd, bool on, xcb_atom_t state)
{ {
vout_window_sys_t *sys = wnd->sys; vout_window_sys_t *sys = wnd->sys;
/* From EWMH "_WM_STATE" */ /* From EWMH "_WM_STATE" */
...@@ -144,7 +158,6 @@ static void set_wm_state (vout_window_t *wnd, bool on, xcb_atom_t state) ...@@ -144,7 +158,6 @@ static void set_wm_state (vout_window_t *wnd, bool on, xcb_atom_t state)
(const char *)&ev); (const char *)&ev);
} }
static int Control (vout_window_t *wnd, int cmd, va_list ap) static int Control (vout_window_t *wnd, int cmd, va_list ap)
{ {
vout_window_sys_t *p_sys = wnd->sys; vout_window_sys_t *p_sys = wnd->sys;
...@@ -173,15 +186,15 @@ static int Control (vout_window_t *wnd, int cmd, va_list ap) ...@@ -173,15 +186,15 @@ static int Control (vout_window_t *wnd, int cmd, va_list ap)
bool above = (state & VOUT_WINDOW_STATE_ABOVE) != 0; bool above = (state & VOUT_WINDOW_STATE_ABOVE) != 0;
bool below = (state & VOUT_WINDOW_STATE_BELOW) != 0; bool below = (state & VOUT_WINDOW_STATE_BELOW) != 0;
set_wm_state (wnd, above, p_sys->wm_state_above); change_wm_state (wnd, above, p_sys->wm_state_above);
set_wm_state (wnd, below, p_sys->wm_state_below); change_wm_state (wnd, below, p_sys->wm_state_below);
break; break;
} }
case VOUT_WINDOW_SET_FULLSCREEN: case VOUT_WINDOW_SET_FULLSCREEN:
{ {
bool fs = va_arg (ap, int); bool fs = va_arg (ap, int);
set_wm_state (wnd, fs, p_sys->wm_state_fullscreen); change_wm_state (wnd, fs, p_sys->wm_state_fullscreen);
break; break;
} }
...@@ -410,6 +423,9 @@ static int Open (vout_window_t *wnd, const vout_window_cfg_t *cfg) ...@@ -410,6 +423,9 @@ static int Open (vout_window_t *wnd, const vout_window_cfg_t *cfg)
/* Cache any EWMH atom we may need later */ /* Cache any EWMH atom we may need later */
CacheAtoms (p_sys); CacheAtoms (p_sys);
/* Set initial window state */
set_wm_state (wnd, cfg);
/* Make the window visible */ /* Make the window visible */
xcb_map_window (conn, window); xcb_map_window (conn, window);
...@@ -432,7 +448,6 @@ static int Open (vout_window_t *wnd, const vout_window_cfg_t *cfg) ...@@ -432,7 +448,6 @@ static int Open (vout_window_t *wnd, const vout_window_cfg_t *cfg)
} }
xcb_flush (conn); /* Make sure map_window is sent (should be useless) */ xcb_flush (conn); /* Make sure map_window is sent (should be useless) */
vout_window_SetFullScreen (wnd, cfg->is_fullscreen);
return VLC_SUCCESS; return VLC_SUCCESS;
error: error:
......
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