[vlc-devel] [PATCH 13/41] vout:win32: simplify the decorated window size retrieval
Steve Lhomme
robux4 at ycbcr.xyz
Fri Mar 22 16:13:51 CET 2019
The extra offset of 10 is not necessary. Windows can provide negative values
in the window rectangle.
---
modules/video_output/win32/events.c | 23 +++++++++--------------
1 file changed, 9 insertions(+), 14 deletions(-)
diff --git a/modules/video_output/win32/events.c b/modules/video_output/win32/events.c
index 91574d5e13..6ad82229b6 100644
--- a/modules/video_output/win32/events.c
+++ b/modules/video_output/win32/events.c
@@ -735,18 +735,13 @@ static int Win32VoutCreateWindow( event_thread_t *p_event )
* have. Unfortunatly these dimensions will include the borders and
* titlebar. We use the following function to find out the size of
* the window corresponding to the useable surface we want */
- RECT rect_window;
- rect_window.left = 10;
- rect_window.top = 10;
- rect_window.right = rect_window.left + RECTWidth(p_event->window_area);
- rect_window.bottom = rect_window.top + RECTHeight(p_event->window_area);
-
+ RECT decorated_window = p_event->window_area;
i_style = var_GetBool( vd, "video-deco" )
/* Open with window decoration */
? WS_OVERLAPPEDWINDOW|WS_SIZEBOX
/* No window decoration */
: WS_POPUP;
- AdjustWindowRect( &rect_window, i_style, 0 );
+ AdjustWindowRect( &decorated_window, i_style, 0 );
i_style |= WS_VISIBLE|WS_CLIPCHILDREN;
if( p_event->hparent )
@@ -768,12 +763,12 @@ static int Win32VoutCreateWindow( event_thread_t *p_event )
p_event->class_main, /* name of window class */
_T(VOUT_TITLE) _T(" (VLC Video Output)"),/* window title */
i_style, /* window style */
- (!p_event->window_area.left) ? (UINT)CW_USEDEFAULT :
- (UINT)p_event->window_area.left, /* default X coordinate */
- (!p_event->window_area.top) ? (UINT)CW_USEDEFAULT :
- (UINT)p_event->window_area.top, /* default Y coordinate */
- RECTWidth(rect_window), /* window width */
- RECTHeight(rect_window), /* window height */
+ (!p_event->window_area.left) ? CW_USEDEFAULT :
+ p_event->window_area.left, /* default X coordinate */
+ (!p_event->window_area.top) ? CW_USEDEFAULT :
+ p_event->window_area.top, /* default Y coordinate */
+ RECTWidth(decorated_window), /* window width */
+ RECTHeight(decorated_window), /* window height */
p_event->hparent, /* parent window */
NULL, /* no menu in this window */
hInstance, /* handle of this program instance */
@@ -952,7 +947,7 @@ static long FAR PASCAL WinVoutEventProc( HWND hwnd, UINT message,
case WM_PAINT:
/* nothing to repaint */
ValidateRect(hwnd, NULL);
- // fall through
+ /* fall through */
default:
return DefWindowProc(hwnd, message, wParam, lParam);
}
--
2.17.1
More information about the vlc-devel
mailing list