[vlc-commits] D3D: Fix wallpaper mode under Win7

Jean-Baptiste Kempf git at videolan.org
Fri Aug 17 10:56:48 CEST 2012


vlc/vlc-2.0 | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Fri Aug 17 02:08:58 2012 +0200| [d200f5731e5ac26392e41d8acfdf9668959adb43] | committer: Jean-Baptiste Kempf

D3D: Fix wallpaper mode under Win7

Close #7348

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>
(cherry picked from commit 42480e9fe9f1b4a39d566c5d85aeae92706a3934)

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

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

 modules/video_output/msw/events.c |   45 +++++++++++++++++++++++++++++++------
 1 file changed, 38 insertions(+), 7 deletions(-)

diff --git a/modules/video_output/msw/events.c b/modules/video_output/msw/events.c
index 51de721..004f841 100644
--- a/modules/video_output/msw/events.c
+++ b/modules/video_output/msw/events.c
@@ -473,7 +473,44 @@ static void *EventThread( void *p_this )
     return NULL;
 }
 
+#ifdef MODULE_NAME_IS_direct3d
+static int CALLBACK
+enumWindowsProc(HWND hwnd, LPARAM lParam)
+{
+    HWND *wnd = (HWND *)lParam;
+
+    char name[128];
+    name[0] = '\0';
+    GetClassNameA( hwnd, name, 128 );
+
+    if( !strcasecmp( name, "WorkerW" ) )
+    {
+        hwnd = FindWindowEx( hwnd, NULL, _T("SHELLDLL_DefView"), NULL );
+        if( hwnd ) hwnd = FindWindowEx( hwnd, NULL, _T("SysListView32"), NULL );
+        if( hwnd )
+        {
+            *wnd = hwnd;
+            return false;
+        }
+    }
+    return true;
+}
+
+static HWND GetDesktopHandle(vout_display_t *vd)
+{
+    /* Find Program Manager */
+    HWND hwnd = FindWindow( _T("Progman"), NULL );
+    if( hwnd ) hwnd = FindWindowEx( hwnd, NULL, _T("SHELLDLL_DefView"), NULL );
+    if( hwnd ) hwnd = FindWindowEx( hwnd, NULL, _T("SysListView32"), NULL );
+    if( hwnd )
+        return hwnd;
 
+    msg_Dbg( vd, "Couldn't find desktop icon window,. Trying the hard way." );
+
+    EnumWindows( enumWindowsProc, (LPARAM)&hwnd );
+    return hwnd;
+}
+#endif
 /* following functions are local */
 
 /*****************************************************************************
@@ -512,14 +549,8 @@ static int DirectXCreateWindow( event_thread_t *p_event )
     }
     else
     {
-        /* Find Program Manager */
-        HWND hwnd = FindWindow( _T("Progman"), NULL );
-        if( hwnd ) hwnd = FindWindowEx( hwnd, NULL, _T("SHELLDLL_DefView"), NULL );
-        if( hwnd ) hwnd = FindWindowEx( hwnd, NULL, _T("SysListView32"), NULL );
-        if( !hwnd )
-            msg_Err( vd, "Couldn't find desktop icon window. Desktop mode can't be established." );
         p_event->parent_window = NULL;
-        p_event->hparent = hwnd;
+        p_event->hparent = GetDesktopHandle(vd);
     }
     #endif
     p_event->cursor_arrow = LoadCursor(NULL, IDC_ARROW);



More information about the vlc-commits mailing list