Git-Url: 
http://git.frugalware.org/gitweb/gitweb.cgi?p=frugalwareutils.git;a=commitdiff;h=c31a92ab0adeeaad27ab77f7dcc7c9801a569bae

commit c31a92ab0adeeaad27ab77f7dcc7c9801a569bae
Author: Miklos Vajna <vmik...@frugalware.org>
Date:   Thu Jan 7 04:11:35 2010 +0100

libfwxconfig: workaround for multihead breakage

the problem is the following: when we have two vga outputs and the
second has limited capabilities (no hw accel, for example), then the
first should use a real driver, the second can be just "vga".

now X -configure sadly sets the wrong order by default in the generated
xorg.conf: the first is vga and the second is the real driver, so we
have to restore the right order in fwx_doconfig().

diff --git a/libfwxconfig/libfwxconfig.c b/libfwxconfig/libfwxconfig.c
index 15ff017..04017ae 100644
--- a/libfwxconfig/libfwxconfig.c
+++ b/libfwxconfig/libfwxconfig.c
@@ -118,13 +118,34 @@ static int reg_match(char *str, char *pattern)
*/
int fwx_doconfig(char *mousedev, char *res, char *depth)
{
-       char line[PATH_MAX+1];
+       char line[PATH_MAX+1], *drv = NULL;
FILE *ofp, *nfp;
struct stat buf;
int start_looking=0;
+       int vga_seen = 0, drv_wrote = 0;

unlink(XORGCONFIG);

+       /*
+        * If we see a vga driver and an other video driver later, then we
+        * should fix the order.
+        */
+       ofp = fopen(NEWCONFIG, "r");
+       while (fgets(line, PATH_MAX, ofp)) {
+               if (!strcmp(line, "\tDriver      \"vga\"\n")) {
+                       vga_seen = 1;
+                       continue;
+               }
+               if (vga_seen && !strncmp(line, "\tDriver      \"", 14)) {
+                       char *ptr;
+                       drv = strdup(line+14);
+                       ptr = drv + strlen(drv)-2;
+                       *ptr = '\0';
+                       printf("'%s'\n", drv);
+               }
+       }
+       fclose(ofp);
+
ofp = fopen(NEWCONFIG, "r");
if(!ofp)
return(1);
@@ -161,6 +182,17 @@ int fwx_doconfig(char *mousedev, char *res, char *depth)
if(reg_match(line, "Screen +1"))
// To disable multihead setups by default
continue;
+               if(drv && reg_match(line, "driver.*vga"))
+               {
+                       fprintf(nfp, "\tDriver      \"%s\"\n", drv);
+                       drv_wrote = 1;
+                       continue;
+               }
+               if(drv_wrote && reg_match(line, "driver.*\""))
+               {
+                       fprintf(nfp, "\tDriver      \"vga\"\n");
+                       continue;
+               }
fprintf(nfp, "%s", line);
if(reg_match(line, "usebios"))
{
_______________________________________________
Frugalware-git mailing list
Frugalware-git@frugalware.org
http://frugalware.org/mailman/listinfo/frugalware-git

Reply via email to