[vlc-commits] vout:win32: simplify the decorated window size retrieval

Steve Lhomme git at videolan.org
Mon Apr 1 12:03:35 CEST 2019


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Fri Mar 22 10:00:46 2019 +0100| [1c1a37e8d03d05e7b1968595b3f8d12120c977f4] | committer: Steve Lhomme

vout:win32: simplify the decorated window size retrieval

The extra offset of 10 is not necessary. Windows can provide negative values
in the window rectangle.

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

 modules/video_output/win32/events.c | 21 ++++++++-------------
 1 file changed, 8 insertions(+), 13 deletions(-)

diff --git a/modules/video_output/win32/events.c b/modules/video_output/win32/events.c
index 971da2ef4b..087f4bc958 100644
--- a/modules/video_output/win32/events.c
+++ b/modules/video_output/win32/events.c
@@ -732,18 +732,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 )
@@ -765,12 +760,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 */



More information about the vlc-commits mailing list