* modules/video_output/directx/glwin32.c: 1st shot at a win32 opengl provider.
authorGildas Bazin <gbazin@videolan.org>
Fri, 23 Jul 2004 12:47:34 +0000 (12:47 +0000)
committerGildas Bazin <gbazin@videolan.org>
Fri, 23 Jul 2004 12:47:34 +0000 (12:47 +0000)
* modules/video_output/directx/events.c: removed unused code.

modules/video_output/directx/Modules.am
modules/video_output/directx/events.c
modules/video_output/directx/glwin32.c [new file with mode: 0644]
modules/video_output/directx/vout.h

index 1107cec..1bc35e6 100644 (file)
@@ -4,3 +4,8 @@ SOURCES_vout_directx = \
        events.c \
        $(NULL)
 
+SOURCES_glwin32 = \
+       glwin32.c \
+       vout.h \
+       events.c \
+       $(NULL)
index 8eee882..5204da1 100644 (file)
@@ -55,7 +55,6 @@
 static int  DirectXCreateWindow( vout_thread_t *p_vout );
 static void DirectXCloseWindow ( vout_thread_t *p_vout );
 static long FAR PASCAL DirectXEventProc( HWND, UINT, WPARAM, LPARAM );
-static long FAR PASCAL DirectXVideoEventProc( HWND, UINT, WPARAM, LPARAM );
 
 static int Control( vout_thread_t *p_vout, int i_query, va_list args );
 
@@ -298,6 +297,10 @@ void DirectXEventThread( event_thread_t *p_event )
 
             if( !val.psz_string || !*val.psz_string ) /* Default video title */
             {
+#ifdef MODULE_NAME_IS_glwin32
+                SetWindowText( p_event->p_vout->p_sys->hwnd,
+                    VOUT_TITLE " (OpenGL output)" );
+#else
                 if( p_event->p_vout->p_sys->b_using_overlay )
                     SetWindowText( p_event->p_vout->p_sys->hwnd,
                         VOUT_TITLE " (hardware YUV overlay DirectX output)" );
@@ -306,6 +309,7 @@ void DirectXEventThread( event_thread_t *p_event )
                         VOUT_TITLE " (hardware YUV DirectX output)" );
                 else SetWindowText( p_event->p_vout->p_sys->hwnd,
                         VOUT_TITLE " (software RGB DirectX output)" );
+#endif
             }
             else
             {
@@ -383,7 +387,7 @@ static int DirectXCreateWindow( vout_thread_t *p_vout )
 
     /* Fill in the window class structure */
     wc.cbSize        = sizeof(WNDCLASSEX);
-    wc.style         = CS_DBLCLKS;                   /* style: dbl click */
+    wc.style         = CS_OWNDC|CS_DBLCLKS;          /* style: dbl click */
     wc.lpfnWndProc   = (WNDPROC)DirectXEventProc;       /* event handler */
     wc.cbClsExtra    = 0;                         /* no extra class data */
     wc.cbWndExtra    = 0;                        /* no extra window data */
@@ -460,7 +464,6 @@ static int DirectXCreateWindow( vout_thread_t *p_vout )
             /* Hmmm, apparently this is a blocking call... */
             SetWindowLong( p_vout->p_sys->hparent, GWL_STYLE,
                            i_style | WS_CLIPCHILDREN );
-
     }
 
     /* Now display the window */
@@ -689,6 +692,9 @@ static long FAR PASCAL DirectXEventProc( HWND hwnd, UINT message,
         return DefWindowProc(hwnd, message, wParam, lParam);
     }
 
+    if( hwnd == p_vout->p_sys->hvideownd )
+        return DefWindowProc(hwnd, message, wParam, lParam);
+
     switch( message )
     {
 
@@ -746,28 +752,18 @@ static long FAR PASCAL DirectXEventProc( HWND hwnd, UINT message,
     case WM_VLC_CREATE_VIDEO_WIN:
         /* Create video sub-window */
         p_vout->p_sys->hvideownd =
-            CreateWindow( "STATIC", "",   /* window class and title bar text */
+            CreateWindow( "VLC DirectX", "",  /* window class/title bar text */
                     WS_CHILD | WS_VISIBLE,                   /* window style */
                     CW_USEDEFAULT, CW_USEDEFAULT,     /* default coordinates */
                     CW_USEDEFAULT, CW_USEDEFAULT,
                     hwnd,                                   /* parent window */
-                    NULL, GetModuleHandle(NULL), NULL );
+                    NULL, GetModuleHandle(NULL),
+                    (LPVOID)p_vout );            /* send p_vout to WM_CREATE */
 
         if( !p_vout->p_sys->hvideownd )
-        {
             msg_Warn( p_vout, "Can't create video sub-window" );
-        }
         else
-        {
             msg_Dbg( p_vout, "Created video sub-window" );
-            SetWindowLongPtr( p_vout->p_sys->hvideownd,
-                              GWLP_WNDPROC, (LONG_PTR)DirectXVideoEventProc );
-            /* Store the previous window proc of _this_ window with the video
-             * window so we can use it in DirectXVideoEventProc to pass
-             * messages to the creator of _this_ window */
-            SetWindowLongPtr( p_vout->p_sys->hvideownd, GWLP_USERDATA,
-                              (LONG_PTR)p_vout->p_sys->pf_wndproc );
-        }
         break;
 
     case WM_PAINT:
@@ -787,60 +783,6 @@ static long FAR PASCAL DirectXEventProc( HWND hwnd, UINT message,
     return DefWindowProc(hwnd, message, wParam, lParam);
 }
 
-static long FAR PASCAL DirectXVideoEventProc( HWND hwnd, UINT message,
-                                              WPARAM wParam, LPARAM lParam )
-{
-    WNDPROC pf_parentwndproc;
-    POINT pt;
-
-    switch( message )
-    {
-    case WM_MOUSEMOVE:
-    case WM_LBUTTONDOWN:
-    case WM_LBUTTONUP:
-    case WM_LBUTTONDBLCLK:
-    case WM_MBUTTONDOWN:
-    case WM_MBUTTONUP:
-    case WM_RBUTTONDOWN:
-    case WM_RBUTTONUP:
-        /* Translate mouse cursor position to parent window coordinates. */
-        pt.x = LOWORD( lParam );
-        pt.y = HIWORD( lParam );
-        MapWindowPoints( hwnd, GetParent( hwnd ), &pt, 1 );
-        lParam = MAKELPARAM( pt.x, pt.y );
-        /* Fall through. */
-    case WM_KEYDOWN:
-    case WM_KEYUP:
-    case WM_SYSKEYDOWN:
-    case WM_SYSKEYUP:
-        /* Foward these to the original window proc of the parent so the
-         * creator of the window gets a chance to process them. If we created
-         * the parent window ourself DirectXEventThread will process these
-         * and they will never make it here.
-         * Note that we fake the hwnd to be our parent in order to prevent
-         * confusion in the creator's window proc. */
-        pf_parentwndproc = (WNDPROC)GetWindowLongPtr( hwnd, GWLP_USERDATA );
-
-        if( pf_parentwndproc )
-        {
-            LRESULT i_ret;
-            LONG_PTR p_backup;
-
-            pf_parentwndproc = (WNDPROC)GetWindowLongPtr( hwnd, GWLP_USERDATA);
-
-            p_backup = SetWindowLongPtr( GetParent( hwnd ), GWLP_USERDATA, 0 );
-            i_ret = CallWindowProc( pf_parentwndproc, GetParent( hwnd ),
-                                    message, wParam, lParam );
-            SetWindowLongPtr( GetParent( hwnd ), GWLP_USERDATA, p_backup );
-
-            return i_ret;
-        }
-        break;
-    }
-
-    return DefWindowProc(hwnd, message, wParam, lParam);
-}
-
 static struct
 {
     int i_dxkey;
diff --git a/modules/video_output/directx/glwin32.c b/modules/video_output/directx/glwin32.c
new file mode 100644 (file)
index 0000000..eee84c7
--- /dev/null
@@ -0,0 +1,451 @@
+/*****************************************************************************\r
+ * glwin32.c: Windows OpenGL provider\r
+ *****************************************************************************\r
+ * Copyright (C) 2001-2004 VideoLAN\r
+ * $Id$\r
+ *\r
+ * Authors: Gildas Bazin <gbazin@videolan.org>\r
+ *\r
+ * This program is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU General Public License as published by\r
+ * the Free Software Foundation; either version 2 of the License, or\r
+ * (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.\r
+ *****************************************************************************/\r
+\r
+#include <errno.h>                                                 /* ENOMEM */\r
+#include <stdlib.h>                                                /* free() */\r
+#include <string.h>                                            /* strerror() */\r
+\r
+#include <vlc/vlc.h>\r
+#include <vlc/intf.h>\r
+#include <vlc/vout.h>\r
+\r
+#include <windows.h>\r
+#include <ddraw.h>\r
+#include <commctrl.h>\r
+\r
+#include <multimon.h>\r
+#undef GetSystemMetrics\r
+\r
+#ifndef MONITOR_DEFAULTTONEAREST\r
+#   define MONITOR_DEFAULTTONEAREST 2\r
+#endif\r
+\r
+#include <GL/gl.h>\r
+\r
+#include "vout.h"\r
+\r
+/*****************************************************************************\r
+ * Local prototypes.\r
+ *****************************************************************************/\r
+static int  OpenVideo  ( vlc_object_t * );\r
+static void CloseVideo ( vlc_object_t * );\r
+\r
+static int  Init      ( vout_thread_t * );\r
+static void End       ( vout_thread_t * );\r
+static int  Manage    ( vout_thread_t * );\r
+static void GLSwapBuffers( vout_thread_t * );\r
+\r
+/*****************************************************************************\r
+ * Module descriptor\r
+ *****************************************************************************/\r
+vlc_module_begin();\r
+    set_description( _("Win32 OpenGL provider") );\r
+    set_capability( "opengl provider", 100 );\r
+    add_shortcut( "glwin32" );\r
+    set_callbacks( OpenVideo, CloseVideo );\r
+vlc_module_end();\r
+\r
+#if 0 /* FIXME */\r
+    /* check if we registered a window class because we need to\r
+     * unregister it */\r
+    WNDCLASS wndclass;\r
+    if( GetClassInfo( GetModuleHandle(NULL), "VLC DirectX", &wndclass ) )\r
+        UnregisterClass( "VLC DirectX", GetModuleHandle(NULL) );\r
+#endif\r
+\r
+/*****************************************************************************\r
+ * OpenVideo: allocate OpenGL provider\r
+ *****************************************************************************\r
+ * This function creates and initializes a video window.\r
+ *****************************************************************************/\r
+static int OpenVideo( vlc_object_t *p_this )\r
+{\r
+    vout_thread_t * p_vout = (vout_thread_t *)p_this;\r
+    vlc_value_t val;\r
+\r
+    /* Allocate structure */\r
+    p_vout->p_sys = malloc( sizeof( vout_sys_t ) );\r
+    if( p_vout->p_sys == NULL )\r
+    {\r
+        msg_Err( p_vout, "out of memory" );\r
+        return VLC_ENOMEM;\r
+    }\r
+    memset( p_vout->p_sys, 0, sizeof( vout_sys_t ) );\r
+\r
+    /* Initialisations */\r
+    p_vout->pf_init = Init;\r
+    p_vout->pf_end = End;\r
+    p_vout->pf_manage = Manage;\r
+    p_vout->pf_swap = GLSwapBuffers;\r
+\r
+    p_vout->p_sys->p_ddobject = NULL;\r
+    p_vout->p_sys->p_display = NULL;\r
+    p_vout->p_sys->p_current_surface = NULL;\r
+    p_vout->p_sys->p_clipper = NULL;\r
+    p_vout->p_sys->hwnd = p_vout->p_sys->hvideownd = NULL;\r
+    p_vout->p_sys->hparent = NULL;\r
+    p_vout->p_sys->i_changes = 0;\r
+    p_vout->p_sys->b_wallpaper = 0;\r
+    vlc_mutex_init( p_vout, &p_vout->p_sys->lock );\r
+    SetRectEmpty( &p_vout->p_sys->rect_display );\r
+    SetRectEmpty( &p_vout->p_sys->rect_parent );\r
+\r
+    var_Create( p_vout, "video-title", VLC_VAR_STRING | VLC_VAR_DOINHERIT );\r
+\r
+    p_vout->p_sys->b_cursor_hidden = 0;\r
+    p_vout->p_sys->i_lastmoved = mdate();\r
+\r
+    /* Set main window's size */\r
+    p_vout->p_sys->i_window_width = p_vout->i_window_width;\r
+    p_vout->p_sys->i_window_height = p_vout->i_window_height;\r
+\r
+    /* Create the DirectXEventThread, this thread is created by us to isolate\r
+     * the Win32 PeekMessage function calls. We want to do this because\r
+     * Windows can stay blocked inside this call for a long time, and when\r
+     * this happens it thus blocks vlc's video_output thread.\r
+     * DirectXEventThread will take care of the creation of the video\r
+     * window (because PeekMessage has to be called from the same thread which\r
+     * created the window). */\r
+    msg_Dbg( p_vout, "creating DirectXEventThread" );\r
+    p_vout->p_sys->p_event =\r
+        vlc_object_create( p_vout, sizeof(event_thread_t) );\r
+    p_vout->p_sys->p_event->p_vout = p_vout;\r
+    if( vlc_thread_create( p_vout->p_sys->p_event, "DirectX Events Thread",\r
+                           DirectXEventThread, 0, 1 ) )\r
+    {\r
+        msg_Err( p_vout, "cannot create DirectXEventThread" );\r
+        vlc_object_destroy( p_vout->p_sys->p_event );\r
+        p_vout->p_sys->p_event = NULL;\r
+        goto error;\r
+    }\r
+\r
+    if( p_vout->p_sys->p_event->b_error )\r
+    {\r
+        msg_Err( p_vout, "DirectXEventThread failed" );\r
+        goto error;\r
+    }\r
+\r
+    vlc_object_attach( p_vout->p_sys->p_event, p_vout );\r
+\r
+    msg_Dbg( p_vout, "DirectXEventThread running" );\r
+\r
+    /* Variable to indicate if the window should be on top of others */\r
+    /* Trigger a callback right now */\r
+    var_Get( p_vout, "video-on-top", &val );\r
+    var_Set( p_vout, "video-on-top", val );\r
+\r
+    return VLC_SUCCESS;\r
+\r
+ error:\r
+    CloseVideo( VLC_OBJECT(p_vout) );\r
+    return VLC_EGENERIC;\r
+}\r
+\r
+/*****************************************************************************\r
+ * Init: initialize video thread output method\r
+ *****************************************************************************/\r
+static int Init( vout_thread_t *p_vout )\r
+{\r
+    PIXELFORMATDESCRIPTOR pfd;\r
+    int iFormat;\r
+\r
+    /* Change the window title bar text */\r
+    PostMessage( p_vout->p_sys->hwnd, WM_VLC_CHANGE_TEXT, 0, 0 );\r
+\r
+    p_vout->p_sys->hGLDC = GetDC( p_vout->p_sys->hvideownd );\r
+\r
+    /* Set the pixel format for the DC */\r
+    memset( &pfd, 0, sizeof( pfd ) );\r
+    pfd.nSize = sizeof( pfd );\r
+    pfd.nVersion = 1;\r
+    pfd.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER;\r
+    pfd.iPixelType = PFD_TYPE_RGBA;\r
+    pfd.cColorBits = 24;\r
+    pfd.cDepthBits = 16;\r
+    pfd.iLayerType = PFD_MAIN_PLANE;\r
+    iFormat = ChoosePixelFormat( p_vout->p_sys->hGLDC, &pfd );\r
+    SetPixelFormat( p_vout->p_sys->hGLDC, iFormat, &pfd );\r
+\r
+    /* Create and enable the render context */\r
+    p_vout->p_sys->hGLRC = wglCreateContext( p_vout->p_sys->hGLDC );\r
+    wglMakeCurrent( p_vout->p_sys->hGLDC, p_vout->p_sys->hGLRC );\r
+\r
+    return VLC_SUCCESS;\r
+}\r
+\r
+/*****************************************************************************\r
+ * End: terminate Sys video thread output method\r
+ *****************************************************************************\r
+ * Terminate an output method created by Create.\r
+ * It is called at the end of the thread.\r
+ *****************************************************************************/\r
+static void End( vout_thread_t *p_vout )\r
+{\r
+    wglMakeCurrent( NULL, NULL );\r
+    wglDeleteContext( p_vout->p_sys->hGLRC );\r
+    ReleaseDC( p_vout->p_sys->hvideownd, p_vout->p_sys->hGLDC );\r
+    return;\r
+}\r
+\r
+/*****************************************************************************\r
+ * CloseVideo: destroy Sys video thread output method\r
+ *****************************************************************************\r
+ * Terminate an output method created by Create\r
+ *****************************************************************************/\r
+static void CloseVideo( vlc_object_t *p_this )\r
+{\r
+    vout_thread_t * p_vout = (vout_thread_t *)p_this;\r
+\r
+    msg_Dbg( p_vout, "CloseVideo" );\r
+\r
+    if( p_vout->p_sys->p_event )\r
+    {\r
+        vlc_object_detach( p_vout->p_sys->p_event );\r
+\r
+        /* Kill DirectXEventThread */\r
+        p_vout->p_sys->p_event->b_die = VLC_TRUE;\r
+\r
+        /* we need to be sure DirectXEventThread won't stay stuck in\r
+         * GetMessage, so we send a fake message */\r
+        if( p_vout->p_sys->hwnd )\r
+        {\r
+            PostMessage( p_vout->p_sys->hwnd, WM_NULL, 0, 0);\r
+        }\r
+\r
+        vlc_thread_join( p_vout->p_sys->p_event );\r
+        vlc_object_destroy( p_vout->p_sys->p_event );\r
+    }\r
+\r
+    vlc_mutex_destroy( &p_vout->p_sys->lock );\r
+\r
+    if( p_vout->p_sys )\r
+    {\r
+        free( p_vout->p_sys );\r
+        p_vout->p_sys = NULL;\r
+    }\r
+}\r
+\r
+/*****************************************************************************\r
+ * Manage: handle Sys events\r
+ *****************************************************************************\r
+ * This function should be called regularly by the video output thread.\r
+ * It returns a non null value if an error occured.\r
+ *****************************************************************************/\r
+static int Manage( vout_thread_t *p_vout )\r
+{\r
+    WINDOWPLACEMENT window_placement;\r
+\r
+    int i_width = p_vout->p_sys->rect_dest.right -\r
+        p_vout->p_sys->rect_dest.left;\r
+    int i_height = p_vout->p_sys->rect_dest.bottom -\r
+        p_vout->p_sys->rect_dest.top;\r
+    glViewport( 0, 0, i_width, i_height );\r
+\r
+    /* If we do not control our window, we check for geometry changes\r
+     * ourselves because the parent might not send us its events. */\r
+    vlc_mutex_lock( &p_vout->p_sys->lock );\r
+    if( p_vout->p_sys->hparent && !p_vout->b_fullscreen )\r
+    {\r
+        RECT rect_parent;\r
+        POINT point;\r
+\r
+        vlc_mutex_unlock( &p_vout->p_sys->lock );\r
+\r
+        GetClientRect( p_vout->p_sys->hparent, &rect_parent );\r
+        point.x = point.y = 0;\r
+        ClientToScreen( p_vout->p_sys->hparent, &point );\r
+        OffsetRect( &rect_parent, point.x, point.y );\r
+\r
+        if( !EqualRect( &rect_parent, &p_vout->p_sys->rect_parent ) )\r
+        {\r
+            p_vout->p_sys->rect_parent = rect_parent;\r
+\r
+            /* This one is to force the update even if only\r
+             * the position has changed */\r
+            SetWindowPos( p_vout->p_sys->hwnd, 0, 1, 1,\r
+                          rect_parent.right - rect_parent.left,\r
+                          rect_parent.bottom - rect_parent.top, 0 );\r
+\r
+            SetWindowPos( p_vout->p_sys->hwnd, 0, 0, 0,\r
+                          rect_parent.right - rect_parent.left,\r
+                          rect_parent.bottom - rect_parent.top, 0 );\r
+        }\r
+    }\r
+    else\r
+    {\r
+        vlc_mutex_unlock( &p_vout->p_sys->lock );\r
+    }\r
+\r
+    /* We used to call the Win32 PeekMessage function here to read the window\r
+     * messages. But since window can stay blocked into this function for a\r
+     * long time (for example when you move your window on the screen), I\r
+     * decided to isolate PeekMessage in another thread. */\r
+\r
+    /*\r
+     * Fullscreen change\r
+     */\r
+    if( p_vout->i_changes & VOUT_FULLSCREEN_CHANGE\r
+        || p_vout->p_sys->i_changes & VOUT_FULLSCREEN_CHANGE )\r
+    {\r
+        int i_style = 0;\r
+        vlc_value_t val;\r
+\r
+        p_vout->b_fullscreen = ! p_vout->b_fullscreen;\r
+\r
+        /* We need to switch between Maximized and Normal sized window */\r
+        window_placement.length = sizeof(WINDOWPLACEMENT);\r
+        if( p_vout->b_fullscreen )\r
+        {\r
+            if( p_vout->p_sys->hparent )\r
+            {\r
+                POINT point;\r
+\r
+                /* Retrieve the window position */\r
+                point.x = point.y = 0;\r
+                ClientToScreen( p_vout->p_sys->hwnd, &point );\r
+                SetParent( p_vout->p_sys->hwnd, GetDesktopWindow() );\r
+                SetWindowPos( p_vout->p_sys->hwnd, 0, point.x, point.y, 0, 0,\r
+                              SWP_NOSIZE|SWP_NOZORDER|SWP_FRAMECHANGED );\r
+                SetForegroundWindow( p_vout->p_sys->hwnd );\r
+            }\r
+\r
+            /* Maximized window */\r
+            GetWindowPlacement( p_vout->p_sys->hwnd, &window_placement );\r
+            window_placement.showCmd = SW_SHOWMAXIMIZED;\r
+            /* Change window style, no borders and no title bar */\r
+            i_style = WS_CLIPCHILDREN | WS_VISIBLE | WS_POPUP;\r
+        }\r
+        else\r
+        {\r
+            if( p_vout->p_sys->hparent )\r
+            {\r
+                SetParent( p_vout->p_sys->hwnd, p_vout->p_sys->hparent );\r
+                SetWindowPos( p_vout->p_sys->hwnd, 0, 0, 0, 0, 0,\r
+                              SWP_NOSIZE|SWP_NOZORDER|SWP_FRAMECHANGED );\r
+                i_style = WS_CLIPCHILDREN | WS_VISIBLE | WS_CHILD;\r
+                SetForegroundWindow( p_vout->p_sys->hparent );\r
+            }\r
+            else\r
+            {\r
+                i_style = WS_CLIPCHILDREN | WS_OVERLAPPEDWINDOW |\r
+                          WS_SIZEBOX | WS_VISIBLE;\r
+            }\r
+\r
+            /* Normal window */\r
+            GetWindowPlacement( p_vout->p_sys->hwnd, &window_placement );\r
+            window_placement.showCmd = SW_SHOWNORMAL;\r
+\r
+            /* Make sure the mouse cursor is displayed */\r
+            PostMessage( p_vout->p_sys->hwnd, WM_VLC_SHOW_MOUSE, 0, 0 );\r
+        }\r
+\r
+        /* Change window style, borders and title bar */\r
+        SetWindowLong( p_vout->p_sys->hwnd, GWL_STYLE, i_style );\r
+        SetWindowPlacement( p_vout->p_sys->hwnd, &window_placement );\r
+        SetWindowPos( p_vout->p_sys->hwnd, 0, 0, 0, 0, 0,\r
+                      SWP_NOMOVE|SWP_NOSIZE|SWP_NOZORDER|SWP_FRAMECHANGED );\r
+\r
+        /* Update the object variable and trigger callback */\r
+        val.b_bool = p_vout->b_fullscreen;\r
+        var_Set( p_vout, "fullscreen", val );\r
+\r
+        p_vout->i_changes &= ~VOUT_FULLSCREEN_CHANGE;\r
+        p_vout->p_sys->i_changes &= ~VOUT_FULLSCREEN_CHANGE;\r
+    }\r
+\r
+    /*\r
+     * Pointer change\r
+     */\r
+    if( p_vout->b_fullscreen && !p_vout->p_sys->b_cursor_hidden &&\r
+        (mdate() - p_vout->p_sys->i_lastmoved) > 5000000 )\r
+    {\r
+        POINT point;\r
+        HWND hwnd;\r
+\r
+        /* Hide the cursor only if it is inside our window */\r
+        GetCursorPos( &point );\r
+        hwnd = WindowFromPoint(point);\r
+        if( hwnd == p_vout->p_sys->hwnd || hwnd == p_vout->p_sys->hvideownd )\r
+        {\r
+            PostMessage( p_vout->p_sys->hwnd, WM_VLC_HIDE_MOUSE, 0, 0 );\r
+        }\r
+        else\r
+        {\r
+            p_vout->p_sys->i_lastmoved = mdate();\r
+        }\r
+    }\r
+\r
+    /*\r
+     * "Always on top" status change\r
+     */\r
+    if( p_vout->p_sys->b_on_top_change )\r
+    {\r
+        vlc_value_t val;\r
+        HMENU hMenu = GetSystemMenu( p_vout->p_sys->hwnd, FALSE );\r
+\r
+        var_Get( p_vout, "video-on-top", &val );\r
+\r
+        /* Set the window on top if necessary */\r
+        if( val.b_bool && !( GetWindowLong( p_vout->p_sys->hwnd, GWL_EXSTYLE )\r
+                           & WS_EX_TOPMOST ) )\r
+        {\r
+            CheckMenuItem( hMenu, IDM_TOGGLE_ON_TOP,\r
+                           MF_BYCOMMAND | MFS_CHECKED );\r
+            SetWindowPos( p_vout->p_sys->hwnd, HWND_TOPMOST, 0, 0, 0, 0,\r
+                          SWP_NOSIZE | SWP_NOMOVE );\r
+        }\r
+        else\r
+        /* The window shouldn't be on top */\r
+        if( !val.b_bool && ( GetWindowLong( p_vout->p_sys->hwnd, GWL_EXSTYLE )\r
+                           & WS_EX_TOPMOST ) )\r
+        {\r
+            CheckMenuItem( hMenu, IDM_TOGGLE_ON_TOP,\r
+                           MF_BYCOMMAND | MFS_UNCHECKED );\r
+            SetWindowPos( p_vout->p_sys->hwnd, HWND_NOTOPMOST, 0, 0, 0, 0,\r
+                          SWP_NOSIZE | SWP_NOMOVE );\r
+        }\r
+\r
+        p_vout->p_sys->b_on_top_change = VLC_FALSE;\r
+    }\r
+\r
+    /* Check if the event thread is still running */\r
+    if( p_vout->p_sys->p_event->b_die )\r
+    {\r
+        return VLC_EGENERIC; /* exit */\r
+    }\r
+\r
+    return VLC_SUCCESS;\r
+}\r
+\r
+/*****************************************************************************\r
+ * GLSwapBuffers: swap front/back buffers\r
+ *****************************************************************************/\r
+static void GLSwapBuffers( vout_thread_t *p_vout )\r
+{\r
+    SwapBuffers( p_vout->p_sys->hGLDC );\r
+}\r
+\r
+int DirectXUpdateOverlay( vout_thread_t *p_vout )\r
+{\r
+    return 1;\r
+}\r
index ba40ea4..da5c579 100644 (file)
@@ -104,6 +104,11 @@ struct vout_sys_t
     COLORREF        color_bkg;
     COLORREF        color_bkgtxt;
 
+#ifdef MODULE_NAME_IS_glwin32
+    HDC hGLDC;
+    HGLRC hGLRC;
+#endif
+
     event_thread_t *p_event;
     vlc_mutex_t    lock;
 };