[vlc-devel] commit: Factor some code ( Rémi Denis-Courmont )
git version control
git at videolan.org
Sat Aug 15 22:00:45 CEST 2009
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sat Aug 15 22:46:52 2009 +0300| [18c5c647ca879893aa8d0900a0a9f84f5ea44559] | committer: Rémi Denis-Courmont
Factor some code
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=18c5c647ca879893aa8d0900a0a9f84f5ea44559
---
modules/video_output/xcb/window.c | 31 +++++++++++++++++++------------
1 files changed, 19 insertions(+), 12 deletions(-)
diff --git a/modules/video_output/xcb/window.c b/modules/video_output/xcb/window.c
index ee1dde7..4c96c89 100644
--- a/modules/video_output/xcb/window.c
+++ b/modules/video_output/xcb/window.c
@@ -140,6 +140,20 @@ xcb_atom_t get_atom (xcb_connection_t *conn, xcb_intern_atom_cookie_t ck)
#define NET_WM_STATE_ADD 1
#define NET_WM_STATE_TOGGLE 2
+static void CacheAtoms (vout_window_sys_t *p_sys)
+{
+ xcb_connection_t *conn = p_sys->conn;
+ xcb_intern_atom_cookie_t wm_state_ck, wm_state_above_ck, wm_state_fs_ck;
+
+ wm_state_ck = intern_string (conn, "_NET_WM_STATE");
+ wm_state_above_ck = intern_string (conn, "_NET_WM_STATE_ABOVE");
+ wm_state_fs_ck = intern_string (conn, "_NET_WM_STATE_FULLSCREEN");
+
+ 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_fullscreen = get_atom (conn, wm_state_fs_ck);
+}
+
/**
* Create an X11 window.
*/
@@ -244,16 +258,11 @@ static int Open (vlc_object_t *obj)
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 */
- xcb_intern_atom_cookie_t wm_state_ck, wm_state_above_ck, wm_state_fs_ck;
-
- wm_state_ck = intern_string (conn, "_NET_WM_STATE");
- wm_state_above_ck = intern_string (conn, "_NET_WM_STATE_ABOVE");
- wm_state_fs_ck = intern_string (conn, "_NET_WM_STATE_FULLSCREEN");
+ /* Make the window visible */
+ xcb_map_window (conn, window);
- 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_fullscreen = get_atom (conn, wm_state_fs_ck);
+ /* Cache any EWMH atom we may need later */
+ CacheAtoms (p_sys);
/* Create the event thread. It will dequeue all events, so any checked
* request from this thread must be completed at this point. */
@@ -261,9 +270,7 @@ static int Open (vlc_object_t *obj)
&& vlc_clone (&p_sys->thread, Thread, wnd, VLC_THREAD_PRIORITY_LOW))
DestroyKeyHandler (p_sys->keys);
- /* Make sure the window is ready */
- xcb_map_window (conn, window);
- xcb_flush (conn);
+ xcb_flush (conn); /* Make sure map_window is sent (should be useless) */
return VLC_SUCCESS;
More information about the vlc-devel
mailing list