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

XCB/window: implement --video-title, UTF-8 names

parent 46fc1c8c
...@@ -78,12 +78,19 @@ struct vout_window_sys_t ...@@ -78,12 +78,19 @@ struct vout_window_sys_t
/*xcb_atom_t wmstate_fullscreen;*/ /*xcb_atom_t wmstate_fullscreen;*/
}; };
static inline
void set_string (xcb_connection_t *conn, xcb_window_t window,
xcb_atom_t type, xcb_atom_t atom, const char *str)
{
xcb_change_property (conn, XCB_PROP_MODE_REPLACE, window, atom, type,
/* format */ 8, strlen (str), str);
}
static inline static inline
void set_ascii_prop (xcb_connection_t *conn, xcb_window_t window, void set_ascii_prop (xcb_connection_t *conn, xcb_window_t window,
xcb_atom_t atom, const char *value) xcb_atom_t atom, const char *value)
{ {
xcb_change_property (conn, XCB_PROP_MODE_REPLACE, window, atom, set_string (conn, window, atom, XA_STRING, value);
XA_STRING, 8, strlen (value), value);
} }
static inline static inline
...@@ -98,6 +105,12 @@ void set_hostname_prop (xcb_connection_t *conn, xcb_window_t window) ...@@ -98,6 +105,12 @@ void set_hostname_prop (xcb_connection_t *conn, xcb_window_t window)
} }
} }
static inline
xcb_intern_atom_cookie_t intern_string (xcb_connection_t *c, const char *s)
{
return xcb_intern_atom (c, 0, strlen (s), s);
}
static static
xcb_atom_t get_atom (xcb_connection_t *conn, xcb_intern_atom_cookie_t ck) xcb_atom_t get_atom (xcb_connection_t *conn, xcb_intern_atom_cookie_t ck)
{ {
...@@ -179,6 +192,14 @@ static int Open (vlc_object_t *obj) ...@@ -179,6 +192,14 @@ static int Open (vlc_object_t *obj)
goto error; goto error;
} }
wnd->handle.xid = window;
wnd->p_sys = p_sys;
wnd->control = Control;
p_sys->conn = conn;
p_sys->keys = CreateKeyHandler (obj, conn);
p_sys->root = scr->root;
/* ICCCM /* ICCCM
* No cut&paste nor drag&drop, only Window Manager communication. */ * No cut&paste nor drag&drop, only Window Manager communication. */
/* Plain ASCII localization of VLC for ICCCM window name */ /* Plain ASCII localization of VLC for ICCCM window name */
...@@ -190,19 +211,34 @@ static int Open (vlc_object_t *obj) ...@@ -190,19 +211,34 @@ static int Open (vlc_object_t *obj)
XA_STRING, 8, 8, "vlc\0Vlc"); XA_STRING, 8, 8, "vlc\0Vlc");
set_hostname_prop (conn, window); set_hostname_prop (conn, window);
wnd->handle.xid = window; /* EWMH */
wnd->p_sys = p_sys; xcb_intern_atom_cookie_t utf8_string_ck
wnd->control = Control; = intern_string (conn, "UTF8_STRING");;
xcb_intern_atom_cookie_t net_wm_name_ck
= intern_string (conn, "_NET_WM_NAME");
xcb_intern_atom_cookie_t net_wm_icon_name_ck
= intern_string (conn, "_NET_WM_ICON_NAME");
p_sys->conn = conn; xcb_atom_t utf8 = get_atom (conn, utf8_string_ck);
p_sys->keys = CreateKeyHandler (obj, conn);
p_sys->root = scr->root; xcb_atom_t net_wm_name = get_atom (conn, net_wm_name_ck);
char *title = var_CreateGetNonEmptyString (wnd, "video-title");
if (title)
{
set_string (conn, window, utf8, net_wm_name, title);
free (title);
}
else
set_string (conn, window, utf8, net_wm_name, _("VLC media player"));
xcb_atom_t net_wm_icon_name = get_atom (conn, net_wm_icon_name_ck);
set_string (conn, window, utf8, net_wm_icon_name, _("VLC"));
/* Cache any EWMH atom we may need later */ /* Cache any EWMH atom we may need later */
xcb_intern_atom_cookie_t wm_state_ck, wm_state_above_ck; xcb_intern_atom_cookie_t wm_state_ck, wm_state_above_ck;
wm_state_ck = xcb_intern_atom (conn, 0, 13, "_NET_WM_STATE"); wm_state_ck = intern_string (conn, "_NET_WM_STATE");
wm_state_above_ck = xcb_intern_atom (conn, 0, 19, "_NET_WM_STATE_ABOVE"); wm_state_above_ck = intern_string (conn, "_NET_WM_STATE_ABOVE");
p_sys->wm_state = get_atom (conn, wm_state_ck); p_sys->wm_state = get_atom (conn, wm_state_ck);
p_sys->wm_state_above = get_atom (conn, wm_state_above_ck); p_sys->wm_state_above = get_atom (conn, wm_state_above_ck);
......
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