Commit 74efeab2 authored by Alexandre Julliard's avatar Alexandre Julliard

gdi32: Trigger creation of the desktop window when the display driver is needed.

parent 9675aa17
......@@ -28,7 +28,6 @@
#include <stdio.h>
#include "windef.h"
#include "winbase.h"
#include "winreg.h"
#include "ddrawgdi.h"
#include "wine/winbase16.h"
......@@ -48,7 +47,6 @@ struct graphics_driver
static struct list drivers = LIST_INIT( drivers );
static struct graphics_driver *display_driver;
static DWORD display_driver_load_error;
const struct gdi_dc_funcs *font_driver = NULL;
......@@ -101,48 +99,18 @@ static struct graphics_driver *create_driver( HMODULE module )
*/
static const struct gdi_dc_funcs *get_display_driver( HMODULE *module_ret )
{
struct graphics_driver *driver;
char buffer[MAX_PATH], libname[32], *name, *next;
HMODULE module = 0;
HKEY hkey;
if (display_driver) goto done;
strcpy( buffer, default_driver );
/* @@ Wine registry key: HKCU\Software\Wine\Drivers */
if (!RegOpenKeyA( HKEY_CURRENT_USER, "Software\\Wine\\Drivers", &hkey ))
{
DWORD type, count = sizeof(buffer);
RegQueryValueExA( hkey, "Graphics", 0, &type, (LPBYTE) buffer, &count );
RegCloseKey( hkey );
}
name = buffer;
while (name)
if (!display_driver)
{
next = strchr( name, ',' );
if (next) *next++ = 0;
HMODULE user32 = LoadLibraryA( "user32.dll" );
HWND (WINAPI *pGetDesktopWindow)(void) = (void *)GetProcAddress( user32, "GetDesktopWindow" );
snprintf( libname, sizeof(libname), "wine%s.drv", name );
if ((module = LoadLibraryA( libname )) != 0) break;
name = next;
if (!pGetDesktopWindow() || !display_driver)
{
WARN( "failed to load the display driver, falling back to null driver\n" );
__wine_set_display_driver( 0 );
}
}
if (!module) display_driver_load_error = GetLastError();
if (!(driver = create_driver( module )))
{
MESSAGE( "Could not create graphics driver '%s'\n", buffer );
FreeLibrary( module );
ExitProcess(1);
}
if (InterlockedCompareExchangePointer( (void **)&display_driver, driver, NULL ))
{
/* somebody beat us to it */
FreeLibrary( driver->module );
HeapFree( GetProcessHeap(), 0, driver );
}
done:
*module_ret = display_driver->module;
return display_driver->funcs;
}
......@@ -205,25 +173,6 @@ done:
/***********************************************************************
* __wine_get_driver_module (GDI32.@)
*/
HMODULE CDECL __wine_get_driver_module( HDC hdc )
{
DC *dc;
HMODULE ret = 0;
if ((dc = get_dc_ptr( hdc )))
{
ret = dc->module;
release_dc_ptr( dc );
if (!ret) SetLastError( display_driver_load_error );
}
else SetLastError( ERROR_INVALID_HANDLE );
return ret;
}
/***********************************************************************
* __wine_set_display_driver_module (GDI32.@)
*/
void CDECL __wine_set_display_driver( HMODULE module )
......
......@@ -514,7 +514,6 @@
@ cdecl __wine_set_visible_region(long long ptr ptr ptr)
# Graphics drivers
@ cdecl __wine_get_driver_module(long)
@ cdecl __wine_set_display_driver(long)
# OpenGL
......
......@@ -276,7 +276,6 @@ WINGDIAPI WORD WINAPI SetHookFlags(HDC,WORD);
extern void CDECL __wine_make_gdi_object_system( HGDIOBJ handle, BOOL set );
extern void CDECL __wine_set_visible_region( HDC hdc, HRGN hrgn, const RECT *vis_rect,
const RECT *device_rect, struct window_surface *surface );
extern HMODULE CDECL __wine_get_driver_module( HDC hdc );
extern void CDECL __wine_set_display_driver( HMODULE module );
extern struct opengl_funcs * CDECL __wine_get_wgl_driver( HDC hdc, UINT version );
......
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