Allow specifying multiple graphics drivers and use the first one that

loads successfully.
This commit is contained in:
Alexandre Julliard 2004-07-13 03:53:55 +00:00
parent 642584c560
commit 503ffff9a5
2 changed files with 35 additions and 14 deletions

View File

@ -209,8 +209,8 @@ static struct graphics_driver *create_driver( HMODULE module )
*/
static struct graphics_driver *load_display_driver(void)
{
char buffer[MAX_PATH];
HMODULE module;
char buffer[MAX_PATH], *name, *next;
HMODULE module = 0;
HKEY hkey;
if (display_driver) /* already loaded */
@ -219,7 +219,7 @@ static struct graphics_driver *load_display_driver(void)
return display_driver;
}
strcpy( buffer, "x11drv" ); /* default value */
strcpy( buffer, "x11drv,ttydrv" ); /* default value */
if (!RegOpenKeyA( HKEY_LOCAL_MACHINE, "Software\\Wine\\Wine\\Config\\Wine", &hkey ))
{
DWORD type, count = sizeof(buffer);
@ -227,17 +227,28 @@ static struct graphics_driver *load_display_driver(void)
RegCloseKey( hkey );
}
if (!(module = LoadLibraryA( buffer )))
name = buffer;
while (name)
{
MESSAGE( "Could not load graphics driver '%s'\n", buffer );
return NULL;
next = strchr( name, ',' );
if (next) *next++ = 0;
if ((module = LoadLibraryA( name )) != 0) break;
name = next;
}
if (!module)
{
MESSAGE( "wine: Could not load graphics driver '%s'.\n", buffer );
if (!strcasecmp( buffer, "x11drv" ))
MESSAGE( "Make sure that your X server is running and that $DISPLAY is set correctly.\n" );
ExitProcess(1);
}
if (!(display_driver = create_driver( module )))
{
MESSAGE( "Could not create graphics driver '%s'\n", buffer );
FreeLibrary( module );
return NULL;
ExitProcess(1);
}
display_driver->count++; /* we don't want to free it */

View File

@ -55,22 +55,32 @@ extern void WDML_NotifyThreadDetach(void);
/* load the graphics driver */
static BOOL load_driver(void)
{
char buffer[MAX_PATH];
char buffer[MAX_PATH], *name, *next;
HKEY hkey;
DWORD type, count;
strcpy( buffer, "x11drv" ); /* default value */
strcpy( buffer, "x11drv,ttydrv" ); /* default value */
if (!RegOpenKeyA( HKEY_LOCAL_MACHINE, "Software\\Wine\\Wine\\Config\\Wine", &hkey ))
{
count = sizeof(buffer);
DWORD type, count = sizeof(buffer);
RegQueryValueExA( hkey, "GraphicsDriver", 0, &type, buffer, &count );
RegCloseKey( hkey );
}
if (!(graphics_driver = LoadLibraryA( buffer )))
name = buffer;
while (name)
{
MESSAGE( "Could not load graphics driver '%s'\n", buffer );
return FALSE;
next = strchr( name, ',' );
if (next) *next++ = 0;
if ((graphics_driver = LoadLibraryA( name )) != 0) break;
name = next;
}
if (!graphics_driver)
{
MESSAGE( "wine: Could not load graphics driver '%s'.\n", buffer );
if (!strcasecmp( buffer, "x11drv" ))
MESSAGE( "Make sure that your X server is running and that $DISPLAY is set correctly.\n" );
ExitProcess(1);
}
GET_USER_FUNC(InitKeyboard);