Re: [PATCH] xkb: Set sane build time XKB defaults

2009-01-14 Thread Alan Coopersmith


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 dan...@fooishbar.org 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-   alan.coopersm...@sun.com
 Sun Microsystems, Inc. - X Window System Engineering

From aabfda4518579f5782605ed0e47853fbe919848b Mon Sep 17 00:00:00 2001
From: Alan Coopersmith alan.coopersm...@sun.com
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 dan...@fooishbar.org
---
 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|/*$||'`

Re: [PATCH] xkb: Set sane build time XKB defaults

2009-01-12 Thread Dan Nicholson
On Sat, Jan 10, 2009 at 4:43 AM, Daniel Stone dan...@fooishbar.org 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 dan...@fooishbar.org 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 ...

Looks good. Oh, it looks like the binary [[ ]] shell operators slipped
in there at some point. Those are bash only, I think, and should be
fixed. But that's not part of this patch.

--
Dan
___
xorg mailing list
xorg@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/xorg


Re: [PATCH] xkb: Set sane build time XKB defaults

2009-01-12 Thread Dan Nicholson
On Mon, Jan 12, 2009 at 6:57 AM, Julien Cristau jcris...@debian.org wrote:
 On Mon, Jan 12, 2009 at 06:49:42 -0800, Dan Nicholson wrote:

 Looks good. Oh, it looks like the binary [[ ]] shell operators slipped
 in there at some point. Those are bash only, I think, and should be
 fixed. But that's not part of this patch.

 It's the usual [ ], except this is m4 so there's an extra pair of [ ].

Looks like you're right. Still, it's forking to cut get the first
character, when the whole thing could be done in a simple case
statement.

-XKBOUTPUT_FIRSTCHAR=`echo $XKBOUTPUT | cut -b 1`
-
-if [[ x$XKBOUTPUT_FIRSTCHAR != x/ ]] ; then
-   XKBOUTPUT=$XKB_BASE_DIRECTORY/$XKBOUTPUT
-fi
+case $XKBOUTPUT in
+/*) ;;
+*)  XKBOUTPUT=$XKB_BASE_DIRECTORY/$XKBOUTPUT ;;
+esac

--
Dan
___
xorg mailing list
xorg@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/xorg


Re: [PATCH] xkb: Set sane build time XKB defaults

2009-01-12 Thread Alan Coopersmith
Daniel Stone wrote:
 Or maybe even something like this, rather ...

From a test build, looks like you also need to do a
s/__XKBDEFRULES__/XKB_DFLT_RULES/ in hw/xnest/Keyboard.c

-- 
-Alan Coopersmith-   alan.coopersm...@sun.com
 Sun Microsystems, Inc. - X Window System Engineering

___
xorg mailing list
xorg@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/xorg


Re: [PATCH] xkb: Set sane build time XKB defaults

2009-01-11 Thread Daniel Stone
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 dan...@fooishbar.org 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 ...

Cheers,
Daniel
From 9de211e5c81f7d41492bf5b212d0cd291c896d63 Mon Sep 17 00:00:00 2001
From: Daniel Stone dan...@fooishbar.org
Date: Sat, 10 Jan 2009 14:36:16 +0200
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.

Signed-off-by: Daniel Stone dan...@fooishbar.org
---
 configure.ac|   82 +-
 include/xkb-config.h.in |   14 +++-
 xkb/xkbInit.c   |   41 ++--
 3 files changed, 82 insertions(+), 55 deletions(-)

diff --git a/configure.ac b/configure.ac
index c7ae5e0..147b70d 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_RULES=$withval ],
+[ XKB_RULES= ])
+AC_ARG_WITH(default-xkb-model, AS_HELP_STRING([--with-default-xkb-model=MODEL],
+   [Keyboard model (default: pc104)]),
+[ XKB_MODEL=$withval ],
+[ XKB_MODEL=pc104 ])
+AC_ARG_WITH(default-xkb-layout, AS_HELP_STRING([--with-default-xkb-layout=LAYOUT],
+   [Keyboard layout (default: us)]),
+[ XKB_LAYOUT=$withval ],
+[ XKB_LAYOUT=us ])
+AC_ARG_WITH(default-xkb-variant, AS_HELP_STRING([--with-default-xkb-variant=VARIANT],
+   [Keyboard variant (default: (none))]),
+[ XKB_VARIANT=$withval ],
+[ XKB_VARIANT= ])
+AC_ARG_WITH(default-xkb-options, AS_HELP_STRING([--with-default-xkb-options=OPTIONS],
+   [Keyboard layout options (default: (none))]),
+[ XKB_OPTIONS=$withval ],
+[ XKB_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 ],
@@ -1005,9 +1025,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 

Re: [PATCH] xkb: Set sane build time XKB defaults

2009-01-11 Thread Daniel Stone
On Wed, Jan 07, 2009 at 08:27:39AM -0800, Dan Nicholson wrote:
 On Wed, Jan 7, 2009 at 7:44 AM, Daniel Stone dan...@fooishbar.org 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?

Cheers,
Daniel
From 6bc4345a552fa8a3cd7ca385572fff5572e3c081 Mon Sep 17 00:00:00 2001
From: Daniel Stone dan...@fooishbar.org
Date: Sat, 10 Jan 2009 14:36:16 +0200
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.

Signed-off-by: Daniel Stone dan...@fooishbar.org
---
 configure.ac|   82 +-
 include/xkb-config.h.in |   14 +++-
 3 files changed, 72 insertions(+), 105 deletions(-)
 delete mode 100644 xkb/xkbPrOtherEv.c

diff --git a/configure.ac b/configure.ac
index c7ae5e0..147b70d 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_RULES=$withval ],
+[ XKB_RULES= ])
+AC_ARG_WITH(default-xkb-model, AS_HELP_STRING([--with-default-xkb-model=MODEL],
+   [Keyboard model (default: pc104)]),
+[ XKB_MODEL=$withval ],
+[ XKB_MODEL=pc104 ])
+AC_ARG_WITH(default-xkb-layout, AS_HELP_STRING([--with-default-xkb-layout=LAYOUT],
+   [Keyboard layout (default: us)]),
+[ XKB_LAYOUT=$withval ],
+[ XKB_LAYOUT=us ])
+AC_ARG_WITH(default-xkb-variant, AS_HELP_STRING([--with-default-xkb-variant=VARIANT],
+   [Keyboard variant (default: (none))]),
+[ XKB_VARIANT=$withval ],
+[ XKB_VARIANT= ])
+AC_ARG_WITH(default-xkb-options, AS_HELP_STRING([--with-default-xkb-options=OPTIONS],
+   [Keyboard layout options (default: (none))]),
+[ XKB_OPTIONS=$withval ],
+[ XKB_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 ],
@@ -1005,9 +1025,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'
 

Re: [PATCH] xkb: Set sane build time XKB defaults

2009-01-11 Thread Alan Coopersmith
Daniel Stone wrote:
 Or maybe even something like this, rather ...

+AC_ARG_WITH(default-xkb-model, AS_HELP_STRING([--with-default-xkb-model=MODEL],
+   [Keyboard model (default: pc104)]),
+[ XKB_MODEL=$withval ],
+[ XKB_MODEL=pc104 ])

Shouldn't the default model be pc105?   (Won't hurt the US kbd users,
but the rest of the world would probably appreciate their extra key
working by default.)

-- 
-Alan Coopersmith-   alan.coopersm...@sun.com
 Sun Microsystems, Inc. - X Window System Engineering

___
xorg mailing list
xorg@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/xorg


Re: [PATCH] xkb: Set sane build time XKB defaults

2009-01-07 Thread Daniel Stone
On Wed, Jan 07, 2009 at 06:14:44AM -0800, Dan Nicholson wrote:
 Previously, DIX set the default XKB rules to base, pc105, us during
 initialization. That has now been moved to the DDX in 9c5dd733, but only
 covers Xorg. This makes the builtin XKB match the previous DIX defaults.
 Also changes the fallback XKB path match the typical location, although
 XKB_BASE_DIRECTORY is always set during configure.

NAK of sorts: I'd like to fix this properly.  In particular, hardcoded
paths are not the way.

Cheers,
Daniel


signature.asc
Description: Digital signature
___
xorg mailing list
xorg@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/xorg

Re: [PATCH] xkb: Set sane build time XKB defaults

2009-01-07 Thread Dan Nicholson
On Wed, Jan 7, 2009 at 7:44 AM, Daniel Stone dan...@fooishbar.org wrote:
 On Wed, Jan 07, 2009 at 06:14:44AM -0800, Dan Nicholson wrote:
 Previously, DIX set the default XKB rules to base, pc105, us during
 initialization. That has now been moved to the DDX in 9c5dd733, but only
 covers Xorg. This makes the builtin XKB match the previous DIX defaults.
 Also changes the fallback XKB path match the typical location, although
 XKB_BASE_DIRECTORY is always set during configure.

 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?

--
Dan
___
xorg mailing list
xorg@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/xorg