From 28b32a786a126703679f099b6c7bbb5255e2aa99 Mon Sep 17 00:00:00 2001 From: reimar Date: Thu, 17 Nov 2005 20:49:46 +0000 Subject: [PATCH] Enable border toggling for gl and gl2 under windows. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@17007 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libvo/vo_gl.c | 5 +++++ libvo/vo_gl2.c | 5 +++++ libvo/w32_common.c | 21 +++++++++++++++++++-- 3 files changed, 29 insertions(+), 2 deletions(-) diff --git a/libvo/vo_gl.c b/libvo/vo_gl.c index 7bd85ed7e8..1d423385c5 100644 --- a/libvo/vo_gl.c +++ b/libvo/vo_gl.c @@ -796,6 +796,11 @@ static int control(uint32_t request, void *data, ...) 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; diff --git a/libvo/vo_gl2.c b/libvo/vo_gl2.c index c5546b961c..4bac77ff76 100644 --- a/libvo/vo_gl2.c +++ b/libvo/vo_gl2.c @@ -1135,6 +1135,11 @@ static int control(uint32_t request, void *data, ...) 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: diff --git a/libvo/w32_common.c b/libvo/w32_common.c index f2db75a40c..1d5126827d 100644 --- a/libvo/w32_common.c +++ b/libvo/w32_common.c @@ -161,7 +161,10 @@ static void resetMode(void) { 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 @@ int createRenderingContext(void) { } } 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 @@ int vo_init(void) { 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 @@ void vo_w32_fullscreen(void) { createRenderingContext(); } +void vo_w32_border() { + vo_border = !vo_border; + createRenderingContext(); +} + void vo_w32_ontop( void ) { vo_ontop = !vo_ontop;