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

This commit is contained in:
Alexandre Julliard 2010-05-06 13:50:30 +02:00
parent 8dc9e8786b
commit e27bc88693
3 changed files with 8 additions and 10 deletions

View File

@ -760,7 +760,7 @@ HDC WINAPI CreateCompatibleDC( HDC hdc )
release_dc_ptr( origDC ); 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; if (!(dc = alloc_dc_ptr( funcs, OBJ_MEMDC ))) goto error;

View File

@ -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 * 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; struct graphics_driver *driver;
char buffer[MAX_PATH], libname[32], *name, *next; char buffer[MAX_PATH], libname[32], *name, *next;
HMODULE module = 0; HMODULE module = 0;
HKEY hkey; HKEY hkey;
if (display_driver) return display_driver; /* already loaded */ if (display_driver) return &display_driver->funcs; /* already loaded */
strcpy( buffer, "x11" ); /* default value */ strcpy( buffer, "x11" ); /* default value */
/* @@ Wine registry key: HKCU\Software\Wine\Drivers */ /* @@ Wine registry key: HKCU\Software\Wine\Drivers */
@ -259,7 +259,7 @@ static struct graphics_driver *load_display_driver(void)
FreeLibrary( driver->module ); FreeLibrary( driver->module );
HeapFree( GetProcessHeap(), 0, driver ); 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}; static const WCHAR display1W[] = {'\\','\\','.','\\','D','I','S','P','L','A','Y','1',0};
/* display driver is a special case */ /* display driver is a special case */
if (!strcmpiW( name, displayW ) || !strcmpiW( name, display1W )) if (!strcmpiW( name, displayW ) || !strcmpiW( name, display1W )) return DRIVER_get_display_driver();
{
driver = load_display_driver();
return &driver->funcs;
}
if ((module = GetModuleHandleW( name ))) if ((module = GetModuleHandleW( name )))
{ {
if (display_driver && display_driver->module == module) return &display_driver->funcs; if (display_driver && display_driver->module == module) return &display_driver->funcs;

View File

@ -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; LONG *height, WORD *planes, WORD *bpp, DWORD *compr, DWORD *size ) DECLSPEC_HIDDEN;
/* driver.c */ /* 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 const DC_FUNCTIONS *DRIVER_load_driver( LPCWSTR name ) DECLSPEC_HIDDEN;
extern BOOL DRIVER_GetDriverName( LPCWSTR device, LPWSTR driver, DWORD size ) DECLSPEC_HIDDEN; extern BOOL DRIVER_GetDriverName( LPCWSTR device, LPWSTR driver, DWORD size ) DECLSPEC_HIDDEN;