changeset 17006:852499addaa8

Enable border toggling for gl and gl2 under windows.
author reimar
date Thu, 17 Nov 2005 20:49:46 +0000
parents 3047b92e8402
children a271b9869a60
files libvo/vo_gl.c libvo/vo_gl2.c libvo/w32_common.c
diffstat 3 files changed, 29 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/libvo/vo_gl.c	Thu Nov 17 19:17:53 2005 +0000
+++ b/libvo/vo_gl.c	Thu Nov 17 20:49:46 2005 +0000
@@ -796,6 +796,11 @@
     vo_x11_fullscreen();
 #endif
     return VO_TRUE;
+#ifdef GL_WIN32
+  case VOCTRL_BORDER:
+    vo_w32_border();
+    return VO_TRUE;
+#endif
   case VOCTRL_GET_PANSCAN:
     if (!use_aspect) return VO_NOTIMPL;
     return VO_TRUE;
--- a/libvo/vo_gl2.c	Thu Nov 17 19:17:53 2005 +0000
+++ b/libvo/vo_gl2.c	Thu Nov 17 20:49:46 2005 +0000
@@ -1135,6 +1135,11 @@
       initGl(vo_dwidth, vo_dheight);
     resize(&vo_dwidth, &vo_dheight);
     return VO_TRUE;
+#ifdef GL_WIN32
+  case VOCTRL_BORDER:
+    vo_w32_border();
+    return VO_TRUE;
+#endif
   case VOCTRL_GET_PANSCAN:
     return VO_TRUE;
   case VOCTRL_SET_PANSCAN:
--- a/libvo/w32_common.c	Thu Nov 17 19:17:53 2005 +0000
+++ b/libvo/w32_common.c	Thu Nov 17 20:49:46 2005 +0000
@@ -161,7 +161,10 @@
 int createRenderingContext(void) {
     HWND layer = HWND_NOTOPMOST;
     PIXELFORMATDESCRIPTOR pfd;
+    RECT r;
     int pf;
+    int style = (vo_border && !vo_fs) ?
+                (WS_OVERLAPPEDWINDOW | WS_SIZEBOX) : WS_POPUP;
 
     if (vo_fs || vo_ontop) layer = HWND_TOPMOST;
     if (vo_fs) {
@@ -178,9 +181,16 @@
 	}
     }
     updateScreenProperties();
+    ShowWindow(vo_window, SW_HIDE);
+    SetWindowLong(vo_window, GWL_STYLE, style);
     vo_dwidth = vo_fs ? vo_screenwidth : o_dwidth;
     vo_dheight = vo_fs ? vo_screenheight : o_dheight;
-    SetWindowPos(vo_window, layer, vo_fs ? 0 : vo_dx, vo_fs ? 0 : vo_dy, vo_dwidth, vo_dheight, SWP_SHOWWINDOW);
+    r.left = vo_fs ? 0 : vo_dy;
+    r.right = r.left + vo_dwidth;
+    r.top = vo_fs ? 0 : vo_dx;
+    r.bottom = r.top + vo_dheight;
+    AdjustWindowRect(&r, style, 0);
+    SetWindowPos(vo_window, layer, r.left, r.top, r.right - r.left, r.bottom - r.top, SWP_SHOWWINDOW);
 
     memset(&pfd, 0, sizeof pfd);
     pfd.nSize = sizeof pfd;
@@ -228,7 +238,9 @@
     if (WinID >= 0)
       vo_window = WinID;
     else {
-    vo_window = CreateWindowEx(0, classname, classname, WS_POPUP, CW_USEDEFAULT, 0, 100, 100, 0, 0, hInstance, 0);
+    vo_window = CreateWindowEx(0, classname, classname,
+                  vo_border ? (WS_OVERLAPPEDWINDOW | WS_SIZEBOX) : WS_POPUP,
+                  CW_USEDEFAULT, 0, 100, 100, 0, 0, hInstance, 0);
     if (!vo_window) {
 	mp_msg(MSGT_VO, MSGL_ERR, "vo: win32: unable to create window!\n");
 	return 0;
@@ -248,6 +260,11 @@
     createRenderingContext();
 }
 
+void vo_w32_border() {
+    vo_border = !vo_border;
+    createRenderingContext();
+}
+
 void vo_w32_ontop( void )
 {
     vo_ontop = !vo_ontop;