Daniel Stone wrote:
> On Sat, Jan 10, 2009 at 02:40:04PM +0200, Daniel Stone wrote:
>> On Wed, Jan 07, 2009 at 08:27:39AM -0800, Dan Nicholson wrote:
>>> On Wed, Jan 7, 2009 at 7:44 AM, Daniel Stone <[email protected]> wrote:
>>>> NAK of sorts: I'd like to fix this properly. In particular, hardcoded
>>>> paths are not the way.
>>> Sure. However, as it stands on both master and 1.6-branch, all the DDX
>>> except Xorg start with these defaults. So, they have an invalid
>>> default model of "dflt" as far as I can tell. Also, the
>>> XKB_BASE_DIRECTORY setting could be dropped from this patch. It's
>>> always defined in configure, so the hardcoded /usr/share/X11/xkb
>>> should never actually get used.
>>>
>>> What did you have in mind to fix this properly?
>> Something like this?
>
> Or maybe even something like this, rather ...
The attached updated version worked better for me - fixes the Xnest issue
I mentioned previously, and makes the --with-default-xkb-* options work
by using the same variable names as used later in configure.ac. It also
updates the default rules definition exported to drivers in xorg-server.h
to the new name - still need to update at least xf86-input-keyboard to use
the new define if it's present, haven't checked any other drivers.
--
-Alan Coopersmith- [email protected]
Sun Microsystems, Inc. - X Window System Engineering
>From aabfda4518579f5782605ed0e47853fbe919848b Mon Sep 17 00:00:00 2001
From: Alan Coopersmith <[email protected]>
Date: Mon, 12 Jan 2009 21:19:15 -0800
Subject: [PATCH] XKB: Allow build-time configuration of XKB defaults
Instead of hardcoding base/pc105/us, allow users to change the defaults at
./configure time. Change the default model to be evdev on Linux.
Modified from original version by: Daniel Stone <[email protected]>
---
configure.ac | 82 +++++++++++++++++++++++++++++++++-------------
hw/xnest/Keyboard.c | 32 +++---------------
include/xkb-config.h.in | 14 +++++++-
include/xorg-server.h.in | 8 ++--
xkb/xkbInit.c | 41 ++++++-----------------
5 files changed, 91 insertions(+), 86 deletions(-)
diff --git a/configure.ac b/configure.ac
index 55b5ec7..b0f9825 100644
--- a/configure.ac
+++ b/configure.ac
@@ -483,6 +483,26 @@ AC_ARG_WITH(xkb-path, AS_HELP_STRING([--with-xkb-path=PATH], [Path to XK
AC_ARG_WITH(xkb-output, AS_HELP_STRING([--with-xkb-output=PATH], [Path to XKB output dir (default: ${datadir}/X11/xkb/compiled)]),
[ XKBOUTPUT="$withval" ],
[ XKBOUTPUT="compiled" ])
+AC_ARG_WITH(default-xkb-rules, AS_HELP_STRING([--with-default-xkb-rules=RULES],
+ [Keyboard ruleset (default: base/evdev)]),
+ [ XKB_DFLT_RULES="$withval" ],
+ [ XKB_DFLT_RULES="" ])
+AC_ARG_WITH(default-xkb-model, AS_HELP_STRING([--with-default-xkb-model=MODEL],
+ [Keyboard model (default: pc104)]),
+ [ XKB_DFLT_MODEL="$withval" ],
+ [ XKB_DFLT_MODEL="pc104" ])
+AC_ARG_WITH(default-xkb-layout, AS_HELP_STRING([--with-default-xkb-layout=LAYOUT],
+ [Keyboard layout (default: us)]),
+ [ XKB_DFLT_LAYOUT="$withval" ],
+ [ XKB_DFLT_LAYOUT="us" ])
+AC_ARG_WITH(default-xkb-variant, AS_HELP_STRING([--with-default-xkb-variant=VARIANT],
+ [Keyboard variant (default: (none))]),
+ [ XKB_DFLT_VARIANT="$withval" ],
+ [ XKB_DFLT_VARIANT="" ])
+AC_ARG_WITH(default-xkb-options, AS_HELP_STRING([--with-default-xkb-options=OPTIONS],
+ [Keyboard layout options (default: (none))]),
+ [ XKB_DFLT_OPTIONS="$withval" ],
+ [ XKB_DFLT_OPTIONS="" ])
AC_ARG_WITH(serverconfig-path, AS_HELP_STRING([--with-serverconfig-path=PATH],
[Directory where ancillary server config files are installed (default: ${libdir}/xorg)]),
[ SERVERCONFIG="$withval" ],
@@ -999,9 +1019,47 @@ AC_DEFINE(SHAPE, 1, [Support SHAPE extension])
AC_DEFINE(XKB, 1, [Build XKB])
AC_DEFINE(XKB_IN_SERVER, 1, [Build XKB server])
AC_DEFINE(XKB_DFLT_DISABLED, 0, [Disable XKB per default])
-REQUIRED_MODULES="$REQUIRED_MODULES xkbfile"
+AC_DEFINE_DIR(XKB_BASE_DIRECTORY, XKBPATH, [Path to XKB data])
+AC_DEFINE_DIR(XKB_BIN_DIRECTORY, bindir, [Path to XKB bin dir])
+
+dnl Make sure XKM_OUTPUT_DIR is an absolute path
+XKBOUTPUT_FIRSTCHAR=`echo $XKBOUTPUT | cut -b 1`
+if [[ x$XKBOUTPUT_FIRSTCHAR != x/ ]] ; then
+ XKBOUTPUT="$XKB_BASE_DIRECTORY/$XKBOUTPUT"
+fi
+
+dnl XKM_OUTPUT_DIR (used in code) must end in / or file names get hosed
+dnl XKB_COMPILED_DIR (used in Makefiles) must not or install-sh gets confused
+
+XKBOUTPUT=`echo $XKBOUTPUT/ | sed 's|/*$|/|'`
+XKB_COMPILED_DIR=`echo $XKBOUTPUT | sed 's|/*$||'`
+AC_DEFINE_DIR(XKM_OUTPUT_DIR, XKBOUTPUT, [Path to XKB output dir])
+AC_SUBST(XKB_COMPILED_DIR)
+
+if test "x$XKB_DFLT_RULES" = x; then
+ case $host_os in
+ linux*)
+ dnl doesn't take AutoAddDevices into account, but whatever.
+ if test "x$CONFIG_HAL" = xyes; then
+ XKB_DFLT_RULES="evdev"
+ else
+ XKB_DFLT_RULES="base"
+ fi
+ ;;
+ *)
+ XKB_DFLT_RULES="base"
+ ;;
+ esac
+fi
+AC_DEFINE_UNQUOTED(XKB_DFLT_RULES, ["$XKB_DFLT_RULES"], [Default XKB ruleset])
+AC_DEFINE_UNQUOTED(XKB_DFLT_MODEL, ["$XKB_DFLT_MODEL"], [Default XKB model])
+AC_DEFINE_UNQUOTED(XKB_DFLT_LAYOUT, ["$XKB_DFLT_LAYOUT"], [Default XKB layout])
+AC_DEFINE_UNQUOTED(XKB_DFLT_VARIANT, ["$XKB_DFLT_VARIANT"], [Default XKB variant])
+AC_DEFINE_UNQUOTED(XKB_DFLT_OPTIONS, ["$XKB_DFLT_OPTIONS"], [Default XKB options])
+
XKB_LIB='$(top_builddir)/xkb/libxkb.la'
XKB_STUB_LIB='$(top_builddir)/xkb/libxkbstubs.la'
+REQUIRED_MODULES="$REQUIRED_MODULES xkbfile"
AC_CHECK_FUNC(strcasecmp, [], AC_DEFINE([NEED_STRCASECMP], 1,
[Do not have 'strcasecmp'.]))
@@ -1792,28 +1850,6 @@ AM_CONDITIONAL(XEPHYR, [test "x$KDRIVE" = xyes && test "x$XEPHYR" = xyes])
AM_CONDITIONAL(BUILD_KDRIVEFBDEVLIB, [test "x$KDRIVE" = xyes && test "x$KDRIVEFBDEVLIB" = xyes])
AM_CONDITIONAL(XFAKESERVER, [test "x$KDRIVE" = xyes && test "x$XFAKE" = xyes])
-dnl these only go in xkb-config.h (which is shared by the Xorg and Xnest servers)
-AC_DEFINE(__XKBDEFRULES__, "xorg", [Default XKB rules])
-AC_DEFINE_DIR(XKB_BASE_DIRECTORY, XKBPATH, [Path to XKB data])
-AC_DEFINE_DIR(XKB_BIN_DIRECTORY, bindir, [Path to XKB bin dir])
-
-# Make sure XKM_OUTPUT_DIR is an absolute path
-XKBOUTPUT_FIRSTCHAR=`echo $XKBOUTPUT | cut -b 1`
-
-if [[ x$XKBOUTPUT_FIRSTCHAR != x/ ]] ; then
- XKBOUTPUT="$XKB_BASE_DIRECTORY/$XKBOUTPUT"
-fi
-
-# XKM_OUTPUT_DIR (used in code) must end in / or file names get hosed
-# XKB_COMPILED_DIR (used in Makefiles) must not or install-sh gets confused
-
-XKBOUTPUT=`echo $XKBOUTPUT/ | sed 's|/*$|/|'`
-XKB_COMPILED_DIR=`echo $XKBOUTPUT | sed 's|/*$||'`
-
-AC_DEFINE_DIR(XKM_OUTPUT_DIR, XKBOUTPUT, [Path to XKB output dir])
-
-AC_SUBST(XKB_COMPILED_DIR)
-
dnl and the rest of these are generic, so they're in config.h
dnl
dnl though, thanks to the passing of some significant amount of time, the
diff --git a/hw/xnest/Keyboard.c b/hw/xnest/Keyboard.c
index 9adf78f..61a06b2 100644
--- a/hw/xnest/Keyboard.c
+++ b/hw/xnest/Keyboard.c
@@ -60,28 +60,6 @@ extern Status XkbGetControls(
XkbDescPtr /* desc */
);
-#ifndef XKB_BASE_DIRECTORY
-#define XKB_BASE_DIRECTORY "/usr/X11R6/lib/X11/xkb/"
-#endif
-#ifndef XKB_CONFIG_FILE
-#define XKB_CONFIG_FILE "X0-config.keyboard"
-#endif
-#ifndef XKB_DFLT_RULES_FILE
-#define XKB_DFLT_RULES_FILE __XKBDEFRULES__
-#endif
-#ifndef XKB_DFLT_KB_LAYOUT
-#define XKB_DFLT_KB_LAYOUT "us"
-#endif
-#ifndef XKB_DFLT_KB_MODEL
-#define XKB_DFLT_KB_MODEL "pc101"
-#endif
-#ifndef XKB_DFLT_KB_VARIANT
-#define XKB_DFLT_KB_VARIANT NULL
-#endif
-#ifndef XKB_DFLT_KB_OPTIONS
-#define XKB_DFLT_KB_OPTIONS NULL
-#endif
-
#endif
DeviceIntPtr xnestKeyboardDevice = NULL;
@@ -222,11 +200,11 @@ XkbError:
XkbGetControls(xnestDisplay, XkbAllControlsMask, xkb);
memset(&names, 0, sizeof(XkbComponentNamesRec));
- rules = XKB_DFLT_RULES_FILE;
- model = XKB_DFLT_KB_MODEL;
- layout = XKB_DFLT_KB_LAYOUT;
- variants = XKB_DFLT_KB_VARIANT;
- options = XKB_DFLT_KB_OPTIONS;
+ rules = XKB_DFLT_RULES;
+ model = XKB_DFLT_MODEL;
+ layout = XKB_DFLT_LAYOUT;
+ variants = XKB_DFLT_VARIANT;
+ options = XKB_DFLT_OPTIONS;
XkbSetRulesDflts(rules, model, layout, variants, options);
XkbInitKeyboardDeviceStruct(pDev, &names, &keySyms, modmap,
diff --git a/include/xkb-config.h.in b/include/xkb-config.h.in
index 29261de..d3cdd19 100644
--- a/include/xkb-config.h.in
+++ b/include/xkb-config.h.in
@@ -6,7 +6,19 @@
#define _XKB_CONFIG_H_
/* Default set of XKB rules. */
-#undef __XKBDEFRULES__
+#undef XKB_DFLT_RULES
+
+/* Default XKB model. */
+#undef XKB_DFLT_MODEL
+
+/* Default XKB layout. */
+#undef XKB_DFLT_LAYOUT
+
+/* Default XKB variant. */
+#undef XKB_DFLT_VARIANT
+
+/* Default XKB options. */
+#undef XKB_DFLT_OPTIONS
/* Path to XKB definitions. */
#undef XKB_BASE_DIRECTORY
diff --git a/include/xorg-server.h.in b/include/xorg-server.h.in
index 4cf1bbf..57b8a82 100644
--- a/include/xorg-server.h.in
+++ b/include/xorg-server.h.in
@@ -106,7 +106,10 @@
/* Enable XKB per default */
#undef XKB_DFLT_DISABLED
-/* Build XKB server */
+/* XKB default rules */
+#undef XKB_DFLT_RULES
+
+/* Build XKB support in server */
#undef XKB_IN_SERVER
/* Support loadable input and output drivers */
@@ -160,9 +163,6 @@
/* Location of configuration file */
#undef __XCONFIGFILE__
-/* XKB default rules */
-#undef __XKBDEFRULES__
-
/* Name of X server */
#undef __XSERVERNAME__
diff --git a/xkb/xkbInit.c b/xkb/xkbInit.c
index f10125b..573e731 100644
--- a/xkb/xkbInit.c
+++ b/xkb/xkbInit.c
@@ -85,27 +85,6 @@ typedef struct _SrvXkmInfo {
/***====================================================================***/
-#ifndef XKB_BASE_DIRECTORY
-#define XKB_BASE_DIRECTORY "/usr/lib/X11/xkb"
-#endif
-#ifndef XKB_BIN_DIRECTORY
-#define XKB_BIN_DIRECTORY XKB_BASE_DIRECTORY
-#endif
-#ifndef XKB_DFLT_RULES_FILE
-#define XKB_DFLT_RULES_FILE "base"
-#endif
-#ifndef XKB_DFLT_KB_LAYOUT
-#define XKB_DFLT_KB_LAYOUT "us"
-#endif
-#ifndef XKB_DFLT_KB_MODEL
-#define XKB_DFLT_KB_MODEL "dflt"
-#endif
-#ifndef XKB_DFLT_KB_VARIANT
-#define XKB_DFLT_KB_VARIANT NULL
-#endif
-#ifndef XKB_DFLT_KB_OPTIONS
-#define XKB_DFLT_KB_OPTIONS NULL
-#endif
#ifndef XKB_DFLT_DISABLED
#define XKB_DFLT_DISABLED True
#endif
@@ -140,14 +119,14 @@ static char *
XkbGetRulesDflts(XkbRF_VarDefsPtr defs)
{
if (XkbModelDflt) defs->model= XkbModelDflt;
- else defs->model= XKB_DFLT_KB_MODEL;
+ else defs->model= XKB_DFLT_MODEL;
if (XkbLayoutDflt) defs->layout= XkbLayoutDflt;
- else defs->layout= XKB_DFLT_KB_LAYOUT;
+ else defs->layout= XKB_DFLT_LAYOUT;
if (XkbVariantDflt) defs->variant= XkbVariantDflt;
- else defs->variant= XKB_DFLT_KB_VARIANT;
+ else defs->variant= XKB_DFLT_VARIANT;
if (XkbOptionsDflt) defs->options= XkbOptionsDflt;
- else defs->options= XKB_DFLT_KB_OPTIONS;
- return (rulesDefined?XkbRulesFile:XKB_DFLT_RULES_FILE);
+ else defs->options= XKB_DFLT_OPTIONS;
+ return (rulesDefined?XkbRulesFile:XKB_DFLT_RULES);
}
static Bool
@@ -159,7 +138,7 @@ char * pval;
if (rulesDefined && (!XkbRulesFile))
return False;
- len= (XkbRulesFile?strlen(XkbRulesFile):strlen(XKB_DFLT_RULES_FILE));
+ len= (XkbRulesFile?strlen(XkbRulesFile):strlen(XKB_DFLT_RULES));
len+= (XkbModelUsed?strlen(XkbModelUsed):0);
len+= (XkbLayoutUsed?strlen(XkbLayoutUsed):0);
len+= (XkbVariantUsed?strlen(XkbVariantUsed):0);
@@ -185,8 +164,8 @@ char * pval;
strcpy(&pval[out],XkbRulesFile);
out+= strlen(XkbRulesFile);
} else {
- strcpy(&pval[out],XKB_DFLT_RULES_FILE);
- out+= strlen(XKB_DFLT_RULES_FILE);
+ strcpy(&pval[out],XKB_DFLT_RULES);
+ out+= strlen(XKB_DFLT_RULES);
}
pval[out++]= '\0';
if (XkbModelUsed) {
@@ -255,8 +234,8 @@ XkbSetRulesDflts(char *rulesFile,char *model,char *layout,
{
LogMessage(X_WARNING, "[xkb] No rule given, and no previous rule "
"defined. Defaulting to '%s'.\n",
- XKB_DFLT_RULES_FILE);
- rulesFile = XKB_DFLT_RULES_FILE;
+ XKB_DFLT_RULES);
+ rulesFile = XKB_DFLT_RULES;
}
if (rulesFile) {
--
1.5.6.5
_______________________________________________
xorg mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/xorg