Commit 42480e9f authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

D3D: Fix wallpaper mode under Win7

Close #7348
Signed-off-by: default avatarJean-Baptiste Kempf <jb@videolan.org>
parent a73b86a5
...@@ -473,7 +473,44 @@ static void *EventThread( void *p_this ) ...@@ -473,7 +473,44 @@ static void *EventThread( void *p_this )
return NULL; 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 */ /* following functions are local */
/***************************************************************************** /*****************************************************************************
...@@ -512,14 +549,8 @@ static int DirectXCreateWindow( event_thread_t *p_event ) ...@@ -512,14 +549,8 @@ static int DirectXCreateWindow( event_thread_t *p_event )
} }
else 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->parent_window = NULL;
p_event->hparent = hwnd; p_event->hparent = GetDesktopHandle(vd);
} }
#endif #endif
p_event->cursor_arrow = LoadCursor(NULL, IDC_ARROW); p_event->cursor_arrow = LoadCursor(NULL, IDC_ARROW);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment