Fall back to ttydrv

Uwe Bonnes bon at elektron.ikp.physik.tu-darmstadt.de
Mon Apr 14 17:11:51 CDT 2003


Changelog:
	dlls/gdi/driver.c: load_display_driver
	dlls/user/user_main.c: load_driver
	Fall back to ttydrv when DISPLAy varaible is not set, and the user
	allowed this with the config entry [wine] "TTYdrvFallback"= "Y"


-- 
Uwe Bonnes                bon at elektron.ikp.physik.tu-darmstadt.de

Institut fuer Kernphysik  Schlossgartenstrasse 9  64289 Darmstadt
--------- Tel. 06151 162516 -------- Fax. 06151 164321 ----------

Index: wine/documentation/samples/config
===================================================================
RCS file: /home/wine/wine/documentation/samples/config,v
retrieving revision 1.43
diff -u -r1.43 config
--- wine/documentation/samples/config	7 Apr 2003 23:27:54 -0000	1.43
+++ wine/documentation/samples/config	14 Apr 2003 22:07:23 -0000
@@ -63,6 +63,8 @@
 "Path" = "c:\\windows;c:\\windows\\system;e:\\;e:\\test;f:\\"
 "Profile" = "c:\\windows\\Profiles\\Administrator"
 "GraphicsDriver" = "x11drv"
+;When X is not available, but x11drv set, allow fallback to ttydrv
+;"TTYdrvFallback" = "y"
 ;"ShowDirSymlinks" = "1"
 ;"ShowDotFiles" = "1"
 "ShellLinker" = "wineshelllink"
Index: wine/dlls/gdi/driver.c
===================================================================
RCS file: /home/wine/wine/dlls/gdi/driver.c,v
retrieving revision 1.21
diff -u -r1.21 driver.c
--- wine/dlls/gdi/driver.c	1 Apr 2003 00:12:50 -0000	1.21
+++ wine/dlls/gdi/driver.c	14 Apr 2003 22:07:23 -0000
@@ -190,7 +190,7 @@
  */
 static struct graphics_driver *load_display_driver(void)
 {
-    char buffer[MAX_PATH];
+    char buffer[MAX_PATH], buffer1[MAX_PATH], buffer2[MAX_PATH];
     HMODULE module;
     HKEY hkey;
 
@@ -205,8 +205,18 @@
     {
         DWORD type, count = sizeof(buffer);
         RegQueryValueExA( hkey, "GraphicsDriver", 0, &type, buffer, &count );
+        count = sizeof(buffer2);
+        RegQueryValueExA( hkey, "TTYdrvFallback", 0, &type, buffer2, &count );
         RegCloseKey( hkey );
     }
+
+    if (!strcasecmp("x11drv",buffer) && 
+	(GetEnvironmentVariableA("DISPLAY",buffer1,MAX_PATH-1) == 0) && 
+	!strcasecmp("y",buffer2))
+      {
+	MESSAGE( "Falling back to ttydrv\n");
+	strcpy( buffer, "ttydrv" );  /* default value */
+      }
 
     if (!(module = LoadLibraryA( buffer )))
     {
Index: wine/dlls/user/user_main.c
===================================================================
RCS file: /home/wine/wine/dlls/user/user_main.c,v
retrieving revision 1.50
diff -u -r1.50 user_main.c
--- wine/dlls/user/user_main.c	3 Dec 2002 23:34:54 -0000	1.50
+++ wine/dlls/user/user_main.c	14 Apr 2003 22:07:23 -0000
@@ -58,7 +58,7 @@
 /* load the graphics driver */
 static BOOL load_driver(void)
 {
-    char buffer[MAX_PATH];
+    char buffer[MAX_PATH], buffer1[MAX_PATH], buffer2[MAX_PATH];
     HKEY hkey;
     DWORD type, count;
 
@@ -67,8 +67,19 @@
     {
         count = sizeof(buffer);
         RegQueryValueExA( hkey, "GraphicsDriver", 0, &type, buffer, &count );
+        count = sizeof(buffer2);
+        RegQueryValueExA( hkey, "TTYdrvFallback", 0, &type, buffer2, &count );
         RegCloseKey( hkey );
     }
+
+    if (!strcasecmp("x11drv",buffer) && 
+	(GetEnvironmentVariableA("DISPLAY",buffer1,MAX_PATH-1) == 0) && 
+	!strcasecmp("y",buffer2))
+      {
+	
+	MESSAGE( "Falling back to ttydrv\n");
+	strcpy( buffer, "ttydrv" );  /* default value */
+      }
 
     if (!(graphics_driver = LoadLibraryA( buffer )))
     {



More information about the wine-patches mailing list