Commit e27bc886 authored by Alexandre Julliard's avatar Alexandre Julliard

gdi32: Add a global function to retrieve the display driver.

parent 8dc9e878
......@@ -760,7 +760,7 @@ HDC WINAPI CreateCompatibleDC( HDC hdc )
release_dc_ptr( origDC );
}
if (!funcs && !(funcs = DRIVER_load_driver( displayW ))) return 0;
if (!funcs && !(funcs = DRIVER_get_display_driver())) return 0;
if (!(dc = alloc_dc_ptr( funcs, OBJ_MEMDC ))) goto error;
......
......@@ -214,18 +214,18 @@ static struct graphics_driver *create_driver( HMODULE module )
/**********************************************************************
* load_display_driver
* DRIVER_get_display_driver
*
* Special case for loading the display driver: get the name from the config file
*/
static struct graphics_driver *load_display_driver(void)
const DC_FUNCTIONS *DRIVER_get_display_driver(void)
{
struct graphics_driver *driver;
char buffer[MAX_PATH], libname[32], *name, *next;
HMODULE module = 0;
HKEY hkey;
if (display_driver) return display_driver; /* already loaded */
if (display_driver) return &display_driver->funcs; /* already loaded */
strcpy( buffer, "x11" ); /* default value */
/* @@ Wine registry key: HKCU\Software\Wine\Drivers */
......@@ -259,7 +259,7 @@ static struct graphics_driver *load_display_driver(void)
FreeLibrary( driver->module );
HeapFree( GetProcessHeap(), 0, driver );
}
return display_driver;
return &display_driver->funcs;
}
......@@ -274,11 +274,8 @@ const DC_FUNCTIONS *DRIVER_load_driver( LPCWSTR name )
static const WCHAR display1W[] = {'\\','\\','.','\\','D','I','S','P','L','A','Y','1',0};
/* display driver is a special case */
if (!strcmpiW( name, displayW ) || !strcmpiW( name, display1W ))
{
driver = load_display_driver();
return &driver->funcs;
}
if (!strcmpiW( name, displayW ) || !strcmpiW( name, display1W )) return DRIVER_get_display_driver();
if ((module = GetModuleHandleW( name )))
{
if (display_driver && display_driver->module == module) return &display_driver->funcs;
......
......@@ -385,6 +385,7 @@ extern int DIB_GetBitmapInfo( const BITMAPINFOHEADER *header, LONG *width,
LONG *height, WORD *planes, WORD *bpp, DWORD *compr, DWORD *size ) DECLSPEC_HIDDEN;
/* driver.c */
extern const DC_FUNCTIONS *DRIVER_get_display_driver(void) DECLSPEC_HIDDEN;
extern const DC_FUNCTIONS *DRIVER_load_driver( LPCWSTR name ) DECLSPEC_HIDDEN;
extern BOOL DRIVER_GetDriverName( LPCWSTR device, LPWSTR driver, DWORD size ) DECLSPEC_HIDDEN;
......
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