summaryrefslogtreecommitdiff
path: root/xkb
diff options
context:
space:
mode:
authorPeter Hutterer <peter@cs.unisa.edu.au>2008-03-04 18:11:10 +1030
committerPeter Hutterer <peter@cs.unisa.edu.au>2008-03-04 18:11:10 +1030
commit4f2cd0ed96d3b10c78774c721c2ffbfb0556dddd (patch)
tree9f477ddd4af2162152057bded1426102b475e67c /xkb
parent23ae68a4c74a2ec90b4130c37b0d0aec3f4082ce (diff)
parent453661a9e193a511cf5e54e6d330454163817316 (diff)
Merge branch 'master' into mpx
This merge reverts Magnus' device coorindate scaling changes. MPX core event generation is very different, so we can't scale in GetPointerEvents. Conflicts: Xi/opendev.c dix/devices.c dix/dixfonts.c dix/getevents.c dix/resource.c dix/window.c hw/xfree86/common/xf86Xinput.c mi/mipointer.c xkb/ddxBeep.c xkb/ddxCtrls.c xkb/ddxKeyClick.c xkb/ddxList.c xkb/ddxLoad.c xkb/xkb.c xkb/xkbAccessX.c xkb/xkbEvents.c xkb/xkbInit.c xkb/xkbPrKeyEv.c xkb/xkbUtils.c
Diffstat (limited to 'xkb')
-rw-r--r--xkb/Makefile.am1
-rw-r--r--xkb/XKBAlloc.c2
-rw-r--r--xkb/XKBGAlloc.c42
-rw-r--r--xkb/XKBMAlloc.c4
-rw-r--r--xkb/XKBMisc.c5
-rw-r--r--xkb/ddxBeep.c4
-rw-r--r--xkb/ddxCtrls.c23
-rw-r--r--xkb/ddxKeyClick.c4
-rw-r--r--xkb/ddxList.c13
-rw-r--r--xkb/ddxLoad.c171
-rw-r--r--xkb/maprules.c92
-rw-r--r--xkb/xkb.c140
-rw-r--r--xkb/xkb.h5
-rw-r--r--xkb/xkbAccessX.c8
-rw-r--r--xkb/xkbActions.c4
-rw-r--r--xkb/xkbEvents.c34
-rw-r--r--xkb/xkbInit.c237
-rw-r--r--xkb/xkbPrKeyEv.c4
-rw-r--r--xkb/xkbPrOtherEv.c2
-rw-r--r--xkb/xkbSwap.c2
-rw-r--r--xkb/xkbUtils.c29
-rw-r--r--xkb/xkberrs.c37
-rw-r--r--xkb/xkbfmisc.c113
-rw-r--r--xkb/xkbgeom.h635
-rw-r--r--xkb/xkbout.c146
-rw-r--r--xkb/xkbtext.c60
-rw-r--r--xkb/xkmread.c235
27 files changed, 1066 insertions, 986 deletions
diff --git a/xkb/Makefile.am b/xkb/Makefile.am
index 78cdf7196..e750d6098 100644
--- a/xkb/Makefile.am
+++ b/xkb/Makefile.am
@@ -32,7 +32,6 @@ XKBFILE_SRCS = \
xkmread.c \
xkbtext.c \
xkbfmisc.c \
- xkberrs.c \
xkbout.c
X11_SRCS = \
diff --git a/xkb/XKBAlloc.c b/xkb/XKBAlloc.c
index f0a1f890e..790aede92 100644
--- a/xkb/XKBAlloc.c
+++ b/xkb/XKBAlloc.c
@@ -36,7 +36,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include "misc.h"
#include "inputstr.h"
#include <xkbsrv.h>
-#include <X11/extensions/XKBgeom.h>
+#include "xkbgeom.h"
/***===================================================================***/
diff --git a/xkb/XKBGAlloc.c b/xkb/XKBGAlloc.c
index 815cc95f5..c37f49a55 100644
--- a/xkb/XKBGAlloc.c
+++ b/xkb/XKBGAlloc.c
@@ -37,13 +37,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include "misc.h"
#include "inputstr.h"
#include <xkbsrv.h>
-#include <X11/extensions/XKBgeom.h>
-
-#ifdef X_NOT_POSIX
-#define Size_t unsigned int
-#else
-#define Size_t size_t
-#endif
+#include "xkbgeom.h"
/***====================================================================***/
@@ -461,11 +455,11 @@ XkbFreeGeometry(XkbGeometryPtr geom,unsigned which,Bool freeMap)
/***====================================================================***/
static Status
-_XkbGeomAlloc( XPointer * old,
+_XkbGeomAlloc( void ** old,
unsigned short * num,
unsigned short * total,
int num_new,
- Size_t sz_elem)
+ size_t sz_elem)
{
if (num_new<1)
return Success;
@@ -477,8 +471,8 @@ _XkbGeomAlloc( XPointer * old,
*total= (*num)+num_new;
if ((*old)!=NULL)
- (*old)= (XPointer)_XkbRealloc((*old),(*total)*sz_elem);
- else (*old)= (XPointer)_XkbCalloc((*total),sz_elem);
+ (*old)= _XkbRealloc((*old),(*total)*sz_elem);
+ else (*old)= _XkbCalloc((*total),sz_elem);
if ((*old)==NULL) {
*total= *num= 0;
return BadAlloc;
@@ -491,44 +485,44 @@ _XkbGeomAlloc( XPointer * old,
return Success;
}
-#define _XkbAllocProps(g,n) _XkbGeomAlloc((XPointer *)&(g)->properties,\
+#define _XkbAllocProps(g,n) _XkbGeomAlloc((void *)&(g)->properties,\
&(g)->num_properties,&(g)->sz_properties,\
(n),sizeof(XkbPropertyRec))
-#define _XkbAllocColors(g,n) _XkbGeomAlloc((XPointer *)&(g)->colors,\
+#define _XkbAllocColors(g,n) _XkbGeomAlloc((void *)&(g)->colors,\
&(g)->num_colors,&(g)->sz_colors,\
(n),sizeof(XkbColorRec))
-#define _XkbAllocShapes(g,n) _XkbGeomAlloc((XPointer *)&(g)->shapes,\
+#define _XkbAllocShapes(g,n) _XkbGeomAlloc((void *)&(g)->shapes,\
&(g)->num_shapes,&(g)->sz_shapes,\
(n),sizeof(XkbShapeRec))
-#define _XkbAllocSections(g,n) _XkbGeomAlloc((XPointer *)&(g)->sections,\
+#define _XkbAllocSections(g,n) _XkbGeomAlloc((void *)&(g)->sections,\
&(g)->num_sections,&(g)->sz_sections,\
(n),sizeof(XkbSectionRec))
-#define _XkbAllocDoodads(g,n) _XkbGeomAlloc((XPointer *)&(g)->doodads,\
+#define _XkbAllocDoodads(g,n) _XkbGeomAlloc((void *)&(g)->doodads,\
&(g)->num_doodads,&(g)->sz_doodads,\
(n),sizeof(XkbDoodadRec))
-#define _XkbAllocKeyAliases(g,n) _XkbGeomAlloc((XPointer *)&(g)->key_aliases,\
+#define _XkbAllocKeyAliases(g,n) _XkbGeomAlloc((void *)&(g)->key_aliases,\
&(g)->num_key_aliases,&(g)->sz_key_aliases,\
(n),sizeof(XkbKeyAliasRec))
-#define _XkbAllocOutlines(s,n) _XkbGeomAlloc((XPointer *)&(s)->outlines,\
+#define _XkbAllocOutlines(s,n) _XkbGeomAlloc((void *)&(s)->outlines,\
&(s)->num_outlines,&(s)->sz_outlines,\
(n),sizeof(XkbOutlineRec))
-#define _XkbAllocRows(s,n) _XkbGeomAlloc((XPointer *)&(s)->rows,\
+#define _XkbAllocRows(s,n) _XkbGeomAlloc((void *)&(s)->rows,\
&(s)->num_rows,&(s)->sz_rows,\
(n),sizeof(XkbRowRec))
-#define _XkbAllocPoints(o,n) _XkbGeomAlloc((XPointer *)&(o)->points,\
+#define _XkbAllocPoints(o,n) _XkbGeomAlloc((void *)&(o)->points,\
&(o)->num_points,&(o)->sz_points,\
(n),sizeof(XkbPointRec))
-#define _XkbAllocKeys(r,n) _XkbGeomAlloc((XPointer *)&(r)->keys,\
+#define _XkbAllocKeys(r,n) _XkbGeomAlloc((void *)&(r)->keys,\
&(r)->num_keys,&(r)->sz_keys,\
(n),sizeof(XkbKeyRec))
-#define _XkbAllocOverlays(s,n) _XkbGeomAlloc((XPointer *)&(s)->overlays,\
+#define _XkbAllocOverlays(s,n) _XkbGeomAlloc((void *)&(s)->overlays,\
&(s)->num_overlays,&(s)->sz_overlays,\
(n),sizeof(XkbOverlayRec))
-#define _XkbAllocOverlayRows(o,n) _XkbGeomAlloc((XPointer *)&(o)->rows,\
+#define _XkbAllocOverlayRows(o,n) _XkbGeomAlloc((void *)&(o)->rows,\
&(o)->num_rows,&(o)->sz_rows,\
(n),sizeof(XkbOverlayRowRec))
-#define _XkbAllocOverlayKeys(r,n) _XkbGeomAlloc((XPointer *)&(r)->keys,\
+#define _XkbAllocOverlayKeys(r,n) _XkbGeomAlloc((void *)&(r)->keys,\
&(r)->num_keys,&(r)->sz_keys,\
(n),sizeof(XkbOverlayKeyRec))
diff --git a/xkb/XKBMAlloc.c b/xkb/XKBMAlloc.c
index 9feaf8e93..178b5b89a 100644
--- a/xkb/XKBMAlloc.c
+++ b/xkb/XKBMAlloc.c
@@ -55,10 +55,8 @@ XkbClientMapPtr map;
((!XkbIsLegalKeycode(xkb->min_key_code))||
(!XkbIsLegalKeycode(xkb->max_key_code))||
(xkb->max_key_code<xkb->min_key_code))) {
-#ifdef DEBUG
-fprintf(stderr,"bad keycode (%d,%d) in XkbAllocClientMap\n",
+ DebugF("bad keycode (%d,%d) in XkbAllocClientMap\n",
xkb->min_key_code,xkb->max_key_code);
-#endif
return BadValue;
}
diff --git a/xkb/XKBMisc.c b/xkb/XKBMisc.c
index 0404108a2..85415a4c9 100644
--- a/xkb/XKBMisc.c
+++ b/xkb/XKBMisc.c
@@ -416,10 +416,7 @@ unsigned changed,tmp;
if (((explicit&XkbExplicitAutoRepeatMask)==0)&&(xkb->ctrls)) {
CARD8 old;
old= xkb->ctrls->per_key_repeat[key/8];
-#ifdef RETURN_SHOULD_REPEAT
- if (*XkbKeySymsPtr(xkb,key) != XK_Return)
-#endif
- xkb->ctrls->per_key_repeat[key/8]|= (1<<(key%8));
+ xkb->ctrls->per_key_repeat[key/8]|= (1<<(key%8));
if (changes && (old!=xkb->ctrls->per_key_repeat[key/8]))
changes->ctrls.changed_ctrls|= XkbPerKeyRepeatMask;
}
diff --git a/xkb/ddxBeep.c b/xkb/ddxBeep.c
index 2fab4ed78..74d868c0e 100644
--- a/xkb/ddxBeep.c
+++ b/xkb/ddxBeep.c
@@ -139,10 +139,6 @@ Atom name;
next= 0;
pitch= oldPitch= ctrl->bell_pitch;
duration= oldDuration= ctrl->bell_duration;
-#ifdef DEBUG
- if (xkbDebugFlags>1)
- ErrorF("[xkb] beep: %d (count= %d)\n",xkbInfo->beepType,xkbInfo->beepCount);
-#endif
name= None;
switch (xkbInfo->beepType) {
default:
diff --git a/xkb/ddxCtrls.c b/xkb/ddxCtrls.c
index 73a5e03ac..34ea0bd3f 100644
--- a/xkb/ddxCtrls.c
+++ b/xkb/ddxCtrls.c
@@ -47,12 +47,6 @@ int realRepeat;
realRepeat= ctrl->autoRepeat;
if ((dev->kbdfeed)&&(XkbDDXUsesSoftRepeat(dev)))
ctrl->autoRepeat= 0;
-#ifdef DEBUG
-if (xkbDebugFlags&0x4) {
- ErrorF("[xkb] XkbDDXKeybdCtrlProc: setting repeat to %d (real repeat is %d)\n",
- ctrl->autoRepeat,realRepeat);
-}
-#endif
if (dev->key && dev->key->xkbInfo && dev->key->xkbInfo->kbdProc)
(*dev->key->xkbInfo->kbdProc)(dev,ctrl);
ctrl->autoRepeat= realRepeat;
@@ -93,23 +87,6 @@ unsigned changed, i;
unsigned char *rep_old, *rep_new, *rep_fb;
changed= new->enabled_ctrls^old->enabled_ctrls;
-#ifdef NOTDEF
- if (changed&XkbRepeatKeysMask) {
- if (dev->kbdfeed) {
- int realRepeat;
-
- if (new->enabled_ctrls&XkbRepeatKeysMask)
- dev->kbdfeed->ctrl.autoRepeat= realRepeat= 1;
- else dev->kbdfeed->ctrl.autoRepeat= realRepeat= 0;
-
- if (XkbDDXUsesSoftRepeat(dev))
- dev->kbdfeed->ctrl.autoRepeat= FALSE;
- if (dev->kbdfeed->CtrlProc)
- (*dev->kbdfeed->CtrlProc)(dev,&dev->kbdfeed->ctrl);
- dev->kbdfeed->ctrl.autoRepeat= realRepeat;
- }
- }
-#endif
for (rep_old = old->per_key_repeat,
rep_new = new->per_key_repeat,
rep_fb = dev->kbdfeed->ctrl.autoRepeats,
diff --git a/xkb/ddxKeyClick.c b/xkb/ddxKeyClick.c
index 10f3f38c0..51d78f56d 100644
--- a/xkb/ddxKeyClick.c
+++ b/xkb/ddxKeyClick.c
@@ -42,9 +42,5 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
void
XkbDDXKeyClick(DeviceIntPtr pXDev,int keycode,int synthetic)
{
-#ifdef DEBUG
- if (xkbDebugFlags)
- ErrorF("[xkb] Click.\n");
-#endif
return;
}
diff --git a/xkb/ddxList.c b/xkb/ddxList.c
index 2baf65248..ae3a7f7e0 100644
--- a/xkb/ddxList.c
+++ b/xkb/ddxList.c
@@ -43,14 +43,6 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include <xkbsrv.h>
#include <X11/extensions/XI.h>
-#ifndef PATH_MAX
-#ifdef MAXPATHLEN
-#define PATH_MAX MAXPATHLEN
-#else
-#define PATH_MAX 1024
-#endif
-#endif
-
#ifdef WIN32
/* from ddxLoad.c */
extern const char* Win32TempDir();
@@ -199,9 +191,8 @@ char tmpname[PATH_MAX];
#ifndef WIN32
in= Popen(buf,"r");
#else
-#ifdef DEBUG_CMD
- ErrorF("[xkb] xkb executes: %s\n",buf);
-#endif
+ if (xkbDebugFlags)
+ DebugF("[xkb] xkbList executes: %s\n",buf);
if (System(buf) < 0)
ErrorF("[xkb] Could not invoke keymap compiler\n");
else
diff --git a/xkb/ddxLoad.c b/xkb/ddxLoad.c
index a0fa6061e..ee64c3be7 100644
--- a/xkb/ddxLoad.c
+++ b/xkb/ddxLoad.c
@@ -52,14 +52,6 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include <paths.h>
#endif
-#ifndef PATH_MAX
-#ifdef MAXPATHLEN
-#define PATH_MAX MAXPATHLEN
-#else
-#define PATH_MAX 1024
-#endif
-#endif
-
/*
* If XKM_OUTPUT_DIR specifies a path without a leading slash, it is
* relative to the top-level XKB configuration directory.
@@ -161,44 +153,19 @@ Win32System(const char *cmdline)
#define System(x) Win32System(x)
#endif
-#ifdef MAKE_XKM_OUTPUT_DIR
-/* Borrow trans_mkdir from Xtransutil.c to more safely make directories */
-# undef X11_t
-# define TRANS_SERVER
-# define PRMSG(lvl,x,a,b,c) \
- if (lvl <= 1) { LogMessage(X_ERROR,x,a,b,c); } else ((void)0)
-# include <X11/Xtrans/Xtransutil.c>
-# ifndef XKM_OUTPUT_DIR_MODE
-# define XKM_OUTPUT_DIR_MODE 0755
-# endif
-#endif
-
static void
OutputDirectory(
char* outdir,
size_t size)
{
#ifndef WIN32
- if (getuid() == 0 && (strlen(XKM_OUTPUT_DIR) < size)
-#ifdef MAKE_XKM_OUTPUT_DIR
- && (trans_mkdir(XKM_OUTPUT_DIR, XKM_OUTPUT_DIR_MODE) == 0)
-#endif
- )
+ if (getuid() == 0 && (strlen(XKM_OUTPUT_DIR) < size))
{
/* if server running as root it *may* be able to write */
/* FIXME: check whether directory is writable at all */
(void) strcpy (outdir, XKM_OUTPUT_DIR);
} else
-#endif
-#ifdef _PATH_VARTMP
- if ((strlen(_PATH_VARTMP) + 1) < size)
- {
- (void) strcpy (outdir, _PATH_VARTMP);
- if (outdir[strlen(outdir) - 1] != '/') /* Hi IBM, Digital */
- (void) strcat (outdir, "/");
- } else
-#endif
-#ifdef WIN32
+#else
if (strlen(Win32TempDir()) + 1 < size)
{
(void) strcpy(outdir, Win32TempDir());
@@ -211,81 +178,6 @@ OutputDirectory(
}
}
-static Bool
-XkbDDXCompileNamedKeymap( XkbDescPtr xkb,
- XkbComponentNamesPtr names,
- char * nameRtrn,
- int nameRtrnLen)
-{
-char *cmd = NULL,file[PATH_MAX],xkm_output_dir[PATH_MAX],*map,*outFile;
-
- if (names->keymap==NULL)
- return False;
- strncpy(file,names->keymap,PATH_MAX); file[PATH_MAX-1]= '\0';
- if ((map= strrchr(file,'('))!=NULL) {
- char *tmp;
- if ((tmp= strrchr(map,')'))!=NULL) {
- *map++= '\0';
- *tmp= '\0';
- }
- else {
- map= NULL;
- }
- }
- if ((outFile= strrchr(file,'/'))!=NULL)
- outFile= _XkbDupString(&outFile[1]);
- else outFile= _XkbDupString(file);
- XkbEnsureSafeMapName(outFile);
- OutputDirectory(xkm_output_dir, sizeof(xkm_output_dir));
-
- if (XkbBaseDirectory!=NULL) {
- char *xkbbasedir = XkbBaseDirectory;
- char *xkbbindir = XkbBinDirectory;
-
- cmd = Xprintf("\"%s" PATHSEPARATOR "xkbcomp\" -w %d \"-R%s\" -xkm %s%s -em1 %s -emp %s -eml %s keymap/%s \"%s%s.xkm\"",
- xkbbindir,
- ((xkbDebugFlags<2)?1:((xkbDebugFlags>10)?10:(int)xkbDebugFlags)),
- xkbbasedir,(map?"-m ":""),(map?map:""),
- PRE_ERROR_MSG,ERROR_PREFIX,POST_ERROR_MSG1,file,
- xkm_output_dir,outFile);
- }
- else {
- cmd = Xprintf("xkbcomp -w %d -xkm %s%s -em1 %s -emp %s -eml %s keymap/%s \"%s%s.xkm\"",
- ((xkbDebugFlags<2)?1:((xkbDebugFlags>10)?10:(int)xkbDebugFlags)),
- (map?"-m ":""),(map?map:""),
- PRE_ERROR_MSG,ERROR_PREFIX,POST_ERROR_MSG1,file,
- xkm_output_dir,outFile);
- }
-#ifdef DEBUG
- if (xkbDebugFlags) {
- ErrorF("[xkb] XkbDDXCompileNamedKeymap compiling keymap using:\n");
- ErrorF("[xkb] \"cmd\"\n");
- }
-#endif
-#ifdef DEBUG_CMD
- ErrorF("[xkb] xkb executes: %s\n",cmd);
-#endif
- if (System(cmd)==0) {
- if (nameRtrn) {
- strncpy(nameRtrn,outFile,nameRtrnLen);
- nameRtrn[nameRtrnLen-1]= '\0';
- }
- if (outFile!=NULL)
- _XkbFree(outFile);
- if (cmd!=NULL)
- xfree(cmd);
- return True;
- }
-#ifdef DEBUG
- ErrorF("[xkb] Error compiling keymap (%s)\n",names->keymap);
-#endif
- if (outFile!=NULL)
- _XkbFree(outFile);
- if (cmd!=NULL)
- xfree(cmd);
- return False;
-}
-
static Bool
XkbDDXCompileKeymapByNames( XkbDescPtr xkb,
XkbComponentNamesPtr names,
@@ -361,22 +253,18 @@ char tmpname[PATH_MAX];
#ifdef DEBUG
if (xkbDebugFlags) {
ErrorF("[xkb] XkbDDXCompileKeymapByNames compiling keymap:\n");
- XkbWriteXKBKeymapForNames(stderr,names,NULL,xkb,want,need);
+ XkbWriteXKBKeymapForNames(stderr,names,xkb,want,need);
}
#endif
- XkbWriteXKBKeymapForNames(out,names,NULL,xkb,want,need);
+ XkbWriteXKBKeymapForNames(out,names,xkb,want,need);
#ifndef WIN32
if (Pclose(out)==0)
#else
if (fclose(out)==0 && System(buf) >= 0)
#endif
{
-#ifdef DEBUG_CMD
- ErrorF("[xkb] xkb executes: %s\n",buf);
- ErrorF("[xkb] xkbcomp input:\n");
- XkbWriteXKBKeymapForNames(stderr,names,NULL,xkb,want,need);
- ErrorF("[xkb] end xkbcomp input\n");
-#endif
+ if (xkbDebugFlags)
+ DebugF("[xkb] xkb executes: %s\n",buf);
if (nameRtrn) {
strncpy(nameRtrn,keymap,nameRtrnLen);
nameRtrn[nameRtrnLen-1]= '\0';
@@ -385,24 +273,20 @@ char tmpname[PATH_MAX];
xfree (buf);
return True;
}
-#ifdef DEBUG
else
- ErrorF("[xkb] Error compiling keymap (%s)\n",keymap);
-#endif
+ DebugF("[xkb] Error compiling keymap (%s)\n",keymap);
#ifdef WIN32
/* remove the temporary file */
unlink(tmpname);
#endif
}
-#ifdef DEBUG
else {
#ifndef WIN32
- ErrorF("[xkb] Could not invoke keymap compiler\n");
+ DebugF("[xkb] Could not invoke keymap compiler\n");
#else
- ErrorF("[xkb] Could not open file %s\n", tmpname);
+ DebugF("[xkb] Could not open file %s\n", tmpname);
#endif
}
-#endif
if (nameRtrn)
nameRtrn[0]= '\0';
if (buf != NULL)
@@ -450,44 +334,27 @@ XkbDDXLoadKeymapByNames( DeviceIntPtr keybd,
XkbComponentNamesPtr names,
unsigned want,
unsigned need,
- XkbFileInfo * finfoRtrn,
+ XkbDescPtr * xkbRtrn,
char * nameRtrn,
int nameRtrnLen)
{
-XkbDescPtr xkb;
+XkbDescPtr xkb;
FILE * file;
char fileName[PATH_MAX];
unsigned missing;
- bzero(finfoRtrn,sizeof(XkbFileInfo));
+ *xkbRtrn = NULL;
if ((keybd==NULL)||(keybd->key==NULL)||(keybd->key->xkbInfo==NULL))
xkb= NULL;
else xkb= keybd->key->xkbInfo->desc;
if ((names->keycodes==NULL)&&(names->types==NULL)&&
(names->compat==NULL)&&(names->symbols==NULL)&&
(names->geometry==NULL)) {
- if (names->keymap==NULL) {
- bzero(finfoRtrn,sizeof(XkbFileInfo));
- if (xkb && XkbDetermineFileType(finfoRtrn,XkbXKMFile,NULL) &&
- ((finfoRtrn->defined&need)==need) ) {
- finfoRtrn->xkb= xkb;
- nameRtrn[0]= '\0';
- return finfoRtrn->defined;
- }
- return 0;
- }
- else if (!XkbDDXCompileNamedKeymap(xkb,names,nameRtrn,nameRtrnLen)) {
-#ifdef NOISY
- ErrorF("[xkb] Couldn't compile keymap file\n");
-#endif
- return 0;
- }
+ return 0;
}
else if (!XkbDDXCompileKeymapByNames(xkb,names,want,need,
- nameRtrn,nameRtrnLen)){
-#ifdef NOISY
- ErrorF("[xkb] Couldn't compile keymap file\n");
-#endif
+ nameRtrn,nameRtrnLen)){
+ DebugF("[xkb] Couldn't compile keymap file\n");
return 0;
}
file= XkbDDXOpenConfigFile(nameRtrn,fileName,PATH_MAX);
@@ -495,18 +362,16 @@ unsigned missing;
LogMessage(X_ERROR, "Couldn't open compiled keymap file %s\n",fileName);
return 0;
}
- missing= XkmReadFile(file,need,want,finfoRtrn);
- if (finfoRtrn->xkb==NULL) {
+ missing= XkmReadFile(file,need,want,xkbRtrn);
+ if (*xkbRtrn==NULL) {
LogMessage(X_ERROR, "Error loading keymap %s\n",fileName);
fclose(file);
(void) unlink (fileName);
return 0;
}
-#ifdef DEBUG
else if (xkbDebugFlags) {
- ErrorF("[xkb] Loaded %s, defined=0x%x\n",fileName,finfoRtrn->defined);
+ DebugF("[xkb] Loaded XKB keymap %s, defined=0x%x\n",fileName,(*xkbRtrn)->defined);
}
-#endif
fclose(file);
(void) unlink (fileName);
return (need|want)&(~missing);
diff --git a/xkb/maprules.c b/xkb/maprules.c
index 0fa356ee5..4c947f004 100644
--- a/xkb/maprules.c
+++ b/xkb/maprules.c
@@ -46,20 +46,10 @@
#include "misc.h"
#include "inputstr.h"
#include "dix.h"
-#include <X11/extensions/XKBstr.h>
+#include "xkbstr.h"
#define XKBSRV_NEED_FILE_FUNCS
#include <xkbsrv.h>
-#ifdef DEBUG
-#define PR_DEBUG(s) fprintf(stderr,s)
-#define PR_DEBUG1(s,a) fprintf(stderr,s,a)
-#define PR_DEBUG2(s,a,b) fprintf(stderr,s,a,b)
-#else
-#define PR_DEBUG(s)
-#define PR_DEBUG1(s,a)
-#define PR_DEBUG2(s,a,b)
-#endif
-
/***====================================================================***/
#define DFLT_LINE_SIZE 128
@@ -171,8 +161,8 @@ Bool endOfFile,spacePending,slashPending,inComment;
}
if (checkbang && ch=='!') {
if (line->num_line!=0) {
- PR_DEBUG("The '!' legal only at start of line\n");
- PR_DEBUG("Line containing '!' ignored\n");
+ DebugF("The '!' legal only at start of line\n");
+ DebugF("Line containing '!' ignored\n");
line->num_line= 0;
inComment= 0;
break;
@@ -273,9 +263,7 @@ unsigned present, l_ndx_present, v_ndx_present;
register int i;
int len, ndx;
_Xstrtokparams strtok_buf;
-#ifdef DEBUG
Bool found;
-#endif
l_ndx_present = v_ndx_present = present= 0;
@@ -284,9 +272,7 @@ Bool found;
bzero((char *)remap,sizeof(RemapSpec));
remap->number = len;
while ((tok=_XStrtok(str," ",strtok_buf))!=NULL) {
-#ifdef DEBUG
found= False;
-#endif
str= NULL;
if (strcmp(tok,"=")==0)
continue;
@@ -299,22 +285,20 @@ Bool found;
*end != '\0' || ndx == -1)
break;
if (ndx < 1 || ndx > XkbNumKbdGroups) {
- PR_DEBUG2("Illegal %s index: %d\n", cname[i], ndx);
- PR_DEBUG1("Index must be in range 1..%d\n",
+ DebugF("Illegal %s index: %d\n", cname[i], ndx);
+ DebugF("Index must be in range 1..%d\n",
XkbNumKbdGroups);
break;
}
} else {
ndx = 0;
}
-#ifdef DEBUG
found= True;
-#endif
if (present&(1<<i)) {
if ((i == LAYOUT && l_ndx_present&(1<<ndx)) ||
(i == VARIANT && v_ndx_present&(1<<ndx)) ) {
- PR_DEBUG1("Component \"%s\" listed twice\n",tok);
- PR_DEBUG("Second definition ignored\n");
+ DebugF("Component \"%s\" listed twice\n",tok);
+ DebugF("Second definition ignored\n");
break;
}
}
@@ -328,38 +312,34 @@ Bool found;
break;
}
}
-#ifdef DEBUG
if (!found) {
fprintf(stderr,"Unknown component \"%s\" ignored\n",tok);
}
-#endif
}
if ((present&PART_MASK)==0) {
-#ifdef DEBUG
unsigned mask= PART_MASK;
- fprintf(stderr,"Mapping needs at least one of ");
+ ErrorF("Mapping needs at least one of ");
for (i=0; (i<MAX_WORDS); i++) {
if ((1L<<i)&mask) {
mask&= ~(1L<<i);
- if (mask) fprintf(stderr,"\"%s,\" ",cname[i]);
- else fprintf(stderr,"or \"%s\"\n",cname[i]);
+ if (mask) DebugF("\"%s,\" ",cname[i]);
+ else DebugF("or \"%s\"\n",cname[i]);
}
}
- fprintf(stderr,"Illegal mapping ignored\n");
-#endif
+ DebugF("Illegal mapping ignored\n");
remap->num_remap= 0;
return;
}
if ((present&COMPONENT_MASK)==0) {
- PR_DEBUG("Mapping needs at least one component\n");
- PR_DEBUG("Illegal mapping ignored\n");
+ DebugF("Mapping needs at least one component\n");
+ DebugF("Illegal mapping ignored\n");
remap->num_remap= 0;
return;
}
if (((present&COMPONENT_MASK)&(1<<KEYMAP))&&
((present&COMPONENT_MASK)!=(1<<KEYMAP))) {
- PR_DEBUG("Keymap cannot appear with other components\n");
- PR_DEBUG("Illegal mapping ignored\n");
+ DebugF("Keymap cannot appear with other components\n");
+ DebugF("Illegal mapping ignored\n");
remap->num_remap= 0;
return;
}
@@ -434,8 +414,8 @@ Bool append = False;
}
if (remap->num_remap==0) {
- PR_DEBUG("Must have a mapping before first line of data\n");
- PR_DEBUG("Illegal line of data ignored\n");
+ DebugF("Must have a mapping before first line of data\n");
+ DebugF("Illegal line of data ignored\n");
return False;
}
bzero((char *)&tmp,sizeof(FileSpec));
@@ -447,8 +427,8 @@ Bool append = False;
continue;
}
if (nread>remap->num_remap) {
- PR_DEBUG("Too many words on a line\n");
- PR_DEBUG1("Extra word \"%s\" ignored\n",tok);
+ DebugF("Too many words on a line\n");
+ DebugF("Extra word \"%s\" ignored\n",tok);
continue;
}
tmp.name[remap->remap[nread].word]= tok;
@@ -456,8 +436,8 @@ Bool append = False;
append = True;
}
if (nread<remap->num_remap) {
- PR_DEBUG1("Too few words on a line: %s\n", line->line);
- PR_DEBUG("line ignored\n");
+ DebugF("Too few words on a line: %s\n", line->line);
+ DebugF("line ignored\n");
return False;
}
@@ -479,7 +459,7 @@ Bool append = False;
rule->types= _XkbDupString(tmp.name[TYPES]);
rule->compat= _XkbDupString(tmp.name[COMPAT]);
rule->geometry= _XkbDupString(tmp.name[GEOMETRY]);
- rule->keymap= _XkbDupString(tmp.name[KEYMAP]);
+ rule->keymap= NULL;
rule->layout_num = rule->variant_num = 0;
for (i = 0; i < nread; i++) {
@@ -609,7 +589,6 @@ XkbRF_ApplyRule( XkbRF_RulePtr rule,
Apply(rule->types, &names->types);
Apply(rule->compat, &names->compat);
Apply(rule->geometry, &names->geometry);
- Apply(rule->keymap, &names->keymap);
}
static Bool
@@ -903,9 +882,7 @@ XkbRF_AddRule(XkbRF_RulesPtr rules)
}
if (!rules->rules) {
rules->sz_rules= rules->num_rules= 0;
-#ifdef DEBUG
- fprintf(stderr,"Allocation failure in XkbRF_AddRule\n");
-#endif
+ DebugF("Allocation failure in XkbRF_AddRule\n");
return NULL;
}
bzero((char *)&rules->rules[rules->num_rules],sizeof(XkbRF_RuleRec));
@@ -1022,7 +999,7 @@ XkbRF_AddVarDesc(XkbRF_DescribeVarsPtr vars)
}
if (!vars->desc) {
vars->sz_desc= vars->num_desc= 0;
- PR_DEBUG("Allocation failure in XkbRF_AddVarDesc\n");
+ DebugF("Allocation failure in XkbRF_AddVarDesc\n");
return NULL;
}
vars->desc[vars->num_desc].name= NULL;
@@ -1059,7 +1036,7 @@ XkbRF_AddVarToDescribe(XkbRF_RulesPtr rules,char *name)
XkbRF_DescribeVarsRec);
}
if ((!rules->extra_names)||(!rules->extra)) {
- PR_DEBUG("allocation error in extra parts\n");
+ DebugF("allocation error in extra parts\n");
rules->sz_extra= rules->num_extra= 0;
rules->extra_names= NULL;
rules->extra= NULL;
@@ -1102,7 +1079,7 @@ int len,headingtype,extra_ndx = 0;
}
if (extra_ndx<0) {
XkbRF_DescribeVarsPtr var;
- PR_DEBUG1("Extra heading \"%s\" encountered\n",tok);
+ DebugF("Extra heading \"%s\" encountered\n",tok);
var= XkbRF_AddVarToDescribe(rules,tok);
if (var)
extra_ndx= var-rules->extra;
@@ -1113,20 +1090,20 @@ int len,headingtype,extra_ndx = 0;
}
if (headingtype == HEAD_NONE) {
- PR_DEBUG("Must have a heading before first line of data\n");
- PR_DEBUG("Illegal line of data ignored\n");
+ DebugF("Must have a heading before first line of data\n");
+ DebugF("Illegal line of data ignored\n");
continue;
}
len = strlen(line.line);
if ((tmp.name= strtok(line.line, " \t")) == NULL) {
- PR_DEBUG("Huh? No token on line\n");
- PR_DEBUG("Illegal line of data ignored\n");
+ DebugF("Huh? No token on line\n");
+ DebugF("Illegal line of data ignored\n");
continue;
}
if (strlen(tmp.name) == len) {
- PR_DEBUG("No description found\n");
- PR_DEBUG("Illegal line of data ignored\n");
+ DebugF("No description found\n");
+ DebugF("Illegal line of data ignored\n");
continue;
}
@@ -1134,8 +1111,8 @@ int len,headingtype,extra_ndx = 0;
while ((*tok!='\n')&&isspace(*tok))
tok++;
if (*tok == '\0') {
- PR_DEBUG("No description found\n");
- PR_DEBUG("Illegal line of data ignored\n");
+ DebugF("No description found\n");
+ DebugF("Illegal line of data ignored\n");
continue;
}
tmp.desc= tok;
@@ -1301,7 +1278,6 @@ XkbRF_GroupPtr group;
if (rule->types) _XkbFree(rule->types);
if (rule->compat) _XkbFree(rule->compat);
if (rule->geometry) _XkbFree(rule->geometry);
- if (rule->keymap) _XkbFree(rule->keymap);
bzero((char *)rule,sizeof(XkbRF_RuleRec));
}
_XkbFree(rules->rules);
diff --git a/xkb/xkb.c b/xkb/xkb.c
index 835b6135c..9b3d78e0d 100644
--- a/xkb/xkb.c
+++ b/xkb/xkb.c
@@ -211,7 +211,7 @@ ProcXkbSelectEvents(ClientPtr client)
if (!(client->xkbClientFlags&_XkbClientInitialized))
return BadAccess;
- CHK_ANY_DEVICE(dev, stuff->deviceSpec, client, DixReadAccess);
+ CHK_ANY_DEVICE(dev, stuff->deviceSpec, client, DixUseAccess);
if (((stuff->affectWhich&XkbMapNotifyMask)!=0)&&(stuff->affectMap)) {
client->mapNotifyMask&= ~stuff->affectMap;
@@ -694,7 +694,7 @@ ProcXkbSetControls(ClientPtr client)
if (!(client->xkbClientFlags & _XkbClientInitialized))
return BadAccess;
- CHK_KBD_DEVICE(dev, stuff->deviceSpec, client, DixSetAttrAccess);
+ CHK_KBD_DEVICE(dev, stuff->deviceSpec, client, DixManageAccess);
CHK_MASK_LEGAL(0x01, stuff->changeCtrls, XkbAllControlsMask);
for (tmpd = inputInfo.keyboard; tmpd; tmpd = tmpd->next) {
@@ -2304,7 +2304,7 @@ ProcXkbSetMap(ClientPtr client)
if (!(client->xkbClientFlags&_XkbClientInitialized))
return BadAccess;
- CHK_KBD_DEVICE(dev, stuff->deviceSpec, client, DixSetAttrAccess);
+ CHK_KBD_DEVICE(dev, stuff->deviceSpec, client, DixManageAccess);
CHK_MASK_LEGAL(0x01,stuff->present,XkbAllMapComponentsMask);
XkbSetCauseXkbReq(&cause,X_kbSetMap,client);
@@ -2618,7 +2618,7 @@ ProcXkbSetCompatMap(ClientPtr client)
if (!(client->xkbClientFlags&_XkbClientInitialized))
return BadAccess;
- CHK_KBD_DEVICE(dev, stuff->deviceSpec, client, DixSetAttrAccess);
+ CHK_KBD_DEVICE(dev, stuff->deviceSpec, client, DixManageAccess);
data = (char *)&stuff[1];
xkbi = dev->key->xkbInfo;
@@ -3545,7 +3545,7 @@ ProcXkbSetNames(ClientPtr client)
if (!(client->xkbClientFlags&_XkbClientInitialized))
return BadAccess;
- CHK_KBD_DEVICE(dev, stuff->deviceSpec, client, DixUnknownAccess);
+ CHK_KBD_DEVICE(dev, stuff->deviceSpec, client, DixManageAccess);
CHK_MASK_LEGAL(0x01,stuff->which,XkbAllNamesMask);
xkb = dev->key->xkbInfo->desc;
@@ -3870,7 +3870,7 @@ ProcXkbSetNames(ClientPtr client)
/***====================================================================***/
-#include <X11/extensions/XKBgeom.h>
+#include "xkbgeom.h"
#define XkbSizeCountedString(s) ((s)?((((2+strlen(s))+3)/4)*4):4)
@@ -4844,7 +4844,7 @@ ProcXkbSetGeometry(ClientPtr client)
if (!(client->xkbClientFlags&_XkbClientInitialized))
return BadAccess;
- CHK_KBD_DEVICE(dev, stuff->deviceSpec, client, DixSetAttrAccess);
+ CHK_KBD_DEVICE(dev, stuff->deviceSpec, client, DixManageAccess);
CHK_ATOM_OR_NONE(stuff->name);
xkb= dev->key->xkbInfo->desc;
@@ -5109,7 +5109,6 @@ ProcXkbGetKbdByName(ClientPtr client)
{
DeviceIntPtr dev;
DeviceIntPtr tmpd;
- XkbFileInfo finfo;
xkbGetKbdByNameReply rep;
xkbGetMapReply mrep;
xkbGetCompatMapReply crep;
@@ -5117,7 +5116,7 @@ ProcXkbGetKbdByName(ClientPtr client)
xkbGetNamesReply nrep;
xkbGetGeometryReply grep;
XkbComponentNamesRec names;
- XkbDescPtr xkb;
+ XkbDescPtr xkb, new;
unsigned char * str;
char mapFile[PATH_MAX];
unsigned len;
@@ -5126,7 +5125,7 @@ ProcXkbGetKbdByName(ClientPtr client)
Bool geom_changed;
XkbSrvLedInfoPtr old_sli;
XkbSrvLedInfoPtr sli;
- Mask access_mode = DixGetAttrAccess | DixSetAttrAccess;
+ Mask access_mode = DixGetAttrAccess | DixManageAccess;
REQUEST(xkbGetKbdByNameReq);
REQUEST_AT_LEAST_SIZE(xkbGetKbdByNameReq);
@@ -5157,25 +5156,20 @@ ProcXkbGetKbdByName(ClientPtr client)
if (stuff->load)
fwant= XkbGBN_AllComponentsMask;
else fwant= stuff->want|stuff->need;
- if (!names.keymap) {
- if ((!names.compat)&&
- (fwant&(XkbGBN_CompatMapMask|XkbGBN_IndicatorMapMask))) {
- names.compat= _XkbDupString("%");
- }
- if ((!names.types)&&(fwant&(XkbGBN_TypesMask))) {
- names.types= _XkbDupString("%");
- }
- if ((!names.symbols)&&(fwant&XkbGBN_SymbolsMask)) {
- names.symbols= _XkbDupString("%");
- }
- geom_changed= ((names.geometry!=NULL)&&(strcmp(names.geometry,"%")!=0));
- if ((!names.geometry)&&(fwant&XkbGBN_GeometryMask)) {
- names.geometry= _XkbDupString("%");
- geom_changed= False;
- }
+ if ((!names.compat)&&
+ (fwant&(XkbGBN_CompatMapMask|XkbGBN_IndicatorMapMask))) {
+ names.compat= _XkbDupString("%");
}
- else {
- geom_changed= True;
+ if ((!names.types)&&(fwant&(XkbGBN_TypesMask))) {
+ names.types= _XkbDupString("%");
+ }
+ if ((!names.symbols)&&(fwant&XkbGBN_SymbolsMask)) {
+ names.symbols= _XkbDupString("%");
+ }
+ geom_changed= ((names.geometry!=NULL)&&(strcmp(names.geometry,"%")!=0));
+ if ((!names.geometry)&&(fwant&XkbGBN_GeometryMask)) {
+ names.geometry= _XkbDupString("%");
+ geom_changed= False;
}
bzero(mapFile,PATH_MAX);
@@ -5199,35 +5193,35 @@ ProcXkbGetKbdByName(ClientPtr client)
}
/* We pass dev in here so we can get the old names out if needed. */
- rep.found = XkbDDXLoadKeymapByNames(dev,&names,fwant,fneed,&finfo,
+ rep.found = XkbDDXLoadKeymapByNames(dev,&names,fwant,fneed,&new,
mapFile,PATH_MAX);
rep.newKeyboard= False;
rep.pad1= rep.pad2= rep.pad3= rep.pad4= 0;
stuff->want|= stuff->need;
- if (finfo.xkb==NULL)
+ if (new==NULL)
rep.reported= 0;
else {
if (stuff->load)
rep.loaded= True;
if (stuff->load ||
- ((rep.reported&XkbGBN_SymbolsMask) && (finfo.xkb->compat))) {
+ ((rep.reported&XkbGBN_SymbolsMask) && (new->compat))) {
XkbChangesRec changes;
bzero(&changes,sizeof(changes));
- XkbUpdateDescActions(finfo.xkb,
- finfo.xkb->min_key_code,XkbNumKeys(finfo.xkb),
+ XkbUpdateDescActions(new,
+ new->min_key_code,XkbNumKeys(new),
&changes);
}
- if (finfo.xkb->map==NULL)
+ if (new->map==NULL)
rep.reported&= ~(XkbGBN_SymbolsMask|XkbGBN_TypesMask);
else if (rep.reported&(XkbGBN_SymbolsMask|XkbGBN_TypesMask)) {
mrep.type= X_Reply;
mrep.deviceID = dev->id;
mrep.sequenceNumber= client->sequence;
mrep.length = ((SIZEOF(xkbGetMapReply)-SIZEOF(xGenericReply))>>2);
- mrep.minKeyCode = finfo.xkb->min_key_code;
- mrep.maxKeyCode = finfo.xkb->max_key_code;
+ mrep.minKeyCode = new->min_key_code;
+ mrep.maxKeyCode = new->max_key_code;
mrep.present = 0;
mrep.totalSyms = mrep.totalActs =
mrep.totalKeyBehaviors= mrep.totalKeyExplicit=
@@ -5235,7 +5229,7 @@ ProcXkbGetKbdByName(ClientPtr client)
if (rep.reported&(XkbGBN_TypesMask|XkbGBN_ClientSymbolsMask)) {
mrep.present|= XkbKeyTypesMask;
mrep.firstType = 0;
- mrep.nTypes = mrep.totalTypes= finfo.xkb->map->num_types;
+ mrep.nTypes = mrep.totalTypes= new->map->num_types;
}
else {
mrep.firstType = mrep.nTypes= 0;
@@ -5243,8 +5237,8 @@ ProcXkbGetKbdByName(ClientPtr client)
}
if (rep.reported&XkbGBN_ClientSymbolsMask) {
mrep.present|= (XkbKeySymsMask|XkbModifierMapMask);
- mrep.firstKeySym = mrep.firstModMapKey= finfo.xkb->min_key_code;
- mrep.nKeySyms = mrep.nModMapKeys= XkbNumKeys(finfo.xkb);
+ mrep.firstKeySym = mrep.firstModMapKey= new->min_key_code;
+ mrep.nKeySyms = mrep.nModMapKeys= XkbNumKeys(new);
}
else {
mrep.firstKeySym= mrep.firstModMapKey= 0;
@@ -5254,9 +5248,9 @@ ProcXkbGetKbdByName(ClientPtr client)
mrep.present|= XkbAllServerInfoMask;
mrep.virtualMods= ~0;
mrep.firstKeyAct = mrep.firstKeyBehavior =
- mrep.firstKeyExplicit = finfo.xkb->min_key_code;
+ mrep.firstKeyExplicit = new->min_key_code;
mrep.nKeyActs = mrep.nKeyBehaviors =
- mrep.nKeyExplicit = XkbNumKeys(finfo.xkb);
+ mrep.nKeyExplicit = XkbNumKeys(new);
}
else {
mrep.virtualMods= 0;
@@ -5264,10 +5258,10 @@ ProcXkbGetKbdByName(ClientPtr client)
mrep.firstKeyExplicit = 0;
mrep.nKeyActs= mrep.nKeyBehaviors= mrep.nKeyExplicit= 0;
}
- XkbComputeGetMapReplySize(finfo.xkb,&mrep);
+ XkbComputeGetMapReplySize(new,&mrep);
rep.length+= SIZEOF(xGenericReply)/4+mrep.length;
}
- if (finfo.xkb->compat==NULL)
+ if (new->compat==NULL)
rep.reported&= ~XkbGBN_CompatMapMask;
else if (rep.reported&XkbGBN_CompatMapMask) {
crep.type= X_Reply;
@@ -5276,11 +5270,11 @@ ProcXkbGetKbdByName(ClientPtr client)
crep.length= 0;
crep.groups= XkbAllGroupsMask;
crep.firstSI= 0;
- crep.nSI= crep.nTotalSI= finfo.xkb->compat->num_si;
- XkbComputeGetCompatMapReplySize(finfo.xkb->compat,&crep);
+ crep.nSI= crep.nTotalSI= new->compat->num_si;
+ XkbComputeGetCompatMapReplySize(new->compat,&crep);
rep.length+= SIZEOF(xGenericReply)/4+crep.length;
}
- if (finfo.xkb->indicators==NULL)
+ if (new->indicators==NULL)
rep.reported&= ~XkbGBN_IndicatorMapMask;
else if (rep.reported&XkbGBN_IndicatorMapMask) {
irep.type= X_Reply;
@@ -5288,28 +5282,28 @@ ProcXkbGetKbdByName(ClientPtr client)
irep.sequenceNumber= client->sequence;
irep.length= 0;
irep.which= XkbAllIndicatorsMask;
- XkbComputeGetIndicatorMapReplySize(finfo.xkb->indicators,&irep);
+ XkbComputeGetIndicatorMapReplySize(new->indicators,&irep);
rep.length+= SIZEOF(xGenericReply)/4+irep.length;
}
- if (finfo.xkb->names==NULL)
+ if (new->names==NULL)
rep.reported&= ~(XkbGBN_OtherNamesMask|XkbGBN_KeyNamesMask);
else if (rep.reported&(XkbGBN_OtherNamesMask|XkbGBN_KeyNamesMask)) {
nrep.type= X_Reply;
nrep.deviceID= dev->id;
nrep.sequenceNumber= client->sequence;
nrep.length= 0;
- nrep.minKeyCode= finfo.xkb->min_key_code;
- nrep.maxKeyCode= finfo.xkb->max_key_code;
+ nrep.minKeyCode= new->min_key_code;
+ nrep.maxKeyCode= new->max_key_code;
if (rep.reported&XkbGBN_OtherNamesMask) {
nrep.which= XkbAllNamesMask;
- if (finfo.xkb->map!=NULL)
- nrep.nTypes= finfo.xkb->map->num_types;
+ if (new->map!=NULL)
+ nrep.nTypes= new->map->num_types;
else nrep.nTypes= 0;
nrep.nKTLevels= 0;
nrep.groupNames= XkbAllGroupsMask;
nrep.virtualMods= XkbAllVirtualModsMask;
nrep.indicators= XkbAllIndicatorsMask;
- nrep.nRadioGroups= finfo.xkb->names->num_rg;
+ nrep.nRadioGroups= new->names->num_rg;
}
else {
nrep.which= 0;
@@ -5322,9 +5316,9 @@ ProcXkbGetKbdByName(ClientPtr client)
}
if (rep.reported&XkbGBN_KeyNamesMask) {
nrep.which|= XkbKeyNamesMask;
- nrep.firstKey= finfo.xkb->min_key_code;
- nrep.nKeys= XkbNumKeys(finfo.xkb);
- nrep.nKeyAliases= finfo.xkb->names->num_key_aliases;
+ nrep.firstKey= new->min_key_code;
+ nrep.nKeys= XkbNumKeys(new);
+ nrep.nKeyAliases= new->names->num_key_aliases;
if (nrep.nKeyAliases)
nrep.which|= XkbKeyAliasesMask;
}
@@ -5333,10 +5327,10 @@ ProcXkbGetKbdByName(ClientPtr client)
nrep.firstKey= nrep.nKeys= 0;
nrep.nKeyAliases= 0;
}
- XkbComputeGetNamesReplySize(finfo.xkb,&nrep);
+ XkbComputeGetNamesReplySize(new,&nrep);
rep.length+= SIZEOF(xGenericReply)/4+nrep.length;
}
- if (finfo.xkb->geom==NULL)
+ if (new->geom==NULL)
rep.reported&= ~XkbGBN_GeometryMask;
else if (rep.reported&XkbGBN_GeometryMask) {
grep.type= X_Reply;
@@ -5349,7 +5343,7 @@ ProcXkbGetKbdByName(ClientPtr client)
grep.nProperties= grep.nColors= grep.nShapes= 0;
grep.nSections= grep.nDoodads= 0;
grep.baseColorNdx= grep.labelColorNdx= 0;
- XkbComputeGetGeometryReplySize(finfo.xkb->geom,&grep,None);
+ XkbComputeGetGeometryReplySize(new->geom,&grep,None);
rep.length+= SIZEOF(xGenericReply)/4+grep.length;
}
}
@@ -5364,23 +5358,23 @@ ProcXkbGetKbdByName(ClientPtr client)
}
WriteToClient(client,SIZEOF(xkbGetKbdByNameReply), (char *)&rep);
if (reported&(XkbGBN_SymbolsMask|XkbGBN_TypesMask))
- XkbSendMap(client,finfo.xkb,&mrep);
+ XkbSendMap(client,new,&mrep);
if (reported&XkbGBN_CompatMapMask)
- XkbSendCompatMap(client,finfo.xkb->compat,&crep);
+ XkbSendCompatMap(client,new->compat,&crep);
if (reported&XkbGBN_IndicatorMapMask)
- XkbSendIndicatorMap(client,finfo.xkb->indicators,&irep);
+ XkbSendIndicatorMap(client,new->indicators,&irep);
if (reported&(XkbGBN_KeyNamesMask|XkbGBN_OtherNamesMask))
- XkbSendNames(client,finfo.xkb,&nrep);
+ XkbSendNames(client,new,&nrep);
if (reported&XkbGBN_GeometryMask)
- XkbSendGeometry(client,finfo.xkb->geom,&grep,False);
+ XkbSendGeometry(client,new->geom,&grep,False);
if (rep.loaded) {
XkbDescPtr old_xkb;
xkbNewKeyboardNotify nkn;
int i,nG,nTG;
old_xkb= xkb;
- xkb= finfo.xkb;
+ xkb= new;
dev->key->xkbInfo->desc= xkb;
- finfo.xkb= old_xkb; /* so it'll get freed automatically */
+ new= old_xkb; /* so it'll get freed automatically */
*xkb->ctrls= *old_xkb->ctrls;
for (nG=nTG=0,i=xkb->min_key_code;i<=xkb->max_key_code;i++) {
@@ -5424,8 +5418,8 @@ ProcXkbGetKbdByName(ClientPtr client)
/* this should be either a MN or an NKN, depending on whether or not
* the keycode range changed? */
nkn.deviceID= nkn.oldDeviceID= dev->id;
- nkn.minKeyCode= finfo.xkb->min_key_code;
- nkn.maxKeyCode= finfo.xkb->max_key_code;
+ nkn.minKeyCode= new->min_key_code;
+ nkn.maxKeyCode= new->max_key_code;
nkn.oldMinKeyCode= xkb->min_key_code;
nkn.oldMaxKeyCode= xkb->max_key_code;
nkn.requestMajor= XkbReqCode;
@@ -5435,9 +5429,9 @@ ProcXkbGetKbdByName(ClientPtr client)
nkn.changed|= XkbNKN_GeometryMask;
XkbSendNewKeyboardNotify(dev,&nkn);
}
- if ((finfo.xkb!=NULL)&&(finfo.xkb!=xkb)) {
- XkbFreeKeyboard(finfo.xkb,XkbAllComponentsMask,True);
- finfo.xkb= NULL;
+ if ((new!=NULL)&&(new!=xkb)) {
+ XkbFreeKeyboard(new,XkbAllComponentsMask,True);
+ new= NULL;
}
if (names.keymap) { _XkbFree(names.keymap); names.keymap= NULL; }
if (names.keycodes) { _XkbFree(names.keycodes); names.keycodes= NULL; }
@@ -5784,10 +5778,8 @@ char * str;
return status;
}
else if (length!=0) {
-#ifdef DEBUG
ErrorF("[xkb] Internal Error! BadLength in ProcXkbGetDeviceInfo\n");
ErrorF("[xkb] Wrote %d fewer bytes than expected\n",length);
-#endif
return BadLength;
}
if (stuff->wanted&(~supported)) {
@@ -5997,7 +5989,7 @@ xkbExtensionDeviceNotify ed;
change= stuff->change;
- CHK_ANY_DEVICE(dev, stuff->deviceSpec, client, DixSetAttrAccess);
+ CHK_ANY_DEVICE(dev, stuff->deviceSpec, client, DixManageAccess);
CHK_MASK_LEGAL(0x01,change,XkbXI_AllFeaturesMask);
wire= (char *)&stuff[1];
diff --git a/xkb/xkb.h b/xkb/xkb.h
index 99b60bf5e..bc6c6c954 100644
--- a/xkb/xkb.h
+++ b/xkb/xkb.h
@@ -1,4 +1,5 @@
-/* #include "XKBfile.h" */
+#ifndef _XKB_H
+#define _XKB_H
extern int ProcXkbUseExtension(ClientPtr client);
extern int ProcXkbSelectEvents(ClientPtr client);
@@ -35,3 +36,5 @@ extern Bool XkbCopyKeymap(
XkbDescPtr src,
XkbDescPtr dst,
Bool sendNotifies);
+
+#endif
diff --git a/xkb/xkbAccessX.c b/xkb/xkbAccessX.c
index 975b2eb5f..28107d05d 100644
--- a/xkb/xkbAccessX.c
+++ b/xkb/xkbAccessX.c
@@ -130,11 +130,9 @@ xEvent xE;
xE.u.u.type = type;
xE.u.u.detail = keyCode;
xE.u.keyButtonPointer.time = GetTimeInMillis();
-#ifdef DEBUG
if (xkbDebugFlags&0x8) {
- ErrorF("[xkb] AXKE: Key %d %s\n",keyCode,(xE.u.u.type==KeyPress?"down":"up"));
+ DebugF("[xkb] AXKE: Key %d %s\n",keyCode,(xE.u.u.type==KeyPress?"down":"up"));
}
-#endif
if (_XkbIsPressEvent(type))
XkbDDXKeyClick(keybd,keyCode,TRUE);
@@ -532,10 +530,8 @@ KeySym * sym = XkbKeySymsPtr(xkbi->desc,key);
((ctrls->enabled_ctrls&(XkbSlowKeysMask|XkbRepeatKeysMask))==
XkbRepeatKeysMask)) {
if (BitIsOn(keybd->kbdfeed->ctrl.autoRepeats,key)) {
-#ifdef DEBUG
if (xkbDebugFlags&0x10)
- ErrorF("[xkb] Starting software autorepeat...\n");
-#endif
+ DebugF("Starting software autorepeat...\n");
xkbi->repeatKey = key;
xkbi->repeatKeyTimer= TimerSet(xkbi->repeatKeyTimer,
0, ctrls->repeat_delay,
diff --git a/xkb/xkbActions.c b/xkb/xkbActions.c
index 00165be33..ab0802d59 100644
--- a/xkb/xkbActions.c
+++ b/xkb/xkbActions.c
@@ -843,7 +843,7 @@ _XkbFilterRedirectKey( XkbSrvInfoPtr xkbi,
unsigned keycode,
XkbAction * pAction)
{
-unsigned realMods;
+unsigned realMods = 0;
xEvent ev;
int x,y;
XkbStateRec old;
@@ -1137,7 +1137,7 @@ void
XkbHandleActions(DeviceIntPtr dev,DeviceIntPtr kbd,xEvent *xE,int count)
{
int key,bit,i;
-CARD8 realMods;
+CARD8 realMods = 0;
XkbSrvInfoPtr xkbi;
KeyClassPtr keyc;
int changed,sendEvent;
diff --git a/xkb/xkbEvents.c b/xkb/xkbEvents.c
index 351a3280e..6389b906f 100644
--- a/xkb/xkbEvents.c
+++ b/xkb/xkbEvents.c
@@ -813,23 +813,21 @@ XkbSrvInfoPtr xkbi;
xkbi= pXDev->key->xkbInfo;
if ( pClient->xkbClientFlags & _XkbClientInitialized ) {
-#ifdef DEBUG
if ((xkbDebugFlags&0x10)&&
((xE[0].u.u.type==KeyPress)||(xE[0].u.u.type==KeyRelease)||
(xE[0].u.u.type==DeviceKeyPress)||
(xE[0].u.u.type == DeviceKeyRelease))) {
- ErrorF("[xkb] XKbFilterWriteEvents:\n");
- ErrorF("[xkb] Event state= 0x%04x\n",xE[0].u.keyButtonPointer.state);
- ErrorF("[xkb] XkbLastRepeatEvent!=xE (0x%p!=0x%p) %s\n",
+ DebugF("[xkb] XKbFilterWriteEvents:\n");
+ DebugF("[xkb] Event state= 0x%04x\n",xE[0].u.keyButtonPointer.state);
+ DebugF("[xkb] XkbLastRepeatEvent!=xE (0x%p!=0x%p) %s\n",
XkbLastRepeatEvent,xE,
((XkbLastRepeatEvent!=(pointer)xE)?"True":"False"));
- ErrorF("[xkb] (xkbClientEventsFlags&XWDA)==0 (0x%x) %s\n",
+ DebugF("[xkb] (xkbClientEventsFlags&XWDA)==0 (0x%x) %s\n",
pClient->xkbClientFlags,
(_XkbWantsDetectableAutoRepeat(pClient)?"True":"False"));
- ErrorF("[xkb] !IsRelease(%d) %s\n",xE[0].u.u.type,
+ DebugF("[xkb] !IsRelease(%d) %s\n",xE[0].u.u.type,
(!_XkbIsReleaseEvent(xE[0].u.u.type))?"True":"False");
}
-#endif /* DEBUG */
if ( (XkbLastRepeatEvent==(pointer)xE) &&
(_XkbWantsDetectableAutoRepeat(pClient)) &&
(_XkbIsReleaseEvent(xE[0].u.u.type)) ) {
@@ -867,13 +865,11 @@ XkbSrvInfoPtr xkbi;
if (xE[0].u.u.type == ButtonPress &&
((xE[0].u.keyButtonPointer.state >> 7) & button_mask) == button_mask &&
(xkbi->lockedPtrButtons & button_mask) == button_mask) {
-#ifdef DEBUG
/* If the MouseKeys is pressed, and the "real" mouse is also pressed
* when the mouse is released, the server does not behave properly.
* Faking a release of the button here solves the problem.
*/
- ErrorF("[xkb] Faking release of button %d\n", xE[0].u.u.detail);
-#endif
+ DebugF("[xkb] Faking release of button %d\n", xE[0].u.u.detail);
XkbDDXFakePointerButton(ButtonRelease, xE[0].u.u.detail);
}
}
@@ -882,21 +878,19 @@ XkbSrvInfoPtr xkbi;
for (i=0;i<nEvents;i++) {
type= xE[i].u.u.type;
-#ifdef DEBUG
if ((xkbDebugFlags&0x4)&&
((xE[i].u.u.type==KeyPress)||(xE[i].u.u.type==KeyRelease)||
(xE[i].u.u.type==DeviceKeyPress)||
(xE[i].u.u.type == DeviceKeyRelease))) {
XkbStatePtr s= &xkbi->state;
- ErrorF("[xkb] XKbFilterWriteEvents (non-XKB):\n");
- ErrorF("[xkb] event= 0x%04x\n",xE[i].u.keyButtonPointer.state);
- ErrorF("[xkb] lookup= 0x%02x, grab= 0x%02x\n",s->lookup_mods,
+ DebugF("[xkb] XKbFilterWriteEvents (non-XKB):\n");
+ DebugF("[xkb] event= 0x%04x\n",xE[i].u.keyButtonPointer.state);
+ DebugF("[xkb] lookup= 0x%02x, grab= 0x%02x\n",s->lookup_mods,
s->grab_mods);
- ErrorF("[xkb] compat lookup= 0x%02x, grab= 0x%02x\n",
+ DebugF("[xkb] compat lookup= 0x%02x, grab= 0x%02x\n",
s->compat_lookup_mods,
s->compat_grab_mods);
}
-#endif
if ( (type>=KeyPress)&&(type<=MotionNotify) ) {
CARD16 old,new;
@@ -929,16 +923,12 @@ XkbSrvInfoPtr xkbi;
if (type == ButtonPress &&
((xE[i].u.keyButtonPointer.state >> 7) & button_mask) == button_mask &&
(xkbi->lockedPtrButtons & button_mask) == button_mask) {
-#ifdef DEBUG
- ErrorF("[xkb] Faking release of button %d\n", xE[i].u.u.detail);
-#endif
+ DebugF("[xkb] Faking release of button %d\n", xE[i].u.u.detail);
XkbDDXFakePointerButton(ButtonRelease, xE[i].u.u.detail);
} else if (type == DeviceButtonPress &&
((((deviceKeyButtonPointer*)&xE[i])->state >> 7) & button_mask) == button_mask &&
(xkbi->lockedPtrButtons & button_mask) == button_mask) {
-#ifdef DEBUG
- ErrorF("[xkb] Faking release of button %d\n", ((deviceKeyButtonPointer*)&xE[i])->state);
-#endif
+ DebugF("[xkb] Faking release of button %d\n", ((deviceKeyButtonPointer*)&xE[i])->state);
XkbDDXFakePointerButton(DeviceButtonRelease, ((deviceKeyButtonPointer*)&xE[i])->state);
}
}
diff --git a/xkb/xkbInit.c b/xkb/xkbInit.c
index 0682cc44d..09317e943 100644
--- a/xkb/xkbInit.c
+++ b/xkb/xkbInit.c
@@ -48,9 +48,9 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include "property.h"
#define XKBSRV_NEED_FILE_FUNCS
#include <xkbsrv.h>
-#include <X11/extensions/XKBgeom.h>
+#include "xkbgeom.h"
#include <X11/extensions/XKMformat.h>
-#include <X11/extensions/XKBfile.h>
+#include "xkbfile.h"
#include "xkb.h"
#define CREATE_ATOM(s) MakeAtom(s,sizeof(s)-1,1)
@@ -88,7 +88,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
typedef struct _SrvXkmInfo {
DeviceIntPtr dev;
FILE * file;
- XkbFileInfo xkbinfo;
+ XkbDescPtr xkb;
} SrvXkmInfo;
@@ -125,7 +125,6 @@ typedef struct _SrvXkmInfo {
char * XkbBaseDirectory= XKB_BASE_DIRECTORY;
char * XkbBinDirectory= XKB_BIN_DIRECTORY;
static int XkbWantAccessX= 0;
-static XkbFileInfo * _XkbInitFileInfo= NULL;
static Bool rulesDefined= False;
static char * XkbRulesFile= NULL;
@@ -139,6 +138,8 @@ static char * XkbLayoutUsed= NULL;
static char * XkbVariantUsed= NULL;
static char * XkbOptionsUsed= NULL;
+static XkbDescPtr xkb_cached_map = NULL;
+
_X_EXPORT Bool noXkbExtension= XKB_DFLT_DISABLED;
static Bool XkbWantRulesProp= XKB_DFLT_RULES_PROP;
@@ -280,17 +281,14 @@ XkbSetRulesDflts(char *rulesFile,char *model,char *layout,
/***====================================================================***/
-#if defined(luna)
-#define XKB_DDX_PERMANENT_LOCK 1
-#endif
-
#include "xkbDflts.h"
static Bool
-XkbInitKeyTypes(XkbDescPtr xkb,SrvXkmInfo *file)
+XkbInitKeyTypes(XkbDescPtr xkb)
{
- if (file->xkbinfo.defined&XkmTypesMask)
- return True;
+ if (xkb->defined & XkmTypesMask)
+ return True;
+
initTypeNames(NULL);
if (XkbAllocClientMap(xkb,XkbKeyTypesMask,num_dflt_types)!=Success)
return False;
@@ -303,7 +301,7 @@ XkbInitKeyTypes(XkbDescPtr xkb,SrvXkmInfo *file)
}
static void
-XkbInitRadioGroups(XkbSrvInfoPtr xkbi,SrvXkmInfo *file)
+XkbInitRadioGroups(XkbSrvInfoPtr xkbi)
{
xkbi->nRadioGroups = 0;
xkbi->radioGroups = NULL;
@@ -312,13 +310,14 @@ XkbInitRadioGroups(XkbSrvInfoPtr xkbi,SrvXkmInfo *file)
static Status
-XkbInitCompatStructs(XkbDescPtr xkb,SrvXkmInfo *file)
+XkbInitCompatStructs(XkbDescPtr xkb)
{
register int i;
XkbCompatMapPtr compat;
- if (file->xkbinfo.defined&XkmCompatMapMask)
- return Success;
+ if (xkb->defined & XkmCompatMapMask)
+ return True;
+
if (XkbAllocCompatMap(xkb,XkbAllCompatMask,num_dfltSI)!=Success)
return BadAlloc;
compat = xkb->compat;
@@ -339,17 +338,17 @@ XkbCompatMapPtr compat;
}
static void
-XkbInitSemantics(XkbDescPtr xkb,SrvXkmInfo *file)
+XkbInitSemantics(XkbDescPtr xkb)
{
- XkbInitKeyTypes(xkb,file);
- XkbInitCompatStructs(xkb,file);
+ XkbInitKeyTypes(xkb);
+ XkbInitCompatStructs(xkb);
return;
}
/***====================================================================***/
static Status
-XkbInitNames(XkbSrvInfoPtr xkbi,SrvXkmInfo *file)
+XkbInitNames(XkbSrvInfoPtr xkbi)
{
XkbDescPtr xkb;
XkbNamesPtr names;
@@ -367,46 +366,38 @@ Atom unknown;
if (names->symbols==None) names->symbols= unknown;
if (names->types==None) names->types= unknown;
if (names->compat==None) names->compat= unknown;
- if ((file->xkbinfo.defined&XkmVirtualModsMask)==0) {
- if (names->vmods[vmod_NumLock]==None)
- names->vmods[vmod_NumLock]= CREATE_ATOM("NumLock");
- if (names->vmods[vmod_Alt]==None)
- names->vmods[vmod_Alt]= CREATE_ATOM("Alt");
- if (names->vmods[vmod_AltGr]==None)
- names->vmods[vmod_AltGr]= CREATE_ATOM("ModeSwitch");
- }
-
- if (((file->xkbinfo.defined&XkmIndicatorsMask)==0)||
- ((file->xkbinfo.defined&XkmGeometryMask)==0)) {
- initIndicatorNames(NULL,xkb);
- if (names->indicators[LED_CAPS-1]==None)
- names->indicators[LED_CAPS-1] = CREATE_ATOM("Caps Lock");
- if (names->indicators[LED_NUM-1]==None)
- names->indicators[LED_NUM-1] = CREATE_ATOM("Num Lock");
- if (names->indicators[LED_SCROLL-1]==None)
- names->indicators[LED_SCROLL-1] = CREATE_ATOM("Scroll Lock");
+ if (!(xkb->defined & XkmVirtualModsMask)) {
+ if (names->vmods[vmod_NumLock]==None)
+ names->vmods[vmod_NumLock]= CREATE_ATOM("NumLock");
+ if (names->vmods[vmod_Alt]==None)
+ names->vmods[vmod_Alt]= CREATE_ATOM("Alt");
+ if (names->vmods[vmod_AltGr]==None)
+ names->vmods[vmod_AltGr]= CREATE_ATOM("ModeSwitch");
+ }
+
+ if (!(xkb->defined & XkmIndicatorsMask)) {
+ initIndicatorNames(NULL,xkb);
+ if (names->indicators[LED_CAPS-1]==None)
+ names->indicators[LED_CAPS-1] = CREATE_ATOM("Caps Lock");
+ if (names->indicators[LED_NUM-1]==None)
+ names->indicators[LED_NUM-1] = CREATE_ATOM("Num Lock");
+ if (names->indicators[LED_SCROLL-1]==None)
+ names->indicators[LED_SCROLL-1] = CREATE_ATOM("Scroll Lock");
#ifdef LED_COMPOSE
- if (names->indicators[LED_COMPOSE-1]==None)
- names->indicators[LED_COMPOSE-1] = CREATE_ATOM("Compose");
+ if (names->indicators[LED_COMPOSE-1]==None)
+ names->indicators[LED_COMPOSE-1] = CREATE_ATOM("Compose");
#endif
}
-#ifdef DEBUG_RADIO_GROUPS
- if (names->num_rg<1) {
- names->radio_groups= (Atom *)_XkbCalloc(RG_COUNT, sizeof(Atom));
- if (names->radio_groups) {
- names->num_rg = RG_COUNT;
- names->radio_groups[RG_BOGUS_FUNCTION_GROUP]= CREATE_ATOM("BOGUS");
- }
- }
-#endif
+
if (xkb->geom!=NULL)
names->geometry= xkb->geom->name;
else names->geometry= unknown;
+
return Success;
}
static Status
-XkbInitIndicatorMap(XkbSrvInfoPtr xkbi,SrvXkmInfo *file)
+XkbInitIndicatorMap(XkbSrvInfoPtr xkbi)
{
XkbDescPtr xkb;
XkbIndicatorPtr map;
@@ -415,35 +406,36 @@ XkbSrvLedInfoPtr sli;
xkb= xkbi->desc;
if (XkbAllocIndicatorMaps(xkb)!=Success)
return BadAlloc;
- if ((file->xkbinfo.defined&XkmIndicatorsMask)==0) {
- map= xkb->indicators;
- map->phys_indicators = PHYS_LEDS;
- map->maps[LED_CAPS-1].flags= XkbIM_NoExplicit;
- map->maps[LED_CAPS-1].which_mods= XkbIM_UseLocked;
- map->maps[LED_CAPS-1].mods.mask= LockMask;
- map->maps[LED_CAPS-1].mods.real_mods= LockMask;
-
- map->maps[LED_NUM-1].flags= XkbIM_NoExplicit;
- map->maps[LED_NUM-1].which_mods= XkbIM_UseLocked;
- map->maps[LED_NUM-1].mods.mask= 0;
- map->maps[LED_NUM-1].mods.real_mods= 0;
- map->maps[LED_NUM-1].mods.vmods= vmod_NumLockMask;
-
-/* Metro Link */
- map->maps[LED_SCROLL-1].flags= XkbIM_NoExplicit;
- map->maps[LED_SCROLL-1].which_mods= XkbIM_UseLocked;
- map->maps[LED_SCROLL-1].mods.mask= Mod3Mask;
- map->maps[LED_SCROLL-1].mods.real_mods= Mod3Mask;
-/* Metro Link */
+
+ if (!(xkb->defined & XkmIndicatorsMask)) {
+ map= xkb->indicators;
+ map->phys_indicators = PHYS_LEDS;
+ map->maps[LED_CAPS-1].flags= XkbIM_NoExplicit;
+ map->maps[LED_CAPS-1].which_mods= XkbIM_UseLocked;
+ map->maps[LED_CAPS-1].mods.mask= LockMask;
+ map->maps[LED_CAPS-1].mods.real_mods= LockMask;
+
+ map->maps[LED_NUM-1].flags= XkbIM_NoExplicit;
+ map->maps[LED_NUM-1].which_mods= XkbIM_UseLocked;
+ map->maps[LED_NUM-1].mods.mask= 0;
+ map->maps[LED_NUM-1].mods.real_mods= 0;
+ map->maps[LED_NUM-1].mods.vmods= vmod_NumLockMask;
+
+ map->maps[LED_SCROLL-1].flags= XkbIM_NoExplicit;
+ map->maps[LED_SCROLL-1].which_mods= XkbIM_UseLocked;
+ map->maps[LED_SCROLL-1].mods.mask= Mod3Mask;
+ map->maps[LED_SCROLL-1].mods.real_mods= Mod3Mask;
}
+
sli= XkbFindSrvLedInfo(xkbi->device,XkbDfltXIClass,XkbDfltXIId,0);
if (sli)
XkbCheckIndicatorMaps(xkbi->device,sli,XkbAllIndicatorsMask);
+
return Success;
}
static Status
-XkbInitControls(DeviceIntPtr pXDev,XkbSrvInfoPtr xkbi,SrvXkmInfo *file)
+XkbInitControls(DeviceIntPtr pXDev,XkbSrvInfoPtr xkbi)
{
XkbDescPtr xkb;
XkbControlsPtr ctrls;
@@ -453,8 +445,8 @@ XkbControlsPtr ctrls;
if (XkbAllocControls(xkb,XkbAllControlsMask)!=Success)
FatalError("Couldn't allocate keyboard controls\n");
ctrls= xkb->ctrls;
- if ((file->xkbinfo.defined&XkmSymbolsMask)==0)
- ctrls->num_groups = 1;
+ if (!(xkb->defined & XkmSymbolsMask))
+ ctrls->num_groups = 1;
ctrls->groups_wrap = XkbSetGroupInfo(1,XkbWrapIntoRange,0);
ctrls->internal.mask = 0;
ctrls->internal.real_mods = 0;
@@ -477,29 +469,25 @@ XkbInitDevice(DeviceIntPtr pXDev)
int i;
XkbSrvInfoPtr xkbi;
XkbChangesRec changes;
-SrvXkmInfo file;
unsigned check;
XkbEventCauseRec cause;
- file.dev= pXDev;
- file.file=NULL;
- bzero(&file.xkbinfo,sizeof(XkbFileInfo));
bzero(&changes,sizeof(XkbChangesRec));
pXDev->key->xkbInfo= xkbi= _XkbTypedCalloc(1,XkbSrvInfoRec);
if ( xkbi ) {
XkbDescPtr xkb;
- if ((_XkbInitFileInfo!=NULL)&&(_XkbInitFileInfo->xkb!=NULL)) {
- file.xkbinfo= *_XkbInitFileInfo;
- xkbi->desc= _XkbInitFileInfo->xkb;
- _XkbInitFileInfo= NULL;
- }
- else {
- xkbi->desc= XkbAllocKeyboard();
- if (!xkbi->desc)
- FatalError("Couldn't allocate keyboard description\n");
- xkbi->desc->min_key_code = pXDev->key->curKeySyms.minKeyCode;
- xkbi->desc->max_key_code = pXDev->key->curKeySyms.maxKeyCode;
- }
+
+ if (xkb_cached_map) {
+ xkbi->desc = xkb_cached_map;
+ xkb_cached_map = NULL;
+ }
+ else {
+ xkbi->desc= XkbAllocKeyboard();
+ if (!xkbi->desc)
+ FatalError("Couldn't allocate keyboard description\n");
+ xkbi->desc->min_key_code = pXDev->key->curKeySyms.minKeyCode;
+ xkbi->desc->max_key_code = pXDev->key->curKeySyms.maxKeyCode;
+ }
xkb= xkbi->desc;
if (xkb->min_key_code == 0)
xkb->min_key_code = pXDev->key->curKeySyms.minKeyCode;
@@ -522,32 +510,32 @@ XkbEventCauseRec cause;
xkbi->dfltPtrDelta=1;
xkbi->device = pXDev;
- file.xkbinfo.xkb= xkb;
- XkbInitSemantics(xkb,&file);
- XkbInitNames(xkbi,&file);
- XkbInitRadioGroups(xkbi,&file);
+ XkbInitSemantics(xkb);
+ XkbInitNames(xkbi);
+ XkbInitRadioGroups(xkbi);
/* 12/31/94 (ef) -- XXX! Should check if state loaded from file */
bzero(&xkbi->state,sizeof(XkbStateRec));
- XkbInitControls(pXDev,xkbi,&file);
+ XkbInitControls(pXDev,xkbi);
- if (file.xkbinfo.defined&XkmSymbolsMask)
- memcpy(pXDev->key->modifierMap,xkb->map->modmap,xkb->max_key_code+1);
- else
- memcpy(xkb->map->modmap,pXDev->key->modifierMap,xkb->max_key_code+1);
+ if (xkb->defined & XkmSymbolsMask)
+ memcpy(pXDev->key->modifierMap, xkb->map->modmap,
+ xkb->max_key_code + 1);
+ else
+ memcpy(xkb->map->modmap, pXDev->key->modifierMap,
+ xkb->max_key_code + 1);
- XkbInitIndicatorMap(xkbi,&file);
+ XkbInitIndicatorMap(xkbi);
XkbDDXInitDevice(pXDev);
- if (!(file.xkbinfo.defined&XkmSymbolsMask)) {
- XkbUpdateKeyTypesFromCore(pXDev,xkb->min_key_code,XkbNumKeys(xkb),
- &changes);
- }
- else {
- XkbUpdateCoreDescription(pXDev,True);
- }
+ if (xkb->defined & XkmSymbolsMask)
+ XkbUpdateKeyTypesFromCore(pXDev, xkb->min_key_code,
+ XkbNumKeys(xkb), &changes);
+ else
+ XkbUpdateCoreDescription(pXDev, True);
+
XkbSetCauseUnknown(&cause);
XkbUpdateActions(pXDev,xkb->min_key_code, XkbNumKeys(xkb),&changes,
&check,&cause);
@@ -559,8 +547,6 @@ XkbEventCauseRec cause;
pXDev->key->curKeySyms.minKeyCode = xkb->min_key_code;
pXDev->key->curKeySyms.maxKeyCode = xkb->max_key_code;
}
- if (file.file!=NULL)
- fclose(file.file);
return;
}
@@ -584,12 +570,12 @@ XkbInitKeyboardDeviceStruct(
DeviceIntPtr /*device*/,
KeybdCtrl * /*ctrl*/))
{
-XkbFileInfo finfo;
KeySymsRec tmpSyms,*pSyms;
CARD8 tmpMods[XkbMaxLegalKeyCode+1],*pMods;
char name[PATH_MAX],*rules;
Bool ok=False;
XkbRF_VarDefsRec defs;
+XkbDescPtr xkb;
if ((dev->key!=NULL)||(dev->kbdfeed!=NULL))
return False;
@@ -604,7 +590,7 @@ XkbRF_VarDefsRec defs;
* generation. Eventually they will be freed at the end of this
* function.
*/
- if (names->keymap) names->keymap = _XkbDupString(names->keymap);
+ names->keymap = NULL;
if (names->keycodes) names->keycodes = _XkbDupString(names->keycodes);
if (names->types) names->types = _XkbDupString(names->types);
if (names->compat) names->compat = _XkbDupString(names->compat);
@@ -615,11 +601,6 @@ XkbRF_VarDefsRec defs;
XkbComponentNamesRec rNames;
bzero(&rNames,sizeof(XkbComponentNamesRec));
if (XkbDDXNamesFromRules(dev,rules,&defs,&rNames)) {
- if (rNames.keymap) {
- if (!names->keymap)
- names->keymap = rNames.keymap;
- else _XkbFree(rNames.keymap);
- }
if (rNames.keycodes) {
if (!names->keycodes)
names->keycodes = rNames.keycodes;
@@ -650,22 +631,12 @@ XkbRF_VarDefsRec defs;
}
}
- if (names->keymap) {
- XkbComponentNamesRec tmpNames;
- bzero(&tmpNames,sizeof(XkbComponentNamesRec));
- tmpNames.keymap = names->keymap;
- ok = (Bool) XkbDDXLoadKeymapByNames(dev,&tmpNames,XkmAllIndicesMask,0,
- &finfo,name,PATH_MAX);
- }
- if (!(ok && (finfo.xkb!=NULL)))
- ok = (Bool) XkbDDXLoadKeymapByNames(dev,names,XkmAllIndicesMask,0,
- &finfo,name,PATH_MAX);
+ ok = (Bool) XkbDDXLoadKeymapByNames(dev,names,XkmAllIndicesMask,0,
+ &xkb,name,PATH_MAX);
- if (ok && (finfo.xkb!=NULL)) {
- XkbDescPtr xkb;
+ if (ok && (xkb!=NULL)) {
KeyCode minKC,maxKC;
- xkb= finfo.xkb;
minKC= xkb->min_key_code;
maxKC= xkb->max_key_code;
if (XkbIsLegalKeycode(minKC)&&XkbIsLegalKeycode(maxKC)&&(minKC<=maxKC)&&
@@ -695,20 +666,20 @@ XkbRF_VarDefsRec defs;
pMods= tmpMods;
}
}
- _XkbInitFileInfo= &finfo;
+ /* Store the map here so we can pick it back up in XkbInitDevice.
+ * Sigh. */
+ xkb_cached_map = xkb;
}
else {
LogMessage(X_WARNING, "Couldn't load XKB keymap, falling back to pre-XKB keymap\n");
}
ok= InitKeyboardDeviceStruct((DevicePtr)dev,pSyms,pMods,bellProc,ctrlProc);
- _XkbInitFileInfo= NULL;
+ xkb_cached_map = NULL;
if ((pSyms==&tmpSyms)&&(pSyms->map!=NULL)) {
_XkbFree(pSyms->map);
pSyms->map= NULL;
}
- if (names->keymap) _XkbFree(names->keymap);
- names->keymap = NULL;
if (names->keycodes) _XkbFree(names->keycodes);
names->keycodes = NULL;
if (names->types) _XkbFree(names->types);
@@ -771,9 +742,7 @@ XkbSrvLedInfoPtr sli;
sli= XkbFindSrvLedInfo(pXDev,XkbDfltXIClass,XkbDfltXIId,0);
if (sli && xkbi)
XkbCheckIndicatorMaps(xkbi->device,sli,XkbAllIndicatorsMask);
-#ifdef DEBUG
- else ErrorF("[xkb] No indicator feedback in XkbFinishInit (shouldn't happen)!\n");
-#endif
+ else DebugF("[xkb] No indicator feedback in XkbFinishInit (shouldn't happen)!\n");
return softRepeat;
}
diff --git a/xkb/xkbPrKeyEv.c b/xkb/xkbPrKeyEv.c
index f007f75f2..74d02c608 100644
--- a/xkb/xkbPrKeyEv.c
+++ b/xkb/xkbPrKeyEv.c
@@ -56,11 +56,9 @@ int xiEvent;
xkbi= keyc->xkbInfo;
key= xE->u.u.detail;
xiEvent= (xE->u.u.type & EXTENSION_EVENT_BASE);
-#ifdef DEBUG
if (xkbDebugFlags&0x8) {
- ErrorF("[xkb] XkbPKE: Key %d %s\n",key,(xE->u.u.type==KeyPress?"down":"up"));
+ DebugF("[xkb] XkbPKE: Key %d %s\n",key,(xE->u.u.type==KeyPress?"down":"up"));
}
-#endif
if ( (xkbi->repeatKey==key) && (xE->u.u.type==KeyRelease) &&
((xkbi->desc->ctrls->enabled_ctrls&XkbRepeatKeysMask)==0) ) {
diff --git a/xkb/xkbPrOtherEv.c b/xkb/xkbPrOtherEv.c
index d65107cdc..8017903be 100644
--- a/xkb/xkbPrOtherEv.c
+++ b/xkb/xkbPrOtherEv.c
@@ -36,7 +36,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include <X11/keysym.h>
#include "misc.h"
#include "inputstr.h"
-#include <X11/extensions/XKBsrv.h>
+#include "xkbsrv.h"
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
diff --git a/xkb/xkbSwap.c b/xkb/xkbSwap.c
index bbb2a91f7..1a513b35c 100644
--- a/xkb/xkbSwap.c
+++ b/xkb/xkbSwap.c
@@ -36,7 +36,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include "misc.h"
#include "inputstr.h"
#include <xkbsrv.h>
-#include <X11/extensions/XKBstr.h>
+#include "xkbstr.h"
#include "extnsionst.h"
#include "xkb.h"
diff --git a/xkb/xkbUtils.c b/xkb/xkbUtils.c
index 91aee18c4..045b962d4 100644
--- a/xkb/xkbUtils.c
+++ b/xkb/xkbUtils.c
@@ -42,7 +42,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#define XKBSRV_NEED_FILE_FUNCS
#include <xkbsrv.h>
-#include <X11/extensions/XKBgeom.h>
+#include "xkbgeom.h"
#include "xkb.h"
int XkbDisableLockActions = 0;
@@ -211,16 +211,6 @@ KeySym tsyms[XkbMaxSymsPerKey],*syms;
XkbMapChangesPtr mc;
xkb= pXDev->key->xkbInfo->desc;
-#ifdef NOTYET
- if (first<xkb->min_key_code) {
- if (first>=XkbMinLegalKeyCode) {
- xkb->min_key_code= first;
- /* 1/12/95 (ef) -- XXX! should zero out the new maps */
- changes->map.changed|= XkbKeycodesMask;
-/* generate a NewKeyboard notify here? */
- }
- }
-#endif
if (first+num-1>xkb->max_key_code) {
/* 1/12/95 (ef) -- XXX! should allow XKB structures to grow */
num= xkb->max_key_code-first+1;
@@ -1519,10 +1509,12 @@ XkbCopyKeymap(XkbDescPtr src, XkbDescPtr dst, Bool sendNotifies)
/* properties */
if (src->geom->num_properties) {
if (src->geom->num_properties != dst->geom->sz_properties) {
+ /* If we've got more properties in the destination than
+ * the source, run through and free all the excess ones
+ * first. */
if (src->geom->num_properties < dst->geom->sz_properties) {
for (i = src->geom->num_properties,
- dprop = dst->geom->properties +
- src->geom->num_properties;
+ dprop = dst->geom->properties + i;
i < dst->geom->num_properties;
i++, dprop++) {
xfree(dprop->name);
@@ -1542,6 +1534,8 @@ XkbCopyKeymap(XkbDescPtr src, XkbDescPtr dst, Bool sendNotifies)
dst->geom->properties = tmp;
}
+ /* We don't set num_properties as we need it to try and avoid
+ * too much reallocing. */
dst->geom->sz_properties = src->geom->num_properties;
if (dst->geom->sz_properties > dst->geom->num_properties) {
@@ -1577,6 +1571,7 @@ XkbCopyKeymap(XkbDescPtr src, XkbDescPtr dst, Bool sendNotifies)
}
}
+ /* ... which is already src->geom->num_properties. */
dst->geom->num_properties = dst->geom->sz_properties;
}
else {
@@ -1600,8 +1595,7 @@ XkbCopyKeymap(XkbDescPtr src, XkbDescPtr dst, Bool sendNotifies)
if (src->geom->num_colors != dst->geom->sz_colors) {
if (src->geom->num_colors < dst->geom->sz_colors) {
for (i = src->geom->num_colors,
- dcolor = dst->geom->colors +
- src->geom->num_colors;
+ dcolor = dst->geom->colors + i;
i < dst->geom->num_colors;
i++, dcolor++) {
xfree(dcolor->spec);
@@ -1719,7 +1713,7 @@ XkbCopyKeymap(XkbDescPtr src, XkbDescPtr dst, Bool sendNotifies)
}
doutline->num_points = soutline->num_points;
- doutline->sz_points = soutline->sz_points;
+ doutline->sz_points = soutline->num_points;
}
}
@@ -1798,6 +1792,7 @@ XkbCopyKeymap(XkbDescPtr src, XkbDescPtr dst, Bool sendNotifies)
memset(tmp, 0, src->geom->num_sections * sizeof(XkbSectionRec));
dst->geom->sections = tmp;
dst->geom->num_sections = src->geom->num_sections;
+ dst->geom->sz_sections = src->geom->num_sections;
for (i = 0,
ssection = src->geom->sections,
@@ -1811,6 +1806,8 @@ XkbCopyKeymap(XkbDescPtr src, XkbDescPtr dst, Bool sendNotifies)
dsection->rows = tmp;
}
dsection->num_rows = ssection->num_rows;
+ dsection->sz_rows = ssection->num_rows;
+
for (j = 0, srow = ssection->rows, drow = dsection->rows;
j < ssection->num_rows;
j++, srow++, drow++) {
diff --git a/xkb/xkberrs.c b/xkb/xkberrs.c
deleted file mode 100644
index 3534356c6..000000000
--- a/xkb/xkberrs.c
+++ /dev/null
@@ -1,37 +0,0 @@
-/************************************************************
- Copyright (c) 1994 by Silicon Graphics Computer Systems, Inc.
-
- Permission to use, copy, modify, and distribute this
- software and its documentation for any purpose and without
- fee is hereby granted, provided that the above copyright
- notice appear in all copies and that both that copyright
- notice and this permission notice appear in supporting
- documentation, and that the name of Silicon Graphics not be
- used in advertising or publicity pertaining to distribution
- of the software without specific prior written permission.
- Silicon Graphics makes no representation about the suitability
- of this software for any purpose. It is provided "as is"
- without any express or implied warranty.
-
- SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
- SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
- GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
- DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
- OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
- THE USE OR PERFORMANCE OF THIS SOFTWARE.
-
- ********************************************************/
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <stdio.h>
-#include <ctype.h>
-#include <stdlib.h>
-
-unsigned _XkbErrCode;
-char * _XkbErrLocation= NULL;
-unsigned _XkbErrData;
diff --git a/xkb/xkbfmisc.c b/xkb/xkbfmisc.c
index 05344b475..866b4b154 100644
--- a/xkb/xkbfmisc.c
+++ b/xkb/xkbfmisc.c
@@ -42,10 +42,10 @@
#include "misc.h"
#include "inputstr.h"
#include "dix.h"
-#include <X11/extensions/XKBstr.h>
+#include "xkbstr.h"
#define XKBSRV_NEED_FILE_FUNCS 1
#include <xkbsrv.h>
-#include <X11/extensions/XKBgeom.h>
+#include "xkbgeom.h"
#include "xkb.h"
unsigned
@@ -146,7 +146,7 @@ XkbWriteSectionFromName(FILE *file,char *sectionName,char *name)
/* ARGSUSED */
static void
_AddIncl( FILE * file,
- XkbFileInfo * result,
+ XkbDescPtr xkb,
Bool topLevel,
Bool showImplicit,
int index,
@@ -160,7 +160,6 @@ _AddIncl( FILE * file,
Bool
XkbWriteXKBKeymapForNames( FILE * file,
XkbComponentNamesPtr names,
- Display * dpy,
XkbDescPtr xkb,
unsigned want,
unsigned need)
@@ -170,9 +169,6 @@ unsigned complete;
XkbNamesPtr old_names;
int multi_section;
unsigned wantNames,wantConfig,wantDflts;
-XkbFileInfo finfo;
-
- bzero(&finfo,sizeof(XkbFileInfo));
complete= 0;
if ((name=names->keymap)==NULL) name= "default";
@@ -188,14 +184,8 @@ XkbFileInfo finfo;
if (want==0)
return False;
- if (xkb!=NULL) {
+ if (xkb!=NULL)
old_names= xkb->names;
- finfo.type= 0;
- finfo.defined= 0;
- finfo.xkb= xkb;
- if (!XkbDetermineFileType(&finfo,XkbXKBFile,NULL))
- return False;
- }
else old_names= NULL;
wantConfig= want&(~complete);
@@ -233,7 +223,7 @@ XkbFileInfo finfo;
if ((xkb!=NULL) && (old_names!=NULL)) {
if (wantNames&XkmTypesMask) {
if (old_names->types!=None) {
- tmp= XkbAtomGetString(dpy,old_names->types);
+ tmp= XkbAtomGetString(old_names->types);
names->types= _XkbDupString(tmp);
}
else {
@@ -243,7 +233,7 @@ XkbFileInfo finfo;
}
if (wantNames&XkmCompatMapMask) {
if (old_names->compat!=None) {
- tmp= XkbAtomGetString(dpy,old_names->compat);
+ tmp= XkbAtomGetString(old_names->compat);
names->compat= _XkbDupString(tmp);
}
else wantDflts|= XkmCompatMapMask;
@@ -252,13 +242,13 @@ XkbFileInfo finfo;
if (wantNames&XkmSymbolsMask) {
if (old_names->symbols==None)
return False;
- tmp= XkbAtomGetString(dpy,old_names->symbols);
+ tmp= XkbAtomGetString(old_names->symbols);
names->symbols= _XkbDupString(tmp);
complete|= XkmSymbolsMask;
}
if (wantNames&XkmKeyNamesMask) {
if (old_names->keycodes!=None) {
- tmp= XkbAtomGetString(dpy,old_names->keycodes);
+ tmp= XkbAtomGetString(old_names->keycodes);
names->keycodes= _XkbDupString(tmp);
}
else wantDflts|= XkmKeyNamesMask;
@@ -267,7 +257,7 @@ XkbFileInfo finfo;
if (wantNames&XkmGeometryMask) {
if (old_names->geometry==None)
return False;
- tmp= XkbAtomGetString(dpy,old_names->geometry);
+ tmp= XkbAtomGetString(old_names->geometry);
names->geometry= _XkbDupString(tmp);
complete|= XkmGeometryMask;
wantNames&= ~XkmGeometryMask;
@@ -305,7 +295,7 @@ XkbFileInfo finfo;
wantNames= complete&(~(wantConfig|wantDflts));
name= names->keycodes;
if (wantConfig&XkmKeyNamesMask)
- XkbWriteXKBKeycodes(file,&finfo,False,False,_AddIncl,name);
+ XkbWriteXKBKeycodes(file,xkb,False,False,_AddIncl,name);
else if (wantDflts&XkmKeyNamesMask)
fprintf(stderr,"Default symbols not implemented yet!\n");
else if (wantNames&XkmKeyNamesMask)
@@ -313,7 +303,7 @@ XkbFileInfo finfo;
name= names->types;
if (wantConfig&XkmTypesMask)
- XkbWriteXKBKeyTypes(file,&finfo,False,False,_AddIncl,name);
+ XkbWriteXKBKeyTypes(file,xkb,False,False,_AddIncl,name);
else if (wantDflts&XkmTypesMask)
fprintf(stderr,"Default types not implemented yet!\n");
else if (wantNames&XkmTypesMask)
@@ -321,7 +311,7 @@ XkbFileInfo finfo;
name= names->compat;
if (wantConfig&XkmCompatMapMask)
- XkbWriteXKBCompatMap(file,&finfo,False,False,_AddIncl,name);
+ XkbWriteXKBCompatMap(file,xkb,False,False,_AddIncl,name);
else if (wantDflts&XkmCompatMapMask)
fprintf(stderr,"Default interps not implemented yet!\n");
else if (wantNames&XkmCompatMapMask)
@@ -329,13 +319,13 @@ XkbFileInfo finfo;
name= names->symbols;
if (wantConfig&XkmSymbolsMask)
- XkbWriteXKBSymbols(file,&finfo,False,False,_AddIncl,name);
+ XkbWriteXKBSymbols(file,xkb,False,False,_AddIncl,name);
else if (wantNames&XkmSymbolsMask)
XkbWriteSectionFromName(file,"symbols",name);
name= names->geometry;
if (wantConfig&XkmGeometryMask)
- XkbWriteXKBGeometry(file,&finfo,False,False,_AddIncl,name);
+ XkbWriteXKBGeometry(file,xkb,False,False,_AddIncl,name);
else if (wantNames&XkmGeometryMask)
XkbWriteSectionFromName(file,"geometry",name);
@@ -405,81 +395,6 @@ unsigned rtrn;
return rtrn;
}
-Bool
-XkbDetermineFileType(XkbFileInfoPtr finfo,int format,int *opts_missing)
-{
-unsigned present;
-XkbDescPtr xkb;
-
- if ((!finfo)||(!finfo->xkb))
- return False;
- if (opts_missing)
- *opts_missing= 0;
- xkb= finfo->xkb;
- present= 0;
- if ((xkb->names)&&(xkb->names->keys)) present|= XkmKeyNamesMask;
- if ((xkb->map)&&(xkb->map->types)) present|= XkmTypesMask;
- if (xkb->compat) present|= XkmCompatMapMask;
- if ((xkb->map)&&(xkb->map->num_syms>1)) present|= XkmSymbolsMask;
- if (xkb->indicators) present|= XkmIndicatorsMask;
- if (xkb->geom) present|= XkmGeometryMask;
- if (!present)
- return False;
- else switch (present) {
- case XkmKeyNamesMask:
- finfo->type= XkmKeyNamesIndex;
- finfo->defined= present;
- return True;
- case XkmTypesMask:
- finfo->type= XkmTypesIndex;
- finfo->defined= present;
- return True;
- case XkmCompatMapMask:
- finfo->type= XkmCompatMapIndex;
- finfo->defined= present;
- return True;
- case XkmSymbolsMask:
- if (format!=XkbXKMFile) {
- finfo->type= XkmSymbolsIndex;
- finfo->defined= present;
- return True;
- }
- break;
- case XkmGeometryMask:
- finfo->type= XkmGeometryIndex;
- finfo->defined= present;
- return True;
- }
- if ((present&(~XkmSemanticsLegal))==0) {
- if ((XkmSemanticsRequired&present)==XkmSemanticsRequired) {
- if (opts_missing)
- *opts_missing= XkmSemanticsOptional&(~present);
- finfo->type= XkmSemanticsFile;
- finfo->defined= present;
- return True;
- }
- }
- else if ((present&(~XkmLayoutLegal))==0) {
- if ((XkmLayoutRequired&present)==XkmLayoutRequired) {
- if (opts_missing)
- *opts_missing= XkmLayoutOptional&(~present);
- finfo->type= XkmLayoutFile;
- finfo->defined= present;
- return True;
- }
- }
- else if ((present&(~XkmKeymapLegal))==0) {
- if ((XkmKeymapRequired&present)==XkmKeymapRequired) {
- if (opts_missing)
- *opts_missing= XkmKeymapOptional&(~present);
- finfo->type= XkmKeymapFile;
- finfo->defined= present;
- return True;
- }
- }
- return False;
-}
-
/* all latin-1 alphanumerics, plus parens, slash, minus, underscore and */
/* wildcards */
diff --git a/xkb/xkbgeom.h b/xkb/xkbgeom.h
new file mode 100644
index 000000000..173affee9
--- /dev/null
+++ b/xkb/xkbgeom.h
@@ -0,0 +1,635 @@
+/************************************************************
+Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc.
+
+Permission to use, copy, modify, and distribute this
+software and its documentation for any purpose and without
+fee is hereby granted, provided that the above copyright
+notice appear in all copies and that both that copyright
+notice and this permission notice appear in supporting
+documentation, and that the name of Silicon Graphics not be
+used in advertising or publicity pertaining to distribution
+of the software without specific prior written permission.
+Silicon Graphics makes no representation about the suitability
+of this software for any purpose. It is provided "as is"
+without any express or implied warranty.
+
+SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
+SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
+GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
+THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+********************************************************/
+
+#ifndef _XKBGEOM_H_
+#define _XKBGEOM_H_
+
+#include "xkbstr.h"
+
+#define XkbAddGeomKeyAlias SrvXkbAddGeomKeyAlias
+#define XkbAddGeomColor SrvXkbAddGeomColor
+#define XkbAddGeomDoodad SrvXkbAddGeomDoodad
+#define XkbAddGeomKey SrvXkbAddGeomKey
+#define XkbAddGeomOutline SrvXkbAddGeomOutline
+#define XkbAddGeomOverlay SrvXkbAddGeomOverlay
+#define XkbAddGeomOverlayRow SrvXkbAddGeomOverlayRow
+#define XkbAddGeomOverlayKey SrvXkbAddGeomOverlayKey
+#define XkbAddGeomProperty SrvXkbAddGeomProperty
+#define XkbAddGeomRow SrvXkbAddGeomRow
+#define XkbAddGeomSection SrvXkbAddGeomSection
+#define XkbAddGeomShape SrvXkbAddGeomShape
+#define XkbAllocGeomKeyAliases SrvXkbAllocGeomKeyAliases
+#define XkbAllocGeomColors SrvXkbAllocGeomColors
+#define XkbAllocGeomDoodads SrvXkbAllocGeomDoodads
+#define XkbAllocGeomKeys SrvXkbAllocGeomKeys
+#define XkbAllocGeomOutlines SrvXkbAllocGeomOutlines
+#define XkbAllocGeomPoints SrvXkbAllocGeomPoints
+#define XkbAllocGeomProps SrvXkbAllocGeomProps
+#define XkbAllocGeomRows SrvXkbAllocGeomRows
+#define XkbAllocGeomSectionDoodads SrvXkbAllocGeomSectionDoodads
+#define XkbAllocGeomSections SrvXkbAllocGeomSections
+#define XkbAllocGeomOverlays SrvXkbAllocGeomOverlays
+#define XkbAllocGeomOverlayRows SrvXkbAllocGeomOverlayRows
+#define XkbAllocGeomOverlayKeys SrvXkbAllocGeomOverlayKeys
+#define XkbAllocGeomShapes SrvXkbAllocGeomShapes
+#define XkbAllocGeometry SrvXkbAllocGeometry
+#define XkbFreeGeomKeyAliases SrvXkbFreeGeomKeyAliases
+#define XkbFreeGeomColors SrvXkbFreeGeomColors
+#define XkbFreeGeomDoodads SrvXkbFreeGeomDoodads
+#define XkbFreeGeomProperties SrvXkbFreeGeomProperties
+#define XkbFreeGeomOverlayKeys SrvXkbFreeGeomOverlayKeys
+#define XkbFreeGeomOverlayRows SrvXkbFreeGeomOverlayRows
+#define XkbFreeGeomOverlays SrvXkbFreeGeomOverlays
+#define XkbFreeGeomKeys SrvXkbFreeGeomKeys
+#define XkbFreeGeomRows SrvXkbFreeGeomRows
+#define XkbFreeGeomSections SrvXkbFreeGeomSections
+#define XkbFreeGeomPoints SrvXkbFreeGeomPoints
+#define XkbFreeGeomOutlines SrvXkbFreeGeomOutlines
+#define XkbFreeGeomShapes SrvXkbFreeGeomShapes
+#define XkbFreeGeometry SrvXkbFreeGeometry
+
+typedef struct _XkbProperty {
+ char *name;
+ char *value;
+} XkbPropertyRec,*XkbPropertyPtr;
+
+typedef struct _XkbColor {
+ unsigned int pixel;
+ char * spec;
+} XkbColorRec,*XkbColorPtr;
+
+typedef struct _XkbPoint {
+ short x;
+ short y;
+} XkbPointRec, *XkbPointPtr;
+
+typedef struct _XkbBounds {
+ short x1,y1;
+ short x2,y2;
+} XkbBoundsRec, *XkbBoundsPtr;
+#define XkbBoundsWidth(b) (((b)->x2)-((b)->x1))
+#define XkbBoundsHeight(b) (((b)->y2)-((b)->y1))
+
+typedef struct _XkbOutline {
+ unsigned short num_points;
+ unsigned short sz_points;
+ unsigned short corner_radius;
+ XkbPointPtr points;
+} XkbOutlineRec, *XkbOutlinePtr;
+
+typedef struct _XkbShape {
+ Atom name;
+ unsigned short num_outlines;
+ unsigned short sz_outlines;
+ XkbOutlinePtr outlines;
+ XkbOutlinePtr approx;
+ XkbOutlinePtr primary;
+ XkbBoundsRec bounds;
+} XkbShapeRec, *XkbShapePtr;
+#define XkbOutlineIndex(s,o) ((int)((o)-&(s)->outlines[0]))
+
+typedef struct _XkbShapeDoodad {
+ Atom name;
+ unsigned char type;
+ unsigned char priority;
+ short top;
+ short left;
+ short angle;
+ unsigned short color_ndx;
+ unsigned short shape_ndx;
+} XkbShapeDoodadRec, *XkbShapeDoodadPtr;
+#define XkbShapeDoodadColor(g,d) (&(g)->colors[(d)->color_ndx])
+#define XkbShapeDoodadShape(g,d) (&(g)->shapes[(d)->shape_ndx])
+#define XkbSetShapeDoodadColor(g,d,c) ((d)->color_ndx= (c)-&(g)->colors[0])
+#define XkbSetShapeDoodadShape(g,d,s) ((d)->shape_ndx= (s)-&(g)->shapes[0])
+
+typedef struct _XkbTextDoodad {
+ Atom name;
+ unsigned char type;
+ unsigned char priority;
+ short top;
+ short left;
+ short angle;
+ short width;
+ short height;
+ unsigned short color_ndx;
+ char * text;
+ char * font;
+} XkbTextDoodadRec, *XkbTextDoodadPtr;
+#define XkbTextDoodadColor(g,d) (&(g)->colors[(d)->color_ndx])
+#define XkbSetTextDoodadColor(g,d,c) ((d)->color_ndx= (c)-&(g)->colors[0])
+
+typedef struct _XkbIndicatorDoodad {
+ Atom name;
+ unsigned char type;
+ unsigned char priority;
+ short top;
+ short left;
+ short angle;
+ unsigned short shape_ndx;
+ unsigned short on_color_ndx;
+ unsigned short off_color_ndx;
+} XkbIndicatorDoodadRec, *XkbIndicatorDoodadPtr;
+#define XkbIndicatorDoodadShape(g,d) (&(g)->shapes[(d)->shape_ndx])
+#define XkbIndicatorDoodadOnColor(g,d) (&(g)->colors[(d)->on_color_ndx])
+#define XkbIndicatorDoodadOffColor(g,d) (&(g)->colors[(d)->off_color_ndx])
+#define XkbSetIndicatorDoodadOnColor(g,d,c) \
+ ((d)->on_color_ndx= (c)-&(g)->colors[0])
+#define XkbSetIndicatorDoodadOffColor(g,d,c) \
+ ((d)->off_color_ndx= (c)-&(g)->colors[0])
+#define XkbSetIndicatorDoodadShape(g,d,s) \
+ ((d)->shape_ndx= (s)-&(g)->shapes[0])
+
+typedef struct _XkbLogoDoodad {
+ Atom name;
+ unsigned char type;
+ unsigned char priority;
+ short top;
+ short left;
+ short angle;
+ unsigned short color_ndx;
+ unsigned short shape_ndx;
+ char * logo_name;
+} XkbLogoDoodadRec, *XkbLogoDoodadPtr;
+#define XkbLogoDoodadColor(g,d) (&(g)->colors[(d)->color_ndx])
+#define XkbLogoDoodadShape(g,d) (&(g)->shapes[(d)->shape_ndx])
+#define XkbSetLogoDoodadColor(g,d,c) ((d)->color_ndx= (c)-&(g)->colors[0])
+#define XkbSetLogoDoodadShape(g,d,s) ((d)->shape_ndx= (s)-&(g)->shapes[0])
+
+typedef struct _XkbAnyDoodad {
+ Atom name;
+ unsigned char type;
+ unsigned char priority;
+ short top;
+ short left;
+ short angle;
+} XkbAnyDoodadRec, *XkbAnyDoodadPtr;
+
+typedef union _XkbDoodad {
+ XkbAnyDoodadRec any;
+ XkbShapeDoodadRec shape;
+ XkbTextDoodadRec text;
+ XkbIndicatorDoodadRec indicator;
+ XkbLogoDoodadRec logo;
+} XkbDoodadRec, *XkbDoodadPtr;
+
+#define XkbUnknownDoodad 0
+#define XkbOutlineDoodad 1
+#define XkbSolidDoodad 2
+#define XkbTextDoodad 3
+#define XkbIndicatorDoodad 4
+#define XkbLogoDoodad 5
+
+typedef struct _XkbKey {
+ XkbKeyNameRec name;
+ short gap;
+ unsigned char shape_ndx;
+ unsigned char color_ndx;
+} XkbKeyRec, *XkbKeyPtr;
+#define XkbKeyShape(g,k) (&(g)->shapes[(k)->shape_ndx])
+#define XkbKeyColor(g,k) (&(g)->colors[(k)->color_ndx])
+#define XkbSetKeyShape(g,k,s) ((k)->shape_ndx= (s)-&(g)->shapes[0])
+#define XkbSetKeyColor(g,k,c) ((k)->color_ndx= (c)-&(g)->colors[0])
+
+typedef struct _XkbRow {
+ short top;
+ short left;
+ unsigned short num_keys;
+ unsigned short sz_keys;
+ int vertical;
+ XkbKeyPtr keys;
+ XkbBoundsRec bounds;
+} XkbRowRec, *XkbRowPtr;
+
+typedef struct _XkbSection {
+ Atom name;
+ unsigned char priority;
+ short top;
+ short left;
+ unsigned short width;
+ unsigned short height;
+ short angle;
+ unsigned short num_rows;
+ unsigned short num_doodads;
+ unsigned short num_overlays;
+ unsigned short sz_rows;
+ unsigned short sz_doodads;
+ unsigned short sz_overlays;
+ XkbRowPtr rows;
+ XkbDoodadPtr doodads;
+ XkbBoundsRec bounds;
+ struct _XkbOverlay *overlays;
+} XkbSectionRec, *XkbSectionPtr;
+
+typedef struct _XkbOverlayKey {
+ XkbKeyNameRec over;
+ XkbKeyNameRec under;
+} XkbOverlayKeyRec,*XkbOverlayKeyPtr;
+
+typedef struct _XkbOverlayRow {
+ unsigned short row_under;
+ unsigned short num_keys;
+ unsigned short sz_keys;
+ XkbOverlayKeyPtr keys;
+} XkbOverlayRowRec,*XkbOverlayRowPtr;
+
+typedef struct _XkbOverlay {
+ Atom name;
+ XkbSectionPtr section_under;
+ unsigned short num_rows;
+ unsigned short sz_rows;
+ XkbOverlayRowPtr rows;
+ XkbBoundsPtr bounds;
+} XkbOverlayRec,*XkbOverlayPtr;
+
+typedef struct _XkbGeometry {
+ Atom name;
+ unsigned short width_mm;
+ unsigned short height_mm;
+ char * label_font;
+ XkbColorPtr label_color;
+ XkbColorPtr base_color;
+ unsigned short sz_properties;
+ unsigned short sz_colors;
+ unsigned short sz_shapes;
+ unsigned short sz_sections;
+ unsigned short sz_doodads;
+ unsigned short sz_key_aliases;
+ unsigned short num_properties;
+ unsigned short num_colors;
+ unsigned short num_shapes;
+ unsigned short num_sections;
+ unsigned short num_doodads;
+ unsigned short num_key_aliases;
+ XkbPropertyPtr properties;
+ XkbColorPtr colors;
+ XkbShapePtr shapes;
+ XkbSectionPtr sections;
+ XkbDoodadPtr doodads;
+ XkbKeyAliasPtr key_aliases;
+} XkbGeometryRec;
+#define XkbGeomColorIndex(g,c) ((int)((c)-&(g)->colors[0]))
+
+#define XkbGeomPropertiesMask (1<<0)
+#define XkbGeomColorsMask (1<<1)
+#define XkbGeomShapesMask (1<<2)
+#define XkbGeomSectionsMask (1<<3)
+#define XkbGeomDoodadsMask (1<<4)
+#define XkbGeomKeyAliasesMask (1<<5)
+#define XkbGeomAllMask (0x3f)
+
+typedef struct _XkbGeometrySizes {
+ unsigned int which;
+ unsigned short num_properties;
+ unsigned short num_colors;
+ unsigned short num_shapes;
+ unsigned short num_sections;
+ unsigned short num_doodads;
+ unsigned short num_key_aliases;
+} XkbGeometrySizesRec,*XkbGeometrySizesPtr;
+
+_XFUNCPROTOBEGIN
+
+extern XkbPropertyPtr
+XkbAddGeomProperty(
+ XkbGeometryPtr /* geom */,
+ char * /* name */,
+ char * /* value */
+);
+
+extern XkbKeyAliasPtr
+XkbAddGeomKeyAlias(
+ XkbGeometryPtr /* geom */,
+ char * /* alias */,
+ char * /* real */
+);
+
+extern XkbColorPtr
+XkbAddGeomColor(
+ XkbGeometryPtr /* geom */,
+ char * /* spec */,
+ unsigned int /* pixel */
+);
+
+extern XkbOutlinePtr
+XkbAddGeomOutline(
+ XkbShapePtr /* shape */,
+ int /* sz_points */
+);
+
+extern XkbShapePtr
+XkbAddGeomShape(
+ XkbGeometryPtr /* geom */,
+ Atom /* name */,
+ int /* sz_outlines */
+);
+
+extern XkbKeyPtr
+XkbAddGeomKey(
+ XkbRowPtr /* row */
+);
+
+extern XkbRowPtr
+XkbAddGeomRow(
+ XkbSectionPtr /* section */,
+ int /* sz_keys */
+);
+
+extern XkbSectionPtr
+XkbAddGeomSection(
+ XkbGeometryPtr /* geom */,
+ Atom /* name */,
+ int /* sz_rows */,
+ int /* sz_doodads */,
+ int /* sz_overlays */
+);
+
+extern XkbOverlayPtr
+XkbAddGeomOverlay(
+ XkbSectionPtr /* section */,
+ Atom /* name */,
+ int /* sz_rows */
+);
+
+extern XkbOverlayRowPtr
+XkbAddGeomOverlayRow(
+ XkbOverlayPtr /* overlay */,
+ int /* row_under */,
+ int /* sz_keys */
+);
+
+extern XkbOverlayKeyPtr
+XkbAddGeomOverlayKey(
+ XkbOverlayPtr /* overlay */,
+ XkbOverlayRowPtr /* row */,
+ char * /* over */,
+ char * /* under */
+);
+
+extern XkbDoodadPtr
+XkbAddGeomDoodad(
+ XkbGeometryPtr /* geom */,
+ XkbSectionPtr /* section */,
+ Atom /* name */
+);
+
+
+extern void
+XkbFreeGeomKeyAliases(
+ XkbGeometryPtr /* geom */,
+ int /* first */,
+ int /* count */,
+ Bool /* freeAll */
+);
+
+extern void
+XkbFreeGeomColors(
+ XkbGeometryPtr /* geom */,
+ int /* first */,
+ int /* count */,
+ Bool /* freeAll */
+);
+
+extern void
+XkbFreeGeomDoodads(
+ XkbDoodadPtr /* doodads */,
+ int /* nDoodads */,
+ Bool /* freeAll */
+);
+
+
+extern void
+XkbFreeGeomProperties(
+ XkbGeometryPtr /* geom */,
+ int /* first */,
+ int /* count */,
+ Bool /* freeAll */
+);
+
+extern void
+XkbFreeGeomOverlayKeys(
+ XkbOverlayRowPtr /* row */,
+ int /* first */,
+ int /* count */,
+ Bool /* freeAll */
+);
+
+extern void
+XkbFreeGeomOverlayRows(
+ XkbOverlayPtr /* overlay */,
+ int /* first */,
+ int /* count */,
+ Bool /* freeAll */
+);
+
+extern void
+XkbFreeGeomOverlays(
+ XkbSectionPtr /* section */,
+ int /* first */,
+ int /* count */,
+ Bool /* freeAll */
+);
+
+extern void
+XkbFreeGeomKeys(
+ XkbRowPtr /* row */,
+ int /* first */,
+ int /* count */,
+ Bool /* freeAll */
+);
+
+extern void
+XkbFreeGeomRows(
+ XkbSectionPtr /* section */,
+ int /* first */,
+ int /* count */,
+ Bool /* freeAll */
+);
+
+extern void
+XkbFreeGeomSections(
+ XkbGeometryPtr /* geom */,
+ int /* first */,
+ int /* count */,
+ Bool /* freeAll */
+);
+
+
+extern void
+XkbFreeGeomPoints(
+ XkbOutlinePtr /* outline */,
+ int /* first */,
+ int /* count */,
+ Bool /* freeAll */
+);
+
+extern void
+XkbFreeGeomOutlines(
+ XkbShapePtr /* shape */,
+ int /* first */,
+ int /* count */,
+ Bool /* freeAll */
+);
+
+extern void
+XkbFreeGeomShapes(
+ XkbGeometryPtr /* geom */,
+ int /* first */,
+ int /* count */,
+ Bool /* freeAll */
+);
+
+extern void
+XkbFreeGeometry(
+ XkbGeometryPtr /* geom */,
+ unsigned int /* which */,
+ Bool /* freeMap */
+);
+
+extern Status
+XkbAllocGeomProps(
+ XkbGeometryPtr /* geom */,
+ int /* nProps */
+);
+
+extern Status
+XkbAllocGeomKeyAliases(
+ XkbGeometryPtr /* geom */,
+ int /* nAliases */
+);
+
+extern Status
+XkbAllocGeomColors(
+ XkbGeometryPtr /* geom */,
+ int /* nColors */
+);
+
+extern Status
+XkbAllocGeomShapes(
+ XkbGeometryPtr /* geom */,
+ int /* nShapes */
+);
+
+extern Status
+XkbAllocGeomSections(
+ XkbGeometryPtr /* geom */,
+ int /* nSections */
+);
+
+extern Status
+XkbAllocGeomOverlays(
+ XkbSectionPtr /* section */,
+ int /* num_needed */
+);
+
+extern Status
+XkbAllocGeomOverlayRows(
+ XkbOverlayPtr /* overlay */,
+ int /* num_needed */
+);
+
+extern Status
+XkbAllocGeomOverlayKeys(
+ XkbOverlayRowPtr /* row */,
+ int /* num_needed */
+);
+
+extern Status
+XkbAllocGeomDoodads(
+ XkbGeometryPtr /* geom */,
+ int /* nDoodads */
+);
+
+extern Status
+XkbAllocGeomSectionDoodads(
+ XkbSectionPtr /* section */,
+ int /* nDoodads */
+);
+
+extern Status
+XkbAllocGeomOutlines(
+ XkbShapePtr /* shape */,
+ int /* nOL */
+);
+
+extern Status
+XkbAllocGeomRows(
+ XkbSectionPtr /* section */,
+ int /* nRows */
+);
+
+extern Status
+XkbAllocGeomPoints(
+ XkbOutlinePtr /* ol */,
+ int /* nPts */
+);
+
+extern Status
+XkbAllocGeomKeys(
+ XkbRowPtr /* row */,
+ int /* nKeys */
+);
+
+extern Status
+XkbAllocGeometry(
+ XkbDescPtr /* xkb */,
+ XkbGeometrySizesPtr /* sizes */
+);
+
+extern Bool
+XkbComputeShapeTop(
+ XkbShapePtr /* shape */,
+ XkbBoundsPtr /* bounds */
+);
+
+extern Bool
+XkbComputeShapeBounds(
+ XkbShapePtr /* shape */
+);
+
+extern Bool
+XkbComputeRowBounds(
+ XkbGeometryPtr /* geom */,
+ XkbSectionPtr /* section */,
+ XkbRowPtr /* row */
+);
+
+extern Bool
+XkbComputeSectionBounds(
+ XkbGeometryPtr /* geom */,
+ XkbSectionPtr /* section */
+);
+
+extern char *
+XkbFindOverlayForKey(
+ XkbGeometryPtr /* geom */,
+ XkbSectionPtr /* wanted */,
+ char * /* under */
+);
+
+_XFUNCPROTOEND
+
+#endif /* _XKBGEOM_H_ */
diff --git a/xkb/xkbout.c b/xkb/xkbout.c
index 8905ef4d3..229cc9258 100644
--- a/xkb/xkbout.c
+++ b/xkb/xkbout.c
@@ -40,19 +40,19 @@
#include "misc.h"
#include "inputstr.h"
#include "dix.h"
-#include <X11/extensions/XKBstr.h>
+#include "xkbstr.h"
#define XKBSRV_NEED_FILE_FUNCS 1
#include <xkbsrv.h>
-#include <X11/extensions/XKBgeom.h>
-#include <X11/extensions/XKBfile.h>
+#include "xkbgeom.h"
+#include "xkbfile.h"
#define VMOD_HIDE_VALUE 0
#define VMOD_SHOW_VALUE 1
#define VMOD_COMMENT_VALUE 2
static Bool
-WriteXKBVModDecl(FILE *file,Display *dpy,XkbDescPtr xkb,int showValue)
+WriteXKBVModDecl(FILE *file,XkbDescPtr xkb,int showValue)
{
register int i,nMods;
Atom * vmodNames;
@@ -67,7 +67,7 @@ Atom * vmodNames;
if ((vmodNames!=NULL)&&(vmodNames[i]!=None)) {
if (nMods==0) fprintf(file," virtual_modifiers ");
else fprintf(file,",");
- fprintf(file,"%s",XkbAtomText(dpy,vmodNames[i],XkbXKBFile));
+ fprintf(file,"%s",XkbAtomText(vmodNames[i],XkbXKBFile));
if ((showValue!=VMOD_HIDE_VALUE)&&
(xkb->server)&&(xkb->server->vmods[i]!=XkbNoModifierMask)) {
if (showValue==VMOD_COMMENT_VALUE) {
@@ -90,14 +90,9 @@ Atom * vmodNames;
/***====================================================================***/
static Bool
-WriteXKBAction(FILE *file,XkbFileInfo *result,XkbAnyAction *action)
+WriteXKBAction(FILE *file,XkbDescPtr xkb,XkbAnyAction *action)
{
-XkbDescPtr xkb;
-Display * dpy;
-
- xkb= result->xkb;
- dpy= xkb->dpy;
- fprintf(file,"%s",XkbActionText(dpy,xkb,(XkbAction *)action,XkbXKBFile));
+ fprintf(file,"%s",XkbActionText(xkb,(XkbAction *)action,XkbXKBFile));
return True;
}
@@ -105,7 +100,7 @@ Display * dpy;
Bool
XkbWriteXKBKeycodes( FILE * file,
- XkbFileInfo * result,
+ XkbDescPtr xkb,
Bool topLevel,
Bool showImplicit,
XkbFileAddOnFunc addOn,
@@ -113,12 +108,8 @@ XkbWriteXKBKeycodes( FILE * file,
{
Atom kcName;
register unsigned i;
-XkbDescPtr xkb;
-Display * dpy;
char * alternate;
- xkb= result->xkb;
- dpy= xkb->dpy;
if ((!xkb)||(!xkb->names)||(!xkb->names->keys)) {
_XkbLibError(_XkbErrMissingNames,"XkbWriteXKBKeycodes",0);
return False;
@@ -126,7 +117,7 @@ char * alternate;
kcName= xkb->names->keycodes;
if (kcName!=None)
fprintf(file,"xkb_keycodes \"%s\" {\n",
- XkbAtomText(dpy,kcName,XkbXKBFile));
+ XkbAtomText(kcName,XkbXKBFile));
else fprintf(file,"xkb_keycodes {\n");
fprintf(file," minimum = %d;\n",xkb->min_key_code);
fprintf(file," maximum = %d;\n",xkb->max_key_code);
@@ -148,7 +139,7 @@ char * alternate;
else type= " virtual ";
if (xkb->names->indicators[i]!=None) {
fprintf(file,"%sindicator %d = \"%s\";\n",type,i+1,
- XkbAtomText(dpy,xkb->names->indicators[i],XkbXKBFile));
+ XkbAtomText(xkb->names->indicators[i],XkbXKBFile));
}
}
}
@@ -162,27 +153,23 @@ char * alternate;
}
}
if (addOn)
- (*addOn)(file,result,topLevel,showImplicit,XkmKeyNamesIndex,priv);
+ (*addOn)(file,xkb,topLevel,showImplicit,XkmKeyNamesIndex,priv);
fprintf(file,"};\n\n");
return True;
}
Bool
XkbWriteXKBKeyTypes( FILE * file,
- XkbFileInfo * result,
+ XkbDescPtr xkb,
Bool topLevel,
Bool showImplicit,
XkbFileAddOnFunc addOn,
void * priv)
{
-Display * dpy;
register unsigned i,n;
XkbKeyTypePtr type;
XkbKTMapEntryPtr entry;
-XkbDescPtr xkb;
- xkb= result->xkb;
- dpy= xkb->dpy;
if ((!xkb)||(!xkb->map)||(!xkb->map->types)) {
_XkbLibError(_XkbErrMissingTypes,"XkbWriteXKBKeyTypes",0);
return False;
@@ -194,27 +181,27 @@ XkbDescPtr xkb;
if ((xkb->names==NULL)||(xkb->names->types==None))
fprintf(file,"xkb_types {\n\n");
else fprintf(file,"xkb_types \"%s\" {\n\n",
- XkbAtomText(dpy,xkb->names->types,XkbXKBFile));
- WriteXKBVModDecl(file,dpy,xkb,
+ XkbAtomText(xkb->names->types,XkbXKBFile));
+ WriteXKBVModDecl(file,xkb,
(showImplicit?VMOD_COMMENT_VALUE:VMOD_HIDE_VALUE));
type= xkb->map->types;
for (i=0;i<xkb->map->num_types;i++,type++) {
fprintf(file," type \"%s\" {\n",
- XkbAtomText(dpy,type->name,XkbXKBFile));
+ XkbAtomText(type->name,XkbXKBFile));
fprintf(file," modifiers= %s;\n",
- XkbVModMaskText(dpy,xkb,type->mods.real_mods,type->mods.vmods,
+ XkbVModMaskText(xkb,type->mods.real_mods,type->mods.vmods,
XkbXKBFile));
entry= type->map;
for (n=0;n<type->map_count;n++,entry++) {
char *str;
- str=XkbVModMaskText(dpy,xkb,entry->mods.real_mods,entry->mods.vmods,
+ str=XkbVModMaskText(xkb,entry->mods.real_mods,entry->mods.vmods,
XkbXKBFile);
fprintf(file," map[%s]= Level%d;\n",str,entry->level+1);
if ((type->preserve)&&((type->preserve[n].real_mods)||
(type->preserve[n].vmods))) {
fprintf(file," preserve[%s]= ",str);
- fprintf(file,"%s;\n",XkbVModMaskText(dpy,xkb,
+ fprintf(file,"%s;\n",XkbVModMaskText(xkb,
type->preserve[n].real_mods,
type->preserve[n].vmods,
XkbXKBFile));
@@ -226,29 +213,27 @@ XkbDescPtr xkb;
if ((*name)==None)
continue;
fprintf(file," level_name[Level%d]= \"%s\";\n",n+1,
- XkbAtomText(dpy,*name,XkbXKBFile));
+ XkbAtomText(*name,XkbXKBFile));
}
}
fprintf(file," };\n");
}
if (addOn)
- (*addOn)(file,result,topLevel,showImplicit,XkmTypesIndex,priv);
+ (*addOn)(file,xkb,topLevel,showImplicit,XkmTypesIndex,priv);
fprintf(file,"};\n\n");
return True;
}
static Bool
WriteXKBIndicatorMap( FILE * file,
- XkbFileInfo * result,
+ XkbDescPtr xkb,
Atom name,
XkbIndicatorMapPtr led,
XkbFileAddOnFunc addOn,
void * priv)
{
-XkbDescPtr xkb;
- xkb= result->xkb;
- fprintf(file," indicator \"%s\" {\n",XkbAtomGetString(xkb->dpy,name));
+ fprintf(file," indicator \"%s\" {\n",XkbAtomGetString(name));
if (led->flags&XkbIM_NoExplicit)
fprintf(file," !allowExplicit;\n");
if (led->flags&XkbIM_LEDDrivesKB)
@@ -266,7 +251,7 @@ XkbDescPtr xkb;
XkbIMWhichStateMaskText(led->which_mods,XkbXKBFile));
}
fprintf(file," modifiers= %s;\n",
- XkbVModMaskText(xkb->dpy,xkb,
+ XkbVModMaskText(xkb,
led->mods.real_mods,led->mods.vmods,
XkbXKBFile));
}
@@ -275,26 +260,22 @@ XkbDescPtr xkb;
XkbControlsMaskText(led->ctrls,XkbXKBFile));
}
if (addOn)
- (*addOn)(file,result,False,True,XkmIndicatorsIndex,priv);
+ (*addOn)(file,xkb,False,True,XkmIndicatorsIndex,priv);
fprintf(file," };\n");
return True;
}
Bool
XkbWriteXKBCompatMap( FILE * file,
- XkbFileInfo * result,
+ XkbDescPtr xkb,
Bool topLevel,
Bool showImplicit,
XkbFileAddOnFunc addOn,
void * priv)
{
-Display * dpy;
register unsigned i;
XkbSymInterpretPtr interp;
-XkbDescPtr xkb;
- xkb= result->xkb;
- dpy= xkb->dpy;
if ((!xkb)||(!xkb->compat)||(!xkb->compat->sym_interpret)) {
_XkbLibError(_XkbErrMissingCompatMap,"XkbWriteXKBCompatMap",0);
return False;
@@ -302,8 +283,8 @@ XkbDescPtr xkb;
if ((xkb->names==NULL)||(xkb->names->compat==None))
fprintf(file,"xkb_compatibility {\n\n");
else fprintf(file,"xkb_compatibility \"%s\" {\n\n",
- XkbAtomText(dpy,xkb->names->compat,XkbXKBFile));
- WriteXKBVModDecl(file,dpy,xkb,
+ XkbAtomText(xkb->names->compat,XkbXKBFile));
+ WriteXKBVModDecl(file,xkb,
(showImplicit?VMOD_COMMENT_VALUE:VMOD_HIDE_VALUE));
fprintf(file," interpret.useModMapMods= AnyLevel;\n");
@@ -318,7 +299,7 @@ XkbDescPtr xkb;
XkbModMaskText(interp->mods,XkbXKBFile));
if (interp->virtual_mod!=XkbNoModifier) {
fprintf(file," virtualModifier= %s;\n",
- XkbVModIndexText(dpy,xkb,interp->virtual_mod,XkbXKBFile));
+ XkbVModIndexText(xkb,interp->virtual_mod,XkbXKBFile));
}
if (interp->match&XkbSI_LevelOneOnly)
fprintf(file," useModMapMods=level1;\n");
@@ -327,7 +308,7 @@ XkbDescPtr xkb;
if (interp->flags&XkbSI_AutoRepeat)
fprintf(file," repeat= True;\n");
fprintf(file," action= ");
- WriteXKBAction(file,result,&interp->act);
+ WriteXKBAction(file,xkb,&interp->act);
fprintf(file,";\n");
fprintf(file," };\n");
}
@@ -337,7 +318,7 @@ XkbDescPtr xkb;
gc= &xkb->compat->groups[i];
if ((gc->real_mods==0)&&(gc->vmods==0))
continue;
- fprintf(file," group %d = %s;\n",i+1,XkbVModMaskText(xkb->dpy,xkb,
+ fprintf(file," group %d = %s;\n",i+1,XkbVModMaskText(xkb,
gc->real_mods,gc->vmods,
XkbXKBFile));
}
@@ -348,36 +329,32 @@ XkbDescPtr xkb;
(map->which_mods!=0)||
(map->mods.real_mods!=0)||(map->mods.vmods!=0)||
(map->ctrls!=0)) {
- WriteXKBIndicatorMap(file,result,xkb->names->indicators[i],map,
+ WriteXKBIndicatorMap(file,xkb,xkb->names->indicators[i],map,
addOn,priv);
}
}
}
if (addOn)
- (*addOn)(file,result,topLevel,showImplicit,XkmCompatMapIndex,priv);
+ (*addOn)(file,xkb,topLevel,showImplicit,XkmCompatMapIndex,priv);
fprintf(file,"};\n\n");
return True;
}
Bool
XkbWriteXKBSymbols( FILE * file,
- XkbFileInfo * result,
+ XkbDescPtr xkb,
Bool topLevel,
Bool showImplicit,
XkbFileAddOnFunc addOn,
void * priv)
{
-Display * dpy;
register unsigned i,tmp;
-XkbDescPtr xkb;
XkbClientMapPtr map;
XkbServerMapPtr srv;
Bool showActions;
- xkb= result->xkb;
map= xkb->map;
srv= xkb->server;
- dpy= xkb->dpy;
if ((!xkb)||(!map)||(!map->syms)||(!map->key_sym_map)) {
_XkbLibError(_XkbErrMissingSymbols,"XkbWriteXKBSymbols",0);
return False;
@@ -389,11 +366,11 @@ Bool showActions;
if ((xkb->names==NULL)||(xkb->names->symbols==None))
fprintf(file,"xkb_symbols {\n\n");
else fprintf(file,"xkb_symbols \"%s\" {\n\n",
- XkbAtomText(dpy,xkb->names->symbols,XkbXKBFile));
+ XkbAtomText(xkb->names->symbols,XkbXKBFile));
for (tmp=i=0;i<XkbNumKbdGroups;i++) {
if (xkb->names->groups[i]!=None) {
fprintf(file," name[group%d]=\"%s\";\n",i+1,
- XkbAtomText(dpy,xkb->names->groups[i],XkbXKBFile));
+ XkbAtomText(xkb->names->groups[i],XkbXKBFile));
tmp++;
}
}
@@ -429,19 +406,19 @@ Bool showActions;
if (srv->explicit[i]&(1<<g)) {
fprintf(file,"\n%s type[group%d]= \"%s\",",
comment,g+1,
- XkbAtomText(dpy,map->types[typeNdx].name,
+ XkbAtomText(map->types[typeNdx].name,
XkbXKBFile));
}
else if (showImplicit) {
fprintf(file,"\n// type[group%d]= \"%s\",",g+1,
- XkbAtomText(dpy,map->types[typeNdx].name,
+ XkbAtomText(map->types[typeNdx].name,
XkbXKBFile));
}
}
}
else {
fprintf(file,"\n%s type= \"%s\",",comment,
- XkbAtomText(dpy,map->types[typeNdx].name,
+ XkbAtomText(map->types[typeNdx].name,
XkbXKBFile));
}
simple= False;
@@ -457,13 +434,13 @@ Bool showActions;
(xkb->server->vmodmap[i]!=0)) {
if ((srv->explicit[i]&XkbExplicitVModMapMask)!=0) {
fprintf(file,"\n virtualMods= %s,",
- XkbVModMaskText(dpy,xkb,0,
+ XkbVModMaskText(xkb,0,
xkb->server->vmodmap[i],
XkbXKBFile));
}
else if (showImplicit) {
fprintf(file,"\n// virtualMods= %s,",
- XkbVModMaskText(dpy,xkb,0,
+ XkbVModMaskText(xkb,0,
xkb->server->vmodmap[i],
XkbXKBFile));
}
@@ -530,7 +507,7 @@ Bool showActions;
for (s=0;s<XkbKeyGroupWidth(xkb,i,g);s++) {
if (s!=0)
fprintf(file,", ");
- WriteXKBAction(file,result,(XkbAnyAction *)&acts[s]);
+ WriteXKBAction(file,xkb,(XkbAnyAction *)&acts[s]);
}
fprintf(file," ]");
acts+= XkbKeyGroupsWidth(xkb,i);
@@ -556,7 +533,7 @@ Bool showActions;
}
}
if (addOn)
- (*addOn)(file,result,topLevel,showImplicit,XkmSymbolsIndex,priv);
+ (*addOn)(file,xkb,topLevel,showImplicit,XkmSymbolsIndex,priv);
fprintf(file,"};\n\n");
return True;
}
@@ -603,7 +580,6 @@ char * iStr;
static Bool
WriteXKBDoodad( FILE * file,
- Display * dpy,
unsigned indent,
XkbGeometryPtr geom,
XkbDoodadPtr doodad)
@@ -615,7 +591,7 @@ XkbColorPtr color;
i_str= XkbIndentText(indent);
fprintf(file,"%s%s \"%s\" {\n",i_str,
XkbDoodadTypeText(doodad->any.type,XkbMessage),
- XkbAtomText(dpy,doodad->any.name,XkbMessage));
+ XkbAtomText(doodad->any.name,XkbMessage));
fprintf(file,"%s top= %s;\n",i_str,
XkbGeomFPText(doodad->any.top,XkbXKBFile));
fprintf(file,"%s left= %s;\n",i_str,
@@ -634,7 +610,7 @@ XkbColorPtr color;
}
shape= XkbShapeDoodadShape(geom,&doodad->shape);
fprintf(file,"%s shape= \"%s\";\n",i_str,
- XkbAtomText(dpy,shape->name,XkbXKBFile));
+ XkbAtomText(shape->name,XkbXKBFile));
break;
case XkbTextDoodad:
if (doodad->text.angle!=0) {
@@ -670,7 +646,7 @@ XkbColorPtr color;
fprintf(file,"%s offColor= \"%s\";\n",i_str,
XkbStringText(color->spec,XkbXKBFile));
fprintf(file,"%s shape= \"%s\";\n",i_str,
- XkbAtomText(dpy,shape->name,XkbXKBFile));
+ XkbAtomText(shape->name,XkbXKBFile));
break;
case XkbLogoDoodad:
fprintf(file,"%s logoName= \"%s\";\n",i_str,
@@ -685,7 +661,7 @@ XkbColorPtr color;
}
shape= XkbLogoDoodadShape(geom,&doodad->logo);
fprintf(file,"%s shape= \"%s\";\n",i_str,
- XkbAtomText(dpy,shape->name,XkbXKBFile));
+ XkbAtomText(shape->name,XkbXKBFile));
break;
}
fprintf(file,"%s};\n",i_str);
@@ -695,7 +671,6 @@ XkbColorPtr color;
/*ARGSUSED*/
static Bool
WriteXKBOverlay( FILE * file,
- Display * dpy,
unsigned indent,
XkbGeometryPtr geom,
XkbOverlayPtr ol)
@@ -708,7 +683,7 @@ XkbOverlayKeyPtr key;
i_str= XkbIndentText(indent);
if (ol->name!=None) {
fprintf(file,"%soverlay \"%s\" {\n",i_str,
- XkbAtomText(dpy,ol->name,XkbMessage));
+ XkbAtomText(ol->name,XkbMessage));
}
else fprintf(file,"%soverlay {\n",i_str);
for (nOut=r=0,row=ol->rows;r<ol->num_rows;r++,row++) {
@@ -730,7 +705,6 @@ XkbOverlayKeyPtr key;
static Bool
WriteXKBSection( FILE * file,
- Display * dpy,
XkbSectionPtr s,
XkbGeometryPtr geom)
{
@@ -739,7 +713,7 @@ XkbRowPtr row;
int dfltKeyColor = 0;
fprintf(file," section \"%s\" {\n",
- XkbAtomText(dpy,s->name,XkbXKBFile));
+ XkbAtomText(s->name,XkbXKBFile));
if (s->rows&&(s->rows->num_keys>0)) {
dfltKeyColor= s->rows->keys[0].color_ndx;
fprintf(file," key.color= \"%s\";\n",
@@ -788,7 +762,7 @@ int dfltKeyColor = 0;
shape= XkbKeyShape(geom,key);
fprintf(file,"{ %6s, \"%s\", %3s",
XkbKeyNameText(key->name.name,XkbXKBFile),
- XkbAtomText(dpy,shape->name,XkbXKBFile),
+ XkbAtomText(shape->name,XkbXKBFile),
XkbGeomFPText(key->gap,XkbXKBFile));
if (key->color_ndx!=dfltKeyColor) {
fprintf(file,", color=\"%s\"",XkbKeyColor(geom,key)->spec);
@@ -803,44 +777,40 @@ int dfltKeyColor = 0;
if (s->doodads!=NULL) {
XkbDoodadPtr doodad;
for (i=0,doodad=s->doodads;i<s->num_doodads;i++,doodad++) {
- WriteXKBDoodad(file,dpy,8,geom,doodad);
+ WriteXKBDoodad(file,8,geom,doodad);
}
}
if (s->overlays!=NULL) {
XkbOverlayPtr ol;
for (i=0,ol=s->overlays;i<s->num_overlays;i++,ol++) {
- WriteXKBOverlay(file,dpy,8,geom,ol);
+ WriteXKBOverlay(file,8,geom,ol);
}
}
fprintf(file," }; // End of \"%s\" section\n\n",
- XkbAtomText(dpy,s->name,XkbXKBFile));
+ XkbAtomText(s->name,XkbXKBFile));
return True;
}
Bool
XkbWriteXKBGeometry( FILE * file,
- XkbFileInfo * result,
+ XkbDescPtr xkb,
Bool topLevel,
Bool showImplicit,
XkbFileAddOnFunc addOn,
void * priv)
{
-Display * dpy;
register unsigned i,n;
-XkbDescPtr xkb;
XkbGeometryPtr geom;
- xkb= result->xkb;
if ((!xkb)||(!xkb->geom)) {
_XkbLibError(_XkbErrMissingGeometry,"XkbWriteXKBGeometry",0);
return False;
}
- dpy= xkb->dpy;
geom= xkb->geom;
if (geom->name==None)
fprintf(file,"xkb_geometry {\n\n");
else fprintf(file,"xkb_geometry \"%s\" {\n\n",
- XkbAtomText(dpy,geom->name,XkbXKBFile));
+ XkbAtomText(geom->name,XkbXKBFile));
fprintf(file," width= %s;\n",
XkbGeomFPText(geom->width_mm,XkbXKBFile));
fprintf(file," height= %s;\n\n",
@@ -889,7 +859,7 @@ XkbGeometryPtr geom;
for (shape=geom->shapes,i=0;i<geom->num_shapes;i++,shape++) {
lastR=0;
fprintf(file," shape \"%s\" {",
- XkbAtomText(dpy,shape->name,XkbXKBFile));
+ XkbAtomText(shape->name,XkbXKBFile));
outline= shape->outlines;
if (shape->num_outlines>1) {
for (n=0;n<shape->num_outlines;n++,outline++) {
@@ -909,17 +879,17 @@ XkbGeometryPtr geom;
if (geom->num_sections>0) {
XkbSectionPtr section;
for (section=geom->sections,i=0;i<geom->num_sections;i++,section++){
- WriteXKBSection(file,dpy,section,geom);
+ WriteXKBSection(file,section,geom);
}
}
if (geom->num_doodads>0) {
XkbDoodadPtr doodad;
for (i=0,doodad=geom->doodads;i<geom->num_doodads;i++,doodad++) {
- WriteXKBDoodad(file,dpy,4,geom,doodad);
+ WriteXKBDoodad(file,4,geom,doodad);
}
}
if (addOn)
- (*addOn)(file,result,topLevel,showImplicit,XkmGeometryIndex,priv);
+ (*addOn)(file,xkb,topLevel,showImplicit,XkmGeometryIndex,priv);
fprintf(file,"};\n\n");
return True;
}
diff --git a/xkb/xkbtext.c b/xkb/xkbtext.c
index 4983e2b9e..d08c91589 100644
--- a/xkb/xkbtext.c
+++ b/xkb/xkbtext.c
@@ -40,10 +40,10 @@
#include "misc.h"
#include "inputstr.h"
#include "dix.h"
-#include <X11/extensions/XKBstr.h>
+#include "xkbstr.h"
#define XKBSRV_NEED_FILE_FUNCS 1
#include <xkbsrv.h>
-#include <X11/extensions/XKBgeom.h>
+#include "xkbgeom.h"
/***====================================================================***/
@@ -69,11 +69,11 @@ char *rtrn;
/***====================================================================***/
char *
-XkbAtomText(Display *dpy,Atom atm,unsigned format)
+XkbAtomText(Atom atm,unsigned format)
{
char *rtrn,*tmp;
- tmp= XkbAtomGetString(dpy,atm);
+ tmp= XkbAtomGetString(atm);
if (tmp!=NULL) {
int len;
len= strlen(tmp)+1;
@@ -101,7 +101,7 @@ char *rtrn,*tmp;
/***====================================================================***/
char *
-XkbVModIndexText(Display *dpy,XkbDescPtr xkb,unsigned ndx,unsigned format)
+XkbVModIndexText(XkbDescPtr xkb,unsigned ndx,unsigned format)
{
register int len;
register Atom *vmodNames;
@@ -116,7 +116,7 @@ char numBuf[20];
if (ndx>=XkbNumVirtualMods)
tmp= "illegal";
else if (vmodNames&&(vmodNames[ndx]!=None))
- tmp= XkbAtomGetString(dpy,vmodNames[ndx]);
+ tmp= XkbAtomGetString(vmodNames[ndx]);
if (tmp==NULL)
sprintf(tmp=numBuf,"%d",ndx);
@@ -135,8 +135,7 @@ char numBuf[20];
}
char *
-XkbVModMaskText( Display * dpy,
- XkbDescPtr xkb,
+XkbVModMaskText( XkbDescPtr xkb,
unsigned modMask,
unsigned mask,
unsigned format)
@@ -163,7 +162,7 @@ char *str,buf[BUFFER_SIZE];
char *tmp;
for (i=0,bit=1;i<XkbNumVirtualMods;i++,bit<<=1) {
if (mask&bit) {
- tmp= XkbVModIndexText(dpy,xkb,i,format);
+ tmp= XkbVModIndexText(xkb,i,format);
len= strlen(tmp)+1+(str==buf?0:1);
if (format==XkbCFile)
len+= 4;
@@ -667,13 +666,13 @@ register int len;
/*ARGSUSED*/
static Bool
-CopyNoActionArgs(Display *dpy,XkbDescPtr xkb,XkbAction *action,char *buf,int*sz)
+CopyNoActionArgs(XkbDescPtr xkb,XkbAction *action,char *buf,int*sz)
{
return True;
}
static Bool
-CopyModActionArgs(Display *dpy,XkbDescPtr xkb,XkbAction *action,char *buf,
+CopyModActionArgs(XkbDescPtr xkb,XkbAction *action,char *buf,
int* sz)
{
XkbModAction * act;
@@ -686,7 +685,7 @@ unsigned tmp;
TryCopyStr(buf,"modMapMods",sz);
else if (act->real_mods || tmp) {
TryCopyStr(buf,
- XkbVModMaskText(dpy,xkb,act->real_mods,tmp,XkbXKBFile),
+ XkbVModMaskText(xkb,act->real_mods,tmp,XkbXKBFile),
sz);
}
else TryCopyStr(buf,"none",sz);
@@ -701,7 +700,7 @@ unsigned tmp;
/*ARGSUSED*/
static Bool
-CopyGroupActionArgs(Display *dpy,XkbDescPtr xkb,XkbAction *action,char *buf,
+CopyGroupActionArgs(XkbDescPtr xkb,XkbAction *action,char *buf,
int *sz)
{
XkbGroupAction * act;
@@ -726,7 +725,7 @@ char tbuf[32];
/*ARGSUSED*/
static Bool
-CopyMovePtrArgs(Display *dpy,XkbDescPtr xkb,XkbAction *action,char *buf,int *sz)
+CopyMovePtrArgs(XkbDescPtr xkb,XkbAction *action,char *buf,int *sz)
{
XkbPtrAction * act;
int x,y;
@@ -751,7 +750,7 @@ char tbuf[32];
/*ARGSUSED*/
static Bool
-CopyPtrBtnArgs(Display *dpy,XkbDescPtr xkb,XkbAction *action,char *buf,int *sz)
+CopyPtrBtnArgs(XkbDescPtr xkb,XkbAction *action,char *buf,int *sz)
{
XkbPtrBtnAction * act;
char tbuf[32];
@@ -785,7 +784,7 @@ char tbuf[32];
/*ARGSUSED*/
static Bool
-CopySetPtrDfltArgs(Display *dpy,XkbDescPtr xkb,XkbAction *action,char *buf,
+CopySetPtrDfltArgs(XkbDescPtr xkb,XkbAction *action,char *buf,
int *sz)
{
XkbPtrDfltAction * act;
@@ -803,7 +802,7 @@ char tbuf[32];
}
static Bool
-CopyISOLockArgs(Display *dpy,XkbDescPtr xkb,XkbAction *action,char *buf,int *sz)
+CopyISOLockArgs(XkbDescPtr xkb,XkbAction *action,char *buf,int *sz)
{
XkbISOAction * act;
char tbuf[64];
@@ -831,7 +830,7 @@ char tbuf[64];
TryCopyStr(buf,"+",sz);
}
if (tmp)
- TryCopyStr(buf,XkbVModMaskText(dpy,xkb,0,tmp,XkbXKBFile),sz);
+ TryCopyStr(buf,XkbVModMaskText(xkb,0,tmp,XkbXKBFile),sz);
}
else TryCopyStr(buf,"none",sz);
}
@@ -865,7 +864,7 @@ char tbuf[64];
/*ARGSUSED*/
static Bool
-CopySwitchScreenArgs(Display *dpy,XkbDescPtr xkb,XkbAction *action,char *buf,
+CopySwitchScreenArgs(XkbDescPtr xkb,XkbAction *action,char *buf,
int *sz)
{
XkbSwitchScreenAction * act;
@@ -884,7 +883,7 @@ char tbuf[32];
/*ARGSUSED*/
static Bool
-CopySetLockControlsArgs(Display *dpy,XkbDescPtr xkb,XkbAction *action,
+CopySetLockControlsArgs(XkbDescPtr xkb,XkbAction *action,
char *buf,int *sz)
{
XkbCtrlsAction * act;
@@ -971,7 +970,7 @@ char tbuf[32];
/*ARGSUSED*/
static Bool
-CopyActionMessageArgs(Display *dpy,XkbDescPtr xkb,XkbAction *action,char *buf,
+CopyActionMessageArgs(XkbDescPtr xkb,XkbAction *action,char *buf,
int *sz)
{
XkbMessageAction * act;
@@ -998,7 +997,7 @@ char tbuf[32];
}
static Bool
-CopyRedirectKeyArgs(Display *dpy,XkbDescPtr xkb,XkbAction *action,char *buf,
+CopyRedirectKeyArgs(XkbDescPtr xkb,XkbAction *action,char *buf,
int *sz)
{
XkbRedirectKeyAction * act;
@@ -1022,19 +1021,19 @@ unsigned vmods,vmods_mask;
return True;
if ((act->mods_mask==XkbAllModifiersMask)&&
(vmods_mask==XkbAllVirtualModsMask)) {
- tmp= XkbVModMaskText(dpy,xkb,act->mods,vmods,XkbXKBFile);
+ tmp= XkbVModMaskText(xkb,act->mods,vmods,XkbXKBFile);
TryCopyStr(buf,",mods=",sz);
TryCopyStr(buf,tmp,sz);
}
else {
if ((act->mods_mask&act->mods)||(vmods_mask&vmods)) {
- tmp= XkbVModMaskText(dpy,xkb,act->mods_mask&act->mods,
+ tmp= XkbVModMaskText(xkb,act->mods_mask&act->mods,
vmods_mask&vmods,XkbXKBFile);
TryCopyStr(buf,",mods= ",sz);
TryCopyStr(buf,tmp,sz);
}
if ((act->mods_mask&(~act->mods))||(vmods_mask&(~vmods))) {
- tmp= XkbVModMaskText(dpy,xkb,act->mods_mask&(~act->mods),
+ tmp= XkbVModMaskText(xkb,act->mods_mask&(~act->mods),
vmods_mask&(~vmods),XkbXKBFile);
TryCopyStr(buf,",clearMods= ",sz);
TryCopyStr(buf,tmp,sz);
@@ -1045,7 +1044,7 @@ unsigned vmods,vmods_mask;
/*ARGSUSED*/
static Bool
-CopyDeviceBtnArgs(Display *dpy,XkbDescPtr xkb,XkbAction *action,char *buf,
+CopyDeviceBtnArgs(XkbDescPtr xkb,XkbAction *action,char *buf,
int *sz)
{
XkbDeviceBtnAction * act;
@@ -1078,7 +1077,7 @@ char tbuf[32];
/*ARGSUSED*/
static Bool
-CopyOtherArgs(Display *dpy,XkbDescPtr xkb,XkbAction *action,char *buf,int *sz)
+CopyOtherArgs(XkbDescPtr xkb,XkbAction *action,char *buf,int *sz)
{
XkbAnyAction * act;
char tbuf[32];
@@ -1096,7 +1095,6 @@ char tbuf[32];
}
typedef Bool (*actionCopy)(
- Display * /* dpy */,
XkbDescPtr /* xkb */,
XkbAction * /* action */,
char * /* buf */,
@@ -1128,7 +1126,7 @@ static actionCopy copyActionArgs[XkbSA_NumActions] = {
#define ACTION_SZ 256
char *
-XkbActionText(Display *dpy,XkbDescPtr xkb,XkbAction *action,unsigned format)
+XkbActionText(XkbDescPtr xkb,XkbAction *action,unsigned format)
{
char buf[ACTION_SZ],*tmp;
int sz;
@@ -1145,8 +1143,8 @@ int sz;
sprintf(buf,"%s(",XkbActionTypeText(action->type,XkbXKBFile));
sz= ACTION_SZ-strlen(buf)+2; /* room for close paren and NULL */
if (action->type<(unsigned)XkbSA_NumActions)
- (*copyActionArgs[action->type])(dpy,xkb,action,buf,&sz);
- else CopyOtherArgs(dpy,xkb,action,buf,&sz);
+ (*copyActionArgs[action->type])(xkb,action,buf,&sz);
+ else CopyOtherArgs(xkb,action,buf,&sz);
TryCopyStr(buf,")",&sz);
}
tmp= tbGetBuffer(strlen(buf)+1);
diff --git a/xkb/xkmread.c b/xkb/xkmread.c
index c6c18422d..b14a5beda 100644
--- a/xkb/xkmread.c
+++ b/xkb/xkmread.c
@@ -39,23 +39,18 @@
#include <X11/keysym.h>
#include "misc.h"
#include "inputstr.h"
-#include <X11/extensions/XKBstr.h>
-#define XKBSRV_NEED_FILE_FUNCS
-#include <xkbsrv.h>
-#include <X11/extensions/XKBgeom.h>
+#include "xkbstr.h"
+#include "xkbsrv.h"
+#include "xkbgeom.h"
Atom
-XkbInternAtom(Display *dpy,char *str,Bool only_if_exists)
+XkbInternAtom(char *str,Bool only_if_exists)
{
if (str==NULL)
return None;
return MakeAtom(str,strlen(str),!only_if_exists);
}
-#ifndef SEEK_SET
-#define SEEK_SET 0
-#endif
-
char *
_XkbDupString(char *str)
{
@@ -71,18 +66,18 @@ char *new;
/***====================================================================***/
-static XPointer
-XkmInsureSize(XPointer oldPtr,int oldCount,int *newCountRtrn,int elemSize)
+static void *
+XkmInsureSize(void *oldPtr,int oldCount,int *newCountRtrn,int elemSize)
{
int newCount= *newCountRtrn;
if (oldPtr==NULL) {
if (newCount==0)
return NULL;
- oldPtr= (XPointer)_XkbCalloc(newCount,elemSize);
+ oldPtr= _XkbCalloc(newCount,elemSize);
}
else if (oldCount<newCount) {
- oldPtr= (XPointer)_XkbRealloc(oldPtr,newCount*elemSize);
+ oldPtr= _XkbRealloc(oldPtr,newCount*elemSize);
if (oldPtr!=NULL) {
char *tmp= (char *)oldPtr;
bzero(&tmp[oldCount*elemSize],(newCount-oldCount)*elemSize);
@@ -170,14 +165,12 @@ int count,nRead=0;
/***====================================================================***/
static int
-ReadXkmVirtualMods(FILE *file,XkbFileInfo *result,XkbChangesPtr changes)
+ReadXkmVirtualMods(FILE *file,XkbDescPtr xkb,XkbChangesPtr changes)
{
register unsigned int i,bit;
unsigned int bound,named,tmp;
int nRead=0;
-XkbDescPtr xkb;
- xkb= result->xkb;
if (XkbAllocServerMap(xkb,XkbVirtualModsMask,0)!=Success) {
_XkbLibError(_XkbErrBadAlloc,"ReadXkmVirtualMods",0);
return -1;
@@ -202,7 +195,7 @@ XkbDescPtr xkb;
char name[100];
if (named&bit) {
if (nRead+=XkmGetCountedString(file,name,100)) {
- xkb->names->vmods[i]= XkbInternAtom(xkb->dpy,name,False);
+ xkb->names->vmods[i]= XkbInternAtom(name,False);
if (changes)
changes->names.changed_vmods|= bit;
}
@@ -214,16 +207,14 @@ XkbDescPtr xkb;
/***====================================================================***/
static int
-ReadXkmKeycodes(FILE *file,XkbFileInfo *result,XkbChangesPtr changes)
+ReadXkmKeycodes(FILE *file,XkbDescPtr xkb,XkbChangesPtr changes)
{
register int i;
unsigned minKC,maxKC,nAl;
int nRead=0;
char name[100];
XkbKeyNamePtr pN;
-XkbDescPtr xkb;
- xkb= result->xkb;
name[0]= '\0';
nRead+= XkmGetCountedString(file,name,100);
minKC= XkmGetCARD8(file,&nRead);
@@ -249,7 +240,7 @@ XkbDescPtr xkb;
return -1;
}
if (name[0]!='\0') {
- xkb->names->keycodes= XkbInternAtom(xkb->dpy,name,False);
+ xkb->names->keycodes= XkbInternAtom(name,False);
}
for (pN=&xkb->names->keys[minKC],i=minKC;i<=(int)maxKC;i++,pN++) {
@@ -281,7 +272,7 @@ XkbDescPtr xkb;
/***====================================================================***/
static int
-ReadXkmKeyTypes(FILE *file,XkbFileInfo *result,XkbChangesPtr changes)
+ReadXkmKeyTypes(FILE *file,XkbDescPtr xkb,XkbChangesPtr changes)
{
register unsigned i,n;
unsigned num_types;
@@ -292,9 +283,7 @@ xkmKeyTypeDesc wire;
XkbKTMapEntryPtr entry;
xkmKTMapEntryDesc wire_entry;
char buf[100];
-XkbDescPtr xkb;
- xkb= result->xkb;
if ((tmp= XkmGetCountedString(file,buf,100))<1) {
_XkbLibError(_XkbErrBadLength,"ReadXkmKeyTypes",0);
return -1;
@@ -305,7 +294,7 @@ XkbDescPtr xkb;
_XkbLibError(_XkbErrBadAlloc,"ReadXkmKeyTypes",0);
return -1;
}
- xkb->names->types= XkbInternAtom(xkb->dpy,buf,False);
+ xkb->names->types= XkbInternAtom(buf,False);
}
num_types= XkmGetCARD16(file,&nRead);
nRead+= XkmSkipPadding(file,2);
@@ -360,7 +349,7 @@ XkbDescPtr xkb;
return -1;
}
if (buf[0]!='\0') {
- type->name= XkbInternAtom(xkb->dpy,buf,False);
+ type->name= XkbInternAtom(buf,False);
}
else type->name= None;
@@ -398,7 +387,7 @@ XkbDescPtr xkb;
nRead+= tmp;
if (strlen(buf)==0)
type->level_names[n]= None;
- else type->level_names[n]= XkbInternAtom(xkb->dpy,buf,0);
+ else type->level_names[n]= XkbInternAtom(buf,0);
}
}
}
@@ -419,7 +408,7 @@ XkbDescPtr xkb;
/***====================================================================***/
static int
-ReadXkmCompatMap(FILE *file,XkbFileInfo *result,XkbChangesPtr changes)
+ReadXkmCompatMap(FILE *file,XkbDescPtr xkb,XkbChangesPtr changes)
{
register int i;
unsigned num_si,groups;
@@ -428,10 +417,8 @@ XkbSymInterpretPtr interp;
xkmSymInterpretDesc wire;
unsigned tmp;
int nRead=0;
-XkbDescPtr xkb;
XkbCompatMapPtr compat;
- xkb= result->xkb;
if ((tmp= XkmGetCountedString(file,name,100))<1) {
_XkbLibError(_XkbErrBadLength,"ReadXkmCompatMap",0);
return -1;
@@ -442,7 +429,7 @@ XkbCompatMapPtr compat;
_XkbLibError(_XkbErrBadAlloc,"ReadXkmCompatMap",0);
return -1;
}
- xkb->names->compat= XkbInternAtom(xkb->dpy,name,False);
+ xkb->names->compat= XkbInternAtom(name,False);
}
num_si= XkmGetCARD16(file,&nRead);
groups= XkmGetCARD8(file,&nRead);
@@ -497,16 +484,14 @@ XkbCompatMapPtr compat;
}
static int
-ReadXkmIndicators(FILE *file,XkbFileInfo *result,XkbChangesPtr changes)
+ReadXkmIndicators(FILE *file,XkbDescPtr xkb,XkbChangesPtr changes)
{
register unsigned nLEDs;
xkmIndicatorMapDesc wire;
char buf[100];
unsigned tmp;
int nRead=0;
-XkbDescPtr xkb;
- xkb= result->xkb;
if ((xkb->indicators==NULL)&&(XkbAllocIndicatorMaps(xkb)!=Success)) {
_XkbLibError(_XkbErrBadAlloc,"indicator rec",0);
return -1;
@@ -528,7 +513,7 @@ XkbDescPtr xkb;
}
nRead+= tmp;
if (buf[0]!='\0')
- name= XkbInternAtom(xkb->dpy,buf,False);
+ name= XkbInternAtom(buf,False);
else name= None;
if ((tmp=fread(&wire,SIZEOF(xkmIndicatorMapDesc),1,file))<1) {
_XkbLibError(_XkbErrBadLength,"ReadXkmIndicators",0);
@@ -562,10 +547,8 @@ FindTypeForKey(XkbDescPtr xkb,Atom name,unsigned width,KeySym *syms)
register unsigned i;
for (i=0;i<xkb->map->num_types;i++) {
if (xkb->map->types[i].name==name) {
-#ifdef DEBUG
if (xkb->map->types[i].num_levels!=width)
- fprintf(stderr,"Group width mismatch between key and type\n");
-#endif
+ DebugF("Group width mismatch between key and type\n");
return &xkb->map->types[i];
}
}
@@ -582,16 +565,14 @@ FindTypeForKey(XkbDescPtr xkb,Atom name,unsigned width,KeySym *syms)
}
static int
-ReadXkmSymbols(FILE *file,XkbFileInfo *result)
+ReadXkmSymbols(FILE *file,XkbDescPtr xkb)
{
register int i,g,s,totalVModMaps;
xkmKeySymMapDesc wireMap;
char buf[100];
unsigned minKC,maxKC,groupNames,tmp;
int nRead=0;
-XkbDescPtr xkb;
- xkb= result->xkb;
if ((tmp=XkmGetCountedString(file,buf,100))<1)
return -1;
nRead+= tmp;
@@ -607,7 +588,7 @@ XkbDescPtr xkb;
}
if ((buf[0]!='\0')&&(xkb->names)) {
Atom name;
- name= XkbInternAtom(xkb->dpy,buf,0);
+ name= XkbInternAtom(buf,0);
xkb->names->symbols= name;
xkb->names->phys_symbols= name;
}
@@ -618,7 +599,7 @@ XkbDescPtr xkb;
nRead+= tmp;
if ((buf[0]!='\0')&&(xkb->names)) {
Atom name;
- name= XkbInternAtom(xkb->dpy,buf,0);
+ name= XkbInternAtom(buf,0);
xkb->names->groups[i]= name;
}
else xkb->names->groups[i]= None;
@@ -661,7 +642,7 @@ XkbDescPtr xkb;
for (g=0;g<XkbNumKbdGroups;g++) {
if ((wireMap.flags&(1<<g))&&
((tmp=XkmGetCountedString(file,buf,100))>0)) {
- typeName[g]= XkbInternAtom(xkb->dpy,buf,1);
+ typeName[g]= XkbInternAtom(buf,1);
nRead+= tmp;
}
type[g]=FindTypeForKey(xkb,typeName[g],wireMap.width,NULL);
@@ -739,7 +720,6 @@ XkbDescPtr xkb;
static int
ReadXkmGeomDoodad(
FILE * file,
- Display * dpy,
XkbGeometryPtr geom,
XkbSectionPtr section)
{
@@ -752,7 +732,7 @@ int nRead=0;
nRead+= XkmGetCountedString(file,buf,100);
tmp= fread(&doodadWire,SIZEOF(xkmDoodadDesc),1,file);
nRead+= SIZEOF(xkmDoodadDesc)*tmp;
- doodad= XkbAddGeomDoodad(geom,section,XkbInternAtom(dpy,buf,False));
+ doodad= XkbAddGeomDoodad(geom,section,XkbInternAtom(buf,False));
if (!doodad)
return nRead;
doodad->any.type= doodadWire.any.type;
@@ -797,7 +777,6 @@ int nRead=0;
static int
ReadXkmGeomOverlay( FILE * file,
- Display * dpy,
XkbGeometryPtr geom,
XkbSectionPtr section)
{
@@ -813,7 +792,7 @@ register int r;
nRead+= XkmGetCountedString(file,buf,100);
tmp= fread(&olWire,SIZEOF(xkmOverlayDesc),1,file);
nRead+= tmp*SIZEOF(xkmOverlayDesc);
- ol= XkbAddGeomOverlay(section,XkbInternAtom(dpy,buf,False),
+ ol= XkbAddGeomOverlay(section,XkbInternAtom(buf,False),
olWire.num_rows);
if (!ol)
return nRead;
@@ -840,7 +819,6 @@ register int r;
static int
ReadXkmGeomSection( FILE * file,
- Display * dpy,
XkbGeometryPtr geom)
{
register int i;
@@ -852,7 +830,7 @@ char buf[100];
Atom nameAtom;
nRead+= XkmGetCountedString(file,buf,100);
- nameAtom= XkbInternAtom(dpy,buf,False);
+ nameAtom= XkbInternAtom(buf,False);
tmp= fread(&sectionWire,SIZEOF(xkmSectionDesc),1,file);
nRead+= SIZEOF(xkmSectionDesc)*tmp;
section= XkbAddGeomSection(geom,nameAtom,sectionWire.num_rows,
@@ -903,7 +881,7 @@ Atom nameAtom;
}
if (sectionWire.num_doodads>0) {
for (i=0;i<sectionWire.num_doodads;i++) {
- tmp= ReadXkmGeomDoodad(file,dpy,geom,section);
+ tmp= ReadXkmGeomDoodad(file,geom,section);
nRead+= tmp;
if (tmp<1)
return nRead;
@@ -911,7 +889,7 @@ Atom nameAtom;
}
if (sectionWire.num_overlays>0) {
for (i=0;i<sectionWire.num_overlays;i++) {
- tmp= ReadXkmGeomOverlay(file,dpy,geom,section);
+ tmp= ReadXkmGeomOverlay(file,geom,section);
nRead+= tmp;
if (tmp<1)
return nRead;
@@ -921,7 +899,7 @@ Atom nameAtom;
}
static int
-ReadXkmGeometry(FILE *file,XkbFileInfo *result)
+ReadXkmGeometry(FILE *file,XkbDescPtr xkb)
{
register int i;
char buf[100];
@@ -941,12 +919,12 @@ XkbGeometrySizesRec sizes;
sizes.num_sections= wireGeom.num_sections;
sizes.num_doodads= wireGeom.num_doodads;
sizes.num_key_aliases= wireGeom.num_key_aliases;
- if (XkbAllocGeometry(result->xkb,&sizes)!=Success) {
+ if (XkbAllocGeometry(xkb,&sizes)!=Success) {
_XkbLibError(_XkbErrBadAlloc,"ReadXkmGeometry",0);
return nRead;
}
- geom= result->xkb->geom;
- geom->name= XkbInternAtom(result->xkb->dpy,buf,False);
+ geom= xkb->geom;
+ geom->name= XkbInternAtom(buf,False);
geom->width_mm= wireGeom.width_mm;
geom->height_mm= wireGeom.height_mm;
nRead+= XkmGetCountedString(file,buf,100);
@@ -982,7 +960,7 @@ XkbGeometrySizesRec sizes;
XkbOutlinePtr ol;
xkmOutlineDesc olWire;
nRead+= XkmGetCountedString(file,buf,100);
- nameAtom= XkbInternAtom(result->xkb->dpy,buf,False);
+ nameAtom= XkbInternAtom(buf,False);
tmp= fread(&shapeWire,SIZEOF(xkmShapeDesc),1,file);
nRead+= tmp*SIZEOF(xkmShapeDesc);
shape= XkbAddGeomShape(geom,nameAtom,shapeWire.num_outlines);
@@ -1021,7 +999,7 @@ XkbGeometrySizesRec sizes;
}
if (wireGeom.num_sections>0) {
for (i=0;i<wireGeom.num_sections;i++) {
- tmp= ReadXkmGeomSection(file,result->xkb->dpy,geom);
+ tmp= ReadXkmGeomSection(file,geom);
nRead+= tmp;
if (tmp==0)
return nRead;
@@ -1029,7 +1007,7 @@ XkbGeometrySizesRec sizes;
}
if (wireGeom.num_doodads>0) {
for (i=0;i<wireGeom.num_doodads;i++) {
- tmp= ReadXkmGeomDoodad(file,result->xkb->dpy,geom,NULL);
+ tmp= ReadXkmGeomDoodad(file,geom,NULL);
nRead+= tmp;
if (tmp==0)
return nRead;
@@ -1065,7 +1043,7 @@ int nRead=0;
return 1;
}
-Bool
+static Bool
XkmReadTOC(FILE *file,xkmFileInfo* file_info,int max_toc,xkmSectionInfo *toc)
{
unsigned hdr,tmp;
@@ -1086,10 +1064,8 @@ unsigned i,size_toc;
fread(file_info,SIZEOF(xkmFileInfo),1,file);
size_toc= file_info->num_toc;
if (size_toc>max_toc) {
-#ifdef DEBUG
- fprintf(stderr,"Warning! Too many TOC entries; last %d ignored\n",
+ DebugF("Warning! Too many TOC entries; last %d ignored\n",
size_toc-max_toc);
-#endif
size_toc= max_toc;
}
for (i=0;i<size_toc;i++) {
@@ -1098,117 +1074,11 @@ unsigned i,size_toc;
return 1;
}
-Bool
-XkmReadFileSection( FILE * file,
- xkmSectionInfo * toc,
- XkbFileInfo * result,
- unsigned * loaded_rtrn)
-{
-xkmSectionInfo tmpTOC;
-int nRead;
-
- if ((!result)||(!result->xkb)) {
- _XkbLibError(_XkbErrBadMatch,"XkmReadFileSection",0);
- return 0;
- }
- fseek(file,toc->offset,SEEK_SET);
- fread(&tmpTOC,SIZEOF(xkmSectionInfo),1,file);
- nRead= SIZEOF(xkmSectionInfo);
- if ((tmpTOC.type!=toc->type)||(tmpTOC.format!=toc->format)||
- (tmpTOC.size!=toc->size)||(tmpTOC.offset!=toc->offset)) {
- _XkbLibError(_XkbErrIllegalContents,"XkmReadFileSection",0);
- return 0;
- }
- switch (tmpTOC.type) {
- case XkmVirtualModsIndex:
- nRead+= ReadXkmVirtualMods(file,result,NULL);
- if ((loaded_rtrn)&&(nRead>=0))
- *loaded_rtrn|= XkmVirtualModsMask;
- break;
- case XkmTypesIndex:
- nRead+= ReadXkmKeyTypes(file,result,NULL);
- if ((loaded_rtrn)&&(nRead>=0))
- *loaded_rtrn|= XkmTypesMask;
- break;
- case XkmCompatMapIndex:
- nRead+= ReadXkmCompatMap(file,result,NULL);
- if ((loaded_rtrn)&&(nRead>=0))
- *loaded_rtrn|= XkmCompatMapMask;
- break;
- case XkmKeyNamesIndex:
- nRead+= ReadXkmKeycodes(file,result,NULL);
- if ((loaded_rtrn)&&(nRead>=0))
- *loaded_rtrn|= XkmKeyNamesMask;
- break;
- case XkmSymbolsIndex:
- nRead+= ReadXkmSymbols(file,result);
- if ((loaded_rtrn)&&(nRead>=0))
- *loaded_rtrn|= XkmSymbolsMask;
- break;
- case XkmIndicatorsIndex:
- nRead+= ReadXkmIndicators(file,result,NULL);
- if ((loaded_rtrn)&&(nRead>=0))
- *loaded_rtrn|= XkmIndicatorsMask;
- break;
- case XkmGeometryIndex:
- nRead+= ReadXkmGeometry(file,result);
- if ((loaded_rtrn)&&(nRead>=0))
- *loaded_rtrn|= XkmGeometryMask;
- break;
- default:
- _XkbLibError(_XkbErrBadImplementation,
- XkbConfigText(tmpTOC.type,XkbMessage),0);
- nRead= 0;
- break;
- }
- if (nRead!=tmpTOC.size) {
- _XkbLibError(_XkbErrBadLength,XkbConfigText(tmpTOC.type,XkbMessage),
- nRead-tmpTOC.size);
- return 0;
- }
- return (nRead>=0);
-}
-
-char *
-XkmReadFileSectionName(FILE *file,xkmSectionInfo *toc)
-{
-xkmSectionInfo tmpTOC;
-char name[100];
-
- if ((!file)||(!toc))
- return 0;
- switch (toc->type) {
- case XkmVirtualModsIndex:
- case XkmIndicatorsIndex:
- break;
- case XkmTypesIndex:
- case XkmCompatMapIndex:
- case XkmKeyNamesIndex:
- case XkmSymbolsIndex:
- case XkmGeometryIndex:
- fseek(file,toc->offset,SEEK_SET);
- fread(&tmpTOC,SIZEOF(xkmSectionInfo),1,file);
- if ((tmpTOC.type!=toc->type)||(tmpTOC.format!=toc->format)||
- (tmpTOC.size!=toc->size)||(tmpTOC.offset!=toc->offset)) {
- _XkbLibError(_XkbErrIllegalContents,"XkmReadFileSectionName",0);
- return 0;
- }
- if (XkmGetCountedString(file,name,100)>0)
- return _XkbDupString(name);
- break;
- default:
- _XkbLibError(_XkbErrBadImplementation,
- XkbConfigText(tmpTOC.type,XkbMessage),0);
- break;
- }
- return NULL;
-}
-
/***====================================================================***/
#define MAX_TOC 16
unsigned
-XkmReadFile(FILE *file,unsigned need,unsigned want,XkbFileInfo *result)
+XkmReadFile(FILE *file,unsigned need,unsigned want,XkbDescPtr *xkb)
{
register unsigned i;
xkmSectionInfo toc[MAX_TOC],tmpTOC;
@@ -1223,15 +1093,10 @@ unsigned which= need|want;
need&(~fileInfo.present));
return which;
}
- result->type= fileInfo.type;
- if (result->xkb==NULL)
- result->xkb= XkbAllocKeyboard();
+ if (*xkb==NULL)
+ *xkb= XkbAllocKeyboard();
for (i=0;i<fileInfo.num_toc;i++) {
-#ifdef SEEK_SET
fseek(file,toc[i].offset,SEEK_SET);
-#else
- fseek(file,toc[i].offset,0);
-#endif
tmp= fread(&tmpTOC,SIZEOF(xkmSectionInfo),1,file);
nRead= tmp*SIZEOF(xkmSectionInfo);
if ((tmpTOC.type!=toc[i].type)||(tmpTOC.format!=toc[i].format)||
@@ -1243,25 +1108,25 @@ unsigned which= need|want;
}
switch (tmpTOC.type) {
case XkmVirtualModsIndex:
- tmp= ReadXkmVirtualMods(file,result,NULL);
+ tmp= ReadXkmVirtualMods(file,*xkb,NULL);
break;
case XkmTypesIndex:
- tmp= ReadXkmKeyTypes(file,result,NULL);
+ tmp= ReadXkmKeyTypes(file,*xkb,NULL);
break;
case XkmCompatMapIndex:
- tmp= ReadXkmCompatMap(file,result,NULL);
+ tmp= ReadXkmCompatMap(file,*xkb,NULL);
break;
case XkmKeyNamesIndex:
- tmp= ReadXkmKeycodes(file,result,NULL);
+ tmp= ReadXkmKeycodes(file,*xkb,NULL);
break;
case XkmIndicatorsIndex:
- tmp= ReadXkmIndicators(file,result,NULL);
+ tmp= ReadXkmIndicators(file,*xkb,NULL);
break;
case XkmSymbolsIndex:
- tmp= ReadXkmSymbols(file,result);
+ tmp= ReadXkmSymbols(file,*xkb);
break;
case XkmGeometryIndex:
- tmp= ReadXkmGeometry(file,result);
+ tmp= ReadXkmGeometry(file,*xkb);
break;
default:
_XkbLibError(_XkbErrBadImplementation,
@@ -1272,7 +1137,7 @@ unsigned which= need|want;
if (tmp>0) {
nRead+= tmp;
which&= ~(1<<toc[i].type);
- result->defined|= (1<<toc[i].type);
+ (*xkb)->defined|= (1<<toc[i].type);
}
if (nRead!=tmpTOC.size) {
_XkbLibError(_XkbErrBadLength,XkbConfigText(tmpTOC.type,XkbMessage),