]> git.sesse.net Git - vlc/blobdiff - modules/video_output/msw/events.c
Wine: compilation fixes
[vlc] / modules / video_output / msw / events.c
index 9c48875332a710f306a94c541c35cca3bd47504b..a35bdee45c66803412be17bb1d508e6cd4e17f31 100644 (file)
@@ -1,7 +1,7 @@
 /*****************************************************************************
  * events.c: Windows DirectX video output events handler
  *****************************************************************************
- * Copyright (C) 2001-2004 the VideoLAN team
+ * Copyright (C) 2001-2009 the VideoLAN team
  * $Id$
  *
  * Authors: Gildas Bazin <gbazin@videolan.org>
@@ -44,6 +44,7 @@
 #include <vlc_window.h>
 
 #include <windows.h>
+#include <tchar.h>
 #include <windowsx.h>
 #include <shellapi.h>
 
@@ -176,8 +177,7 @@ void* EventThread( vlc_object_t *p_this )
                     p_event->p_vout->fmt_in.i_y_offset;
                 var_Set( p_event->p_vout, "mouse-y", val );
 
-                val.b_bool = true;
-                var_Set( p_event->p_vout, "mouse-moved", val );
+                var_SetBool( p_event->p_vout, "mouse-moved", true );
             }
 
         case WM_NCMOUSEMOVE:
@@ -418,11 +418,12 @@ static int DirectXCreateWindow( vout_thread_t *p_vout )
 
     /* If an external window was specified, we'll draw in it. */
     p_vout->p_sys->parent_window =
-        vout_RequestWindow( p_vout, &p_vout->p_sys->i_window_x,
+        vout_RequestHWND( p_vout, &p_vout->p_sys->i_window_x,
                             &p_vout->p_sys->i_window_y,
                             &p_vout->p_sys->i_window_width,
                             &p_vout->p_sys->i_window_height );
-    p_vout->p_sys->hparent = p_vout->p_sys->parent_window->handle;
+    if( p_vout->p_sys->parent_window )
+        p_vout->p_sys->hparent = p_vout->p_sys->parent_window->handle.hwnd;
 
     /* We create the window ourself, there is no previous window proc. */
     p_vout->p_sys->pf_wndproc = NULL;
@@ -1043,19 +1044,6 @@ static int Control( vout_thread_t *p_vout, int i_query, va_list args )
 
     switch( i_query )
     {
-    case VOUT_GET_SIZE:
-        if( p_vout->p_sys->parent_window )
-            return vaControlParentWindow( p_vout, 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->parent_window )
             return vaControlParentWindow( p_vout, i_query, args );
@@ -1074,54 +1062,6 @@ static int Control( vout_thread_t *p_vout, int i_query, va_list args )
 
         return VLC_SUCCESS;
 
-    case VOUT_CLOSE:
-        ShowWindow( p_vout->p_sys->hwnd, SW_HIDE );
-    case VOUT_REPARENT:
-        /* Retrieve the window position */
-        point.x = point.y = 0;
-        ClientToScreen( p_vout->p_sys->hwnd, &point );
-
-        HWND d = 0;
-
-        if( i_query == VOUT_REPARENT ) d = (HWND)va_arg( args, int );
-        if( !d )
-        {
-            vlc_mutex_lock( &p_vout->p_sys->lock );
-            p_vout->p_sys->hparent = 0;
-            vlc_mutex_unlock( &p_vout->p_sys->lock );
-            SetParent( p_vout->p_sys->hwnd, 0 );
-            p_vout->p_sys->i_window_style =
-                WS_CLIPCHILDREN | WS_OVERLAPPEDWINDOW | WS_SIZEBOX;
-            SetWindowLong( p_vout->p_sys->hwnd, GWL_STYLE,
-                           p_vout->p_sys->i_window_style |
-                           (i_query == VOUT_CLOSE ? 0 : WS_VISIBLE) );
-            SetWindowLong( p_vout->p_sys->hwnd, GWL_EXSTYLE, WS_EX_APPWINDOW );
-            SetWindowPos( p_vout->p_sys->hwnd, 0, point.x, point.y, 0, 0,
-                          SWP_NOSIZE|SWP_NOZORDER|SWP_FRAMECHANGED );
-        }
-        else
-        {
-            vlc_mutex_lock( &p_vout->p_sys->lock );
-            p_vout->p_sys->hparent = d;
-            vlc_mutex_unlock( &p_vout->p_sys->lock );
-
-            SetParent( p_vout->p_sys->hwnd, d );
-            p_vout->p_sys->i_window_style = WS_CLIPCHILDREN;
-            SetWindowLong( p_vout->p_sys->hwnd, GWL_STYLE,
-                           p_vout->p_sys->i_window_style |
-                           (i_query == VOUT_CLOSE ? 0 : WS_VISIBLE) );
-            SetWindowLong( p_vout->p_sys->hwnd, GWL_EXSTYLE, WS_EX_APPWINDOW );
-
-            /* Retrieve the parent size */
-            RECT  rect;
-            GetClientRect( d, &rect );
-            SetWindowPos( p_vout->p_sys->hwnd, d, point.x, point.y, rect.right, rect.bottom,
-                          SWP_FRAMECHANGED );
-        }
-
-        vout_ReleaseWindow( p_vout->p_sys->parent_window );
-        return VLC_SUCCESS;
-
     case VOUT_SET_STAY_ON_TOP:
         if( p_vout->p_sys->hparent && !var_GetBool( p_vout, "fullscreen" ) )
             return vaControlParentWindow( p_vout, i_query, args );
@@ -1129,17 +1069,8 @@ static int Control( vout_thread_t *p_vout, int i_query, va_list args )
         p_vout->p_sys->b_on_top_change = true;
         return VLC_SUCCESS;
 
-#ifdef MODULE_NAME_IS_wingapi
-    case VOUT_SET_FOCUS:
-               b_bool = (bool) va_arg( args, int );
-        p_vout->p_sys->b_parent_focus = b_bool;
-        if( b_bool ) GXResume();
-        else if( !p_vout->p_sys->b_focus ) GXSuspend();
-        return VLC_SUCCESS;
-#endif
-
     default:
-        return vout_vaControlDefault( p_vout, i_query, args );
+        return VLC_EGENERIC;
     }
 }
 
@@ -1153,15 +1084,6 @@ static WINDOWPLACEMENT getWindowState(HWND hwnd)
     return window_placement;
 }
 
-/* Internal wrapper over SetWindowPlacement */
-static void SetWindowState(HWND hwnd, int nShowCmd,WINDOWPLACEMENT window_placement)
-{
-    window_placement.showCmd = nShowCmd;
-    SetWindowPlacement( hwnd, &window_placement );
-    SetWindowPos( hwnd, 0, 0, 0, 0, 0,
-        SWP_NOMOVE|SWP_NOSIZE|SWP_NOZORDER|SWP_FRAMECHANGED);
-}
-
 /* Internal wrapper to call vout_ControlWindow for hparent */
 static int vaControlParentWindow( vout_thread_t *p_vout, int i_query,
                                    va_list args )
@@ -1225,9 +1147,11 @@ void Win32ToggleFullscreen( vout_thread_t *p_vout )
                             SWP_NOZORDER|SWP_FRAMECHANGED );
 #endif
         }
-
-        /* Maximize window */
-        SetWindowState( hwnd, SW_SHOWMAXIMIZED, window_placement );
+        else
+        {
+            /* Maximize non embedded window */
+            ShowWindow( hwnd, SW_SHOWMAXIMIZED );
+        }
 
         if( p_vout->p_sys->hparent )
         {
@@ -1255,9 +1179,6 @@ void Win32ToggleFullscreen( vout_thread_t *p_vout )
         /* Change window style, no borders and no title bar */
         SetWindowLong( hwnd, GWL_STYLE, p_vout->p_sys->i_window_style );
 
-        /* Normal window */
-        SetWindowState( hwnd, SW_SHOWNORMAL, window_placement );
-
         if( p_vout->p_sys->hparent )
         {
             RECT rect;
@@ -1276,13 +1197,17 @@ void Win32ToggleFullscreen( vout_thread_t *p_vout )
             SetForegroundWindow( p_vout->p_sys->hparent );
             ShowWindow( hwnd, SW_HIDE );
         }
+        else
+        {
+            /* return to normal window for non embedded vout */
+            SetWindowPlacement( hwnd, &window_placement );
+            ShowWindow( hwnd, SW_SHOWNORMAL );
+        }
 
         /* Make sure the mouse cursor is displayed */
         PostMessage( p_vout->p_sys->hwnd, WM_VLC_SHOW_MOUSE, 0, 0 );
     }
 
-    vlc_value_t val;
     /* Update the object variable and trigger callback */
-    val.b_bool = p_vout->b_fullscreen;
-    var_Set( p_vout, "fullscreen", val );
+    var_SetBool( p_vout, "fullscreen", p_vout->b_fullscreen );
 }