D3D: Fix wallpaper mode under Win7

Close #7348

Signed-off-by: Jean-Baptiste Kempf <jb@videolan.org>
This commit is contained in:
Jean-Baptiste Kempf 2012-08-17 02:08:58 +02:00
parent a73b86a582
commit 42480e9fe9
1 changed files with 38 additions and 7 deletions

View File

@ -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);