[vlc-commits] xcb/glx: remove redundant pointer

Rémi Denis-Courmont git at videolan.org
Sat Sep 13 17:16:00 CEST 2014


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sat Sep 13 17:18:46 2014 +0300| [13f58beeace345ee3f3d336cfd0121675cd6b9c7] | committer: Rémi Denis-Courmont

xcb/glx: remove redundant pointer

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=13f58beeace345ee3f3d336cfd0121675cd6b9c7
---

 modules/video_output/xcb/glx.c |   41 +++++++++++++++++++++-------------------
 1 file changed, 22 insertions(+), 19 deletions(-)

diff --git a/modules/video_output/xcb/glx.c b/modules/video_output/xcb/glx.c
index b4a5024..6ee7a94 100644
--- a/modules/video_output/xcb/glx.c
+++ b/modules/video_output/xcb/glx.c
@@ -58,7 +58,6 @@ vlc_module_end ()
 struct vout_display_sys_t
 {
     xcb_connection_t *conn; /**< XCB connection */
-    vout_window_t *embed; /* VLC window (when windowed) */
     vlc_gl_t *gl;
 
     xcb_cursor_t cursor; /* blank cursor */
@@ -92,15 +91,17 @@ static int Open (vlc_object_t *obj)
     xcb_connection_t *conn;
     const xcb_screen_t *scr;
     uint16_t width, height;
-    sys->embed = XCB_parent_Create (vd, &conn, &scr, &width, &height);
-    if (sys->embed == NULL)
+    vout_window_t *surface;
+
+    surface = XCB_parent_Create (vd, &conn, &scr, &width, &height);
+    if (surface == NULL)
     {
         free (sys);
         return VLC_EGENERIC;
     }
 
     sys->conn = conn;
-    sys->gl = vlc_gl_Create (sys->embed, VLC_OPENGL, "glx");
+    sys->gl = vlc_gl_Create (surface, VLC_OPENGL, "glx");
     if (sys->gl == NULL)
         goto error;
 
@@ -129,11 +130,11 @@ static int Open (vlc_object_t *obj)
     vd->manage = Manage;
 
     /* */
-    bool is_fullscreen = vd->cfg->is_fullscreen;
-    if (is_fullscreen && vout_window_SetFullScreen (sys->embed, true))
-        is_fullscreen = false;
-    vout_display_SendEventFullscreen (vd, is_fullscreen);
-    vout_display_SendEventDisplaySize (vd, width, height, is_fullscreen);
+    bool fs = vd->cfg->is_fullscreen;
+    if (vout_window_SetFullScreen (surface, fs))
+        fs = false;
+    vout_display_SendEventFullscreen (vd, fs);
+    vout_display_SendEventDisplaySize (vd, width, height, fs);
 
     return VLC_SUCCESS;
 
@@ -141,7 +142,7 @@ error:
     if (sys->gl != NULL)
         vlc_gl_Destroy (sys->gl);
     xcb_disconnect (sys->conn);
-    vout_display_DeleteWindow (vd, sys->embed);
+    vout_display_DeleteWindow (vd, surface);
     free (sys);
     return VLC_EGENERIC;
 }
@@ -154,19 +155,21 @@ static void Close (vlc_object_t *obj)
 {
     vout_display_t *vd = (vout_display_t *)obj;
     vout_display_sys_t *sys = vd->sys;
+    vlc_gl_t *gl = sys->gl;
+    vout_window_t *surface = gl->surface;
 
-    vlc_gl_MakeCurrent (sys->gl);
+    vlc_gl_MakeCurrent (gl);
     vout_display_opengl_Delete (sys->vgl);
-    vlc_gl_ReleaseCurrent (sys->gl);
-    vlc_gl_Destroy (sys->gl);
+    vlc_gl_ReleaseCurrent (gl);
+    vlc_gl_Destroy (gl);
 
     /* show the default cursor */
-    xcb_change_window_attributes (sys->conn, sys->embed->handle.xid,
+    xcb_change_window_attributes (sys->conn, surface->handle.xid,
                                XCB_CW_CURSOR, &(uint32_t) { XCB_CURSOR_NONE });
     xcb_flush (sys->conn);
     xcb_disconnect (sys->conn);
 
-    vout_display_DeleteWindow (vd, sys->embed);
+    vout_display_DeleteWindow (vd, surface);
     free (sys);
 }
 
@@ -217,13 +220,13 @@ static int Control (vout_display_t *vd, int query, va_list ap)
     case VOUT_DISPLAY_CHANGE_FULLSCREEN:
     {
         const vout_display_cfg_t *c = va_arg (ap, const vout_display_cfg_t *);
-        return vout_window_SetFullScreen (sys->embed, c->is_fullscreen);
+        return vout_window_SetFullScreen (sys->gl->surface, c->is_fullscreen);
     }
 
     case VOUT_DISPLAY_CHANGE_WINDOW_STATE:
     {
         unsigned state = va_arg (ap, unsigned);
-        return vout_window_SetState (sys->embed, state);
+        return vout_window_SetState (sys->gl->surface, state);
     }
 
     case VOUT_DISPLAY_CHANGE_DISPLAY_SIZE:
@@ -250,7 +253,7 @@ static int Control (vout_display_t *vd, int query, va_list ap)
         /* */
         if (query == VOUT_DISPLAY_CHANGE_DISPLAY_SIZE && va_arg (ap, int))
         {
-            vout_window_SetSize (sys->embed,
+            vout_window_SetSize (sys->gl->surface,
                                  cfg->display.width, cfg->display.height);
             return VLC_EGENERIC; /* Always fail. See x11.c for rationale. */
         }
@@ -267,7 +270,7 @@ static int Control (vout_display_t *vd, int query, va_list ap)
     /* Hide the mouse. It will be send when
      * vout_display_t::info.b_hide_mouse is false */
     case VOUT_DISPLAY_HIDE_MOUSE:
-        xcb_change_window_attributes (sys->conn, sys->embed->handle.xid,
+        xcb_change_window_attributes (sys->conn, sys->gl->surface->handle.xid,
                                     XCB_CW_CURSOR, &(uint32_t){ sys->cursor });
         xcb_flush (sys->conn);
         return VLC_SUCCESS;



More information about the vlc-commits mailing list