]> git.sesse.net Git - vlc/commitdiff
* ALL: changed VOUT_SET_ZOOM into VOUT_SET_SIZE and implemented a VOUT_GET_SIZE for...
authorGildas Bazin <gbazin@videolan.org>
Wed, 2 Nov 2005 23:18:53 +0000 (23:18 +0000)
committerGildas Bazin <gbazin@videolan.org>
Wed, 2 Nov 2005 23:18:53 +0000 (23:18 +0000)
include/video_output.h
modules/gui/skins2/src/vlcproc.cpp
modules/gui/wxwidgets/video.cpp
modules/video_output/directx/directx.c
modules/video_output/directx/events.c
modules/video_output/directx/glwin32.c
modules/video_output/wingdi.c
modules/video_output/x11/xcommon.c
src/video_output/vout_intf.c

index 4badb1fe9eab89f0cf542d5bd6710b5c42f34c49..214b021f25a8f284f30943ab8723aec28dfc601e 100644 (file)
@@ -254,7 +254,8 @@ static inline int vout_Control( vout_thread_t *p_vout, int i_query, ... )
 
 enum output_query_e
 {
-    VOUT_SET_ZOOM,
+    VOUT_GET_SIZE,         /* arg1= unsigned int*, arg2= unsigned int*, res= */
+    VOUT_SET_SIZE,         /* arg1= unsigned int, arg2= unsigned int, res= */
     VOUT_SET_STAY_ON_TOP,  /* arg1= vlc_bool_t       res=    */
     VOUT_REPARENT,
     VOUT_SNAPSHOT,
index 6340dea2c2ce821965d66c852cf13e120941bca5..c047b5204b90ead6ff566a3c5941e13db03064fb 100644 (file)
@@ -511,10 +511,15 @@ int VlcProc::controlWindow( intf_thread_t *pIntf, void *pWindow,
 
     switch( query )
     {
-        case VOUT_SET_ZOOM:
+        case VOUT_SET_SIZE:
         {
             if( pThis->m_pVout )
             {
+                unsigned int i_width  = va_arg( args, unsigned int );
+                unsigned int i_height = va_arg( args, unsigned int );
+                if( !i_width ) i_width = pThis->m_pVout->i_window_width;
+                if( !i_height ) i_height = pThis->m_pVout->i_window_height;
+
                 // Post a resize vout command
                 CmdResizeVout *pCmd =
                     new CmdResizeVout( pThis->getIntf(), pWindow,
index 5ad983ce62606bbe5c02b348ef19ecce28e31bc3..e94356b3f0b7d0728c83eceafe530b50d88d4dcd 100644 (file)
@@ -273,6 +273,7 @@ void VideoWindow::UpdateSize( wxEvent &_event )
         SetFocus();
         b_shown = VLC_TRUE;
     }
+
     p_intf->p_sys->p_video_sizer->SetMinSize( event->GetSize() );
 
     i_creation_date = mdate();
@@ -327,16 +328,32 @@ int VideoWindow::ControlWindow( void *p_window, int i_query, va_list args )
 
     switch( i_query )
     {
-        case VOUT_SET_ZOOM:
+        case VOUT_GET_SIZE:
+        {
+            unsigned int *pi_width  = va_arg( args, unsigned int * );
+            unsigned int *pi_height = va_arg( args, unsigned int * );
+
+           *pi_width = GetSize().GetWidth();
+           *pi_height = GetSize().GetHeight();
+            i_ret = VLC_SUCCESS;
+        }
+        break;
+
+        case VOUT_SET_SIZE:
         {
             if( !b_auto_size ) break;
 
+            unsigned int i_width  = va_arg( args, unsigned int );
+            unsigned int i_height = va_arg( args, unsigned int );
+
+            vlc_mutex_lock( &lock );
+            if( !i_width && p_vout ) i_width = p_vout->i_window_width;
+            if( !i_height && p_vout ) i_height = p_vout->i_window_height;
+            vlc_mutex_unlock( &lock );
+
             /* Update dimensions */
-            wxSizeEvent event( wxSize( p_vout->i_window_width,
-                                       p_vout->i_window_height ),
-                               UpdateSize_Event );
+            wxSizeEvent event( wxSize( i_width, i_height ), UpdateSize_Event );
 
-              
             AddPendingEvent( event );
 
             i_ret = VLC_SUCCESS;
index 546a22bfbea6a823be9f47297283e4f480cf9481..5c345c579d73b5f67380ada45020577073fafad7 100644 (file)
@@ -555,7 +555,6 @@ static int Manage( vout_thread_t *p_vout )
         p_vout->fmt_out.i_sar_den = p_vout->fmt_in.i_sar_den;
         p_vout->output.i_aspect = p_vout->fmt_in.i_aspect;
         E_(DirectXUpdateRects)( p_vout, VLC_TRUE );
-        vout_Control( p_vout, VOUT_SET_ZOOM );
     }
 
     /* We used to call the Win32 PeekMessage function here to read the window
index f7dd749071f630c66014cf6cf917e1232627d4ae..bd2aad4f8aa95e1e18bd4de6b268a81f0ef22986 100644 (file)
@@ -889,21 +889,37 @@ static int DirectXConvertKey( int i_key )
  *****************************************************************************/
 static int Control( vout_thread_t *p_vout, int i_query, va_list args )
 {
-    double f_arg;
+    unsigned int *pi_width, *pi_height;
     RECT rect_window;
     POINT point;
 
     switch( i_query )
     {
-    case VOUT_SET_ZOOM:
+    case VOUT_GET_SIZE:
+        if( p_vout->p_sys->hparent )
+            return vout_ControlWindow( p_vout,
+                    (void *)p_vout->p_sys->hparent, i_query, args );
+
+        pi_width  = va_arg( args, unsigned int * );
+        pi_height = va_arg( args, unsigned int * );
+
+        GetClientRect( p_vout->p_sys->hwnd, &rect_window );
+
+        *pi_width  = rect_window.right - rect_window.left;
+        *pi_height = rect_window.bottom - rect_window.top;
+        return VLC_SUCCESS;
+
+    case VOUT_SET_SIZE:
         if( p_vout->p_sys->hparent )
             return vout_ControlWindow( p_vout,
                     (void *)p_vout->p_sys->hparent, i_query, args );
 
         /* Update dimensions */
         rect_window.top = rect_window.left = 0;
-        rect_window.right  = p_vout->i_window_width;
-        rect_window.bottom = p_vout->i_window_height;
+        rect_window.right  = va_arg( args, unsigned int );
+        rect_window.bottom = va_arg( args, unsigned int );
+        if( !rect_window.right ) rect_window.right = p_vout->i_window_width;
+        if( !rect_window.bottom ) rect_window.bottom = p_vout->i_window_height;
         AdjustWindowRect( &rect_window, p_vout->p_sys->i_window_style, 0 );
 
         SetWindowPos( p_vout->p_sys->hwnd, 0, 0, 0,
index 961c06778bf0daf22e0a8debe1e9095606b8b67d..82b78711a0322ea224529a10f861f7afa935a062 100644 (file)
@@ -318,7 +318,6 @@ static int Manage( vout_thread_t *p_vout )
         p_vout->fmt_out.i_sar_den = p_vout->fmt_in.i_sar_den;
         p_vout->output.i_aspect = p_vout->fmt_in.i_aspect;
         E_(DirectXUpdateRects)( p_vout, VLC_TRUE );
-        vout_Control( p_vout, VOUT_SET_ZOOM );
     }
 
     /* We used to call the Win32 PeekMessage function here to read the window
index bc42cfda4c759b4497c624148735820f62481c28..0452264e457399477f8218a71796b5424d8e2613 100644 (file)
@@ -1282,22 +1282,38 @@ static void InitBuffers( vout_thread_t *p_vout )
  *****************************************************************************/
 static int Control( vout_thread_t *p_vout, int i_query, va_list args )
 {
+    unsigned int *pi_width, *pi_height;
     vlc_bool_t b_bool;
-    double f_arg;
     RECT rect_window;
     POINT point;
 
     switch( i_query )
     {
-    case VOUT_SET_ZOOM:
+    case VOUT_GET_SIZE:
+        if( p_vout->p_sys->hparent )
+            return vout_ControlWindow( p_vout,
+                    (void *)p_vout->p_sys->hparent, i_query, args );
+
+        pi_width  = va_arg( args, unsigned int * );
+        pi_height = va_arg( args, unsigned int * );
+
+        GetClientRect( p_vout->p_sys->hwnd, &rect_window );
+
+        *pi_width  = rect_window.right - rect_window.left;
+        *pi_height = rect_window.bottom - rect_window.top;
+        return VLC_SUCCESS;
+
+    case VOUT_SET_SIZE:
         if( p_vout->p_sys->hparent )
             return vout_ControlWindow( p_vout,
                     (void *)p_vout->p_sys->hparent, i_query, args );
 
         /* Update dimensions */
         rect_window.top = rect_window.left = 0;
-        rect_window.right  = p_vout->i_window_width;
-        rect_window.bottom = p_vout->i_window_height;
+        rect_window.right  = va_arg( args, unsigned int );
+        rect_window.bottom = va_arg( args, unsigned int );
+        if( !rect_window.right ) rect_window.right = p_vout->i_window_width;
+        if( !rect_window.bottom ) rect_window.bottom = p_vout->i_window_height;
         AdjustWindowRect( &rect_window, p_vout->p_sys->i_window_style, 0 );
 
         SetWindowPos( p_vout->p_sys->hwnd, 0, 0, 0,
index 7e2352af9f1bf0f67890b846bd7ad2a6e8752f61..affd0956961e758d372cdcd75df51c9d8b5311f2 100644 (file)
@@ -2288,23 +2288,42 @@ static void SetPalette( vout_thread_t *p_vout,
  *****************************************************************************/
 static int Control( vout_thread_t *p_vout, int i_query, va_list args )
 {
-    double f_arg;
     vlc_bool_t b_arg;
+    unsigned int i_width, i_height;
+    unsigned int *pi_width, *pi_height;
 
     switch( i_query )
     {
-        case VOUT_SET_ZOOM:
+        case VOUT_GET_SIZE:
+            if( p_vout->p_sys->p_win->owner_window )
+                return vout_ControlWindow( p_vout,
+                    (void *)p_vout->p_sys->p_win->owner_window, i_query, args);
+
+            pi_width  = va_arg( args, unsigned int * );
+            pi_height = va_arg( args, unsigned int * );
+
+            vlc_mutex_lock( &p_vout->p_sys->lock );
+            *pi_width  = p_vout->p_sys->p_win->i_width;
+            *pi_height = p_vout->p_sys->p_win->i_height;
+            vlc_mutex_unlock( &p_vout->p_sys->lock );
+            return VLC_SUCCESS;
+
+        case VOUT_SET_SIZE:
             if( p_vout->p_sys->p_win->owner_window )
                 return vout_ControlWindow( p_vout,
                     (void *)p_vout->p_sys->p_win->owner_window, i_query, args);
 
             vlc_mutex_lock( &p_vout->p_sys->lock );
 
+            i_width  = va_arg( args, unsigned int );
+            i_height = va_arg( args, unsigned int );
+            if( !i_width ) i_width = p_vout->i_window_width;
+            if( !i_height ) i_height = p_vout->i_window_height;
+
             /* Update dimensions */
             XResizeWindow( p_vout->p_sys->p_display,
                            p_vout->p_sys->p_win->base_window,
-                           p_vout->i_window_width,
-                           p_vout->i_window_height );
+                           i_width, i_height );
 
             vlc_mutex_unlock( &p_vout->p_sys->lock );
             return VLC_SUCCESS;
index d6f0ba26bd5d129098c67fd6b2032262043a6a01..f422fc5a8d1225ec989a0dd0c45338b2f70b71e8 100644 (file)
@@ -610,7 +610,7 @@ static int ZoomCallback( vlc_object_t *p_this, char const *psz_cmd,
     vout_thread_t *p_vout = (vout_thread_t *)p_this;
     InitWindowSize( p_vout, &p_vout->i_window_width,
                     &p_vout->i_window_height );
-    vout_Control( p_vout, VOUT_SET_ZOOM );
+    vout_Control( p_vout, VOUT_SET_SIZE, 0, 0 );
     return VLC_SUCCESS;
 }