Better initialization of XKB

This commit is contained in:
David Reveman 2006-03-21 16:50:07 +00:00
parent 3bbbd3e727
commit 5c9ccd4e59
4 changed files with 39 additions and 39 deletions

View file

@ -1,3 +1,11 @@
2006-03-21 David Reveman <davidr@novell.com>
* configure.ac: xglx requires xkbfile.
* include/xgl-config.h.in: Include xkb-config.h.
* hw/xgl/glx/xglx.c: Get default XKB options from X server.
2006-03-20 David Reveman <davidr@novell.com>
* hw/xgl/xglinit.c: Add workaround for xgl being unresponsive on

View file

@ -982,7 +982,7 @@ dnl Xglx DDX
AC_MSG_CHECKING([whether to build Xglx DDX])
if test "x$XGLX" != xno; then
PKG_CHECK_MODULES([XGLXMODULES], [glitz-glx >= $XGL_REQUIRED_GLITZ_VERSION xrender >= 0.5 xrandr >= 0.5], [XGLX=yes], [XGLX=no])
PKG_CHECK_MODULES([XGLXMODULES], [glitz-glx >= $XGL_REQUIRED_GLITZ_VERSION xrender >= 0.5 xrandr >= 0.5 xkbfile], [XGLX=yes], [XGLX=no])
AC_SUBST(XGLXMODULES_CFLAGS)
AC_SUBST(XGLXMODULES_LIBS)
fi

View file

@ -52,6 +52,7 @@
#include <X11/extensions/XKB.h>
#include <X11/extensions/XKBsrv.h>
#include <X11/extensions/XKBconfig.h>
#include <X11/extensions/XKBrules.h>
extern Bool
XkbQueryExtension (Display *dpy,
@ -71,14 +72,8 @@ XkbGetControls (Display *dpy,
unsigned long which,
XkbDescPtr desc);
#ifndef XKB_BASE_DIRECTORY
#define XKB_BASE_DIRECTORY "/usr/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 "xorg"
#define XKB_DFLT_RULES_FILE __XKBDEFRULES__
#endif
#ifndef XKB_DFLT_KB_LAYOUT
#define XKB_DFLT_KB_LAYOUT "us"
@ -1046,7 +1041,7 @@ xglxBell (int volume,
pointer ctrl,
int cls)
{
XBell (xdisplay, volume);
XBell (xdisplay, volume);
}
static void
@ -1165,8 +1160,32 @@ xglxKeybdProc (DeviceIntPtr pDevice,
if (xkbExtension)
{
XkbDescPtr desc;
char *rules, *model, *layout, *variants, *options;
XkbRF_VarDefsRec vd;
XkbDescPtr desc;
char *rules, *model, *layout, *variants, *options;
char *tmp = NULL;
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;
if (XkbRF_GetNamesProp (xdisplay, &tmp, &vd) && tmp)
{
rules = tmp;
model = vd.model;
layout = vd.layout;
variants = vd.variant;
options = vd.options;
}
else
{
ErrorF ("Couldn't interpret %s property\n",
_XKB_RF_NAMES_PROP_ATOM);
ErrorF ("Use defaults: rules - '%s' model - '%s' layout - '%s'\n",
rules, model, layout);
}
desc = XkbGetKeyboard (xdisplay,
XkbGBN_AllComponentsMask,
@ -1175,13 +1194,6 @@ xglxKeybdProc (DeviceIntPtr pDevice,
if (desc && desc->geom)
{
XkbComponentNamesRec names;
FILE *file;
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;
XkbGetControls (xdisplay, XkbAllControlsMask, desc);
@ -1195,27 +1207,6 @@ xglxKeybdProc (DeviceIntPtr pDevice,
names.keymap = XkbInitialMap;
}
file = fopen (XKB_BASE_DIRECTORY XKB_CONFIG_FILE, "r");
if (file)
{
XkbConfigRtrnRec config;
if (XkbCFParse (file, XkbCFDflts, desc, &config))
{
if (config.rules_file)
rules = config.rules_file;
if (config.model)
model = config.model;
if (config.layout)
layout = config.layout;
if (config.variant)
variants = config.variant;
if (config.options)
options = config.options;
}
fclose (file);
}
XkbSetRulesDflts (rules, model, layout, variants, options);
ret = XkbInitKeyboardDeviceStruct ((pointer) pDev,

View file

@ -6,6 +6,7 @@
*/
#include <dix-config.h>
#include <xkb-config.h>
/* Use loadable XGL modules. */
#undef XGL_MODULAR