[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#324768: xserver-xorg: Add an XKBPATH environment variable to specify alternate XKB data location



Package: xserver-xorg
Version: 6.8.2.dfsg.1-5
Severity: wishlist
Tags: patch

Hi,

In order to ease migration from xlibs to xkeyboard-config, an option
is to install xkeyboard-config files under another directory, so
that xlibs and xkeyboard-config can be installed simultaneously.
The selection between xlibs and xkeyboard-config data files could
be made when X starts by adding a new XKBPATH environment variable.

Here is a patch implementing this feature; I am unable for now to
test it due to lack of CPU and disk resources, and will be grateful
if someone could test it.

If you XSF guys decide eventually to replace xlibs by xkeyboard-config,
this hack can be removed, but until then it would really help to
install xkeyboard-config on Debian systems.

Denis
Index: xorg-x11/xc/programs/setxkbmap/setxkbmap.c
===================================================================
--- xorg-x11.orig/xc/programs/setxkbmap/setxkbmap.c
+++ xorg-x11/xc/programs/setxkbmap/setxkbmap.c
@@ -318,9 +318,13 @@
 int 	i;
 Bool	ok;
 unsigned	present;
+char	*xkbpath;
 
     ok= True;
     addToList(&szInclPath,&numInclPath,&inclPath,".");
+    xkbpath= (char *)getenv("XKBPATH");
+    if (xkbpath!=NULL)
+	addToList(&szInclPath,&numInclPath,&inclPath,xkbpath);
     addToList(&szInclPath,&numInclPath,&inclPath,DFLT_XKB_CONFIG_ROOT);
     for (i=1;(i<argc)&&ok;i++) {
 	if (argv[i][0]!='-') {
Index: xorg-x11/xc/programs/xkbcomp/xkbpath.c
===================================================================
--- xorg-x11.orig/xc/programs/xkbcomp/xkbpath.c
+++ xorg-x11/xc/programs/xkbcomp/xkbpath.c
@@ -131,9 +131,14 @@
 void
 XkbAddDefaultDirectoriesToPath(void)
 {
+char *xkbpath;
+
     if (noDefaultPath)
 	return;
     XkbAddDirectoryToPath(".");
+    xkbpath= (char *)getenv("XKBPATH");
+    if (xkbpath!=NULL)
+	XkbAddDirectoryToPath(xkbpath);
     XkbAddDirectoryToPath(DFLT_XKB_CONFIG_ROOT);
 }
 
Index: xorg-x11/xc/programs/xkbevd/xkbevd.c
===================================================================
--- xorg-x11.orig/xc/programs/xkbevd/xkbevd.c
+++ xorg-x11/xc/programs/xkbevd/xkbevd.c
@@ -471,20 +471,28 @@
     else {
 	file= fopen(cfgFileName,"r");
 	if (file==NULL) { /* no personal config, try for a system one */
+	    char *xkbpath;
 	    if (cfgFileName!=buf) { /* user specified a file.  bail */
 		uError("Can't open config file \"%s\n",cfgFileName);
 		uAction("Exiting\n");
 		exit(1);
 	    }
-	    sprintf(buf,DFLT_SYS_XKBEVD_CONFIG,DFLT_XKB_CONFIG_ROOT);
-	    file= fopen(cfgFileName,"r");
+	    xkbpath= (char *)getenv("XKBPATH");
+	    if (xkbpath!=NULL) {
+		sprintf(buf,DFLT_SYS_XKBEVD_CONFIG,xkbpath);
+		file= fopen(cfgFileName,"r");
+	    }
 	    if (file==NULL) {
-		if (verbose) {
-		    uError("Couldn't find a config file anywhere\n");
-		    uAction("Exiting\n");
-		    exit(1);
+	        sprintf(buf,DFLT_SYS_XKBEVD_CONFIG,DFLT_XKB_CONFIG_ROOT);
+	        file= fopen(cfgFileName,"r");
+		if (file==NULL) {
+		    if (verbose) {
+			uError("Couldn't find a config file anywhere\n");
+			uAction("Exiting\n");
+			exit(1);
+		    }
+		    exit(0);
 		}
-		exit(0);
 	    }
 	}
     }

Reply to: