[vlc-commits] gl: remove hard-coded platform to window type mappings

Rémi Denis-Courmont git at videolan.org
Wed Nov 6 22:43:39 CET 2013


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Wed Nov  6 23:41:01 2013 +0200| [3900a730754293d85dd6b62489f1392b42cc546f] | committer: Rémi Denis-Courmont

gl: remove hard-coded platform to window type mappings

This should fix compilation on non-Apple Darwin and plausibly addresses
hypothetical future support for Mesa's shared GLAPI.

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

 modules/video_output/gl.c |   51 +++++++++++++++++++--------------------------
 1 file changed, 21 insertions(+), 30 deletions(-)

diff --git a/modules/video_output/gl.c b/modules/video_output/gl.c
index cf7c624..7217eed 100644
--- a/modules/video_output/gl.c
+++ b/modules/video_output/gl.c
@@ -97,37 +97,28 @@ static int Control (vout_display_t *, int, va_list);
 
 static vout_window_t *MakeWindow (vout_display_t *vd)
 {
-    vout_window_cfg_t wnd_cfg;
-
-    memset (&wnd_cfg, 0, sizeof (wnd_cfg));
-
-    /* Please keep this in sync with egl.c */
-    /* <EGL/eglplatform.h> defines the list and order of platforms */
-#if defined(_WIN32) || defined(__VC32__) \
- && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__)
-    wnd_cfg.type = VOUT_WINDOW_TYPE_HWND;
-#elif defined(__WINSCW__) || defined(__SYMBIAN32__)  /* Symbian */
-# warning Symbian not supported.
-#elif defined(WL_EGL_PLATFORM)
-# error Wayland not supported.
-#elif defined(__GBM__)
-# error Glamor not supported.
-#elif defined(ANDROID)
-# error Android not supported.
-#elif defined(__unix__) /* X11 */
-    wnd_cfg.type = VOUT_WINDOW_TYPE_XID;
-#else
-# error Platform not recognized.
+    vout_window_cfg_t cfg = {
+        .x = var_InheritInteger (vd, "video-x"),
+        .y = var_InheritInteger (vd, "video-y"),
+        .width = vd->cfg->display.width,
+        .height = vd->cfg->display.height,
+    };
+    vout_window_t *wnd;
+
+#ifdef _WIN32
+    cfg.type = VOUT_WINDOW_TYPE_HWND;
+    wnd = vout_display_NewWindow (vd, &cfg);
+    if (wnd != NULL)
+        return wnd;
 #endif
-    wnd_cfg.x = var_InheritInteger (vd, "video-x");
-    wnd_cfg.y = var_InheritInteger (vd, "video-y");
-    wnd_cfg.width  = vd->cfg->display.width;
-    wnd_cfg.height = vd->cfg->display.height;
-
-    vout_window_t *wnd = vout_display_NewWindow (vd, &wnd_cfg);
-    if (wnd == NULL)
-        msg_Err (vd, "parent window not available");
-    return wnd;
+
+    cfg.type = VOUT_WINDOW_TYPE_XID;
+    wnd = vout_display_NewWindow (vd, &cfg);
+    if (wnd != NULL)
+        return wnd;
+
+    msg_Err (vd, "parent window not available");
+    return NULL;
 }
 
 /**



More information about the vlc-commits mailing list