diff options
Diffstat (limited to 'nx-X11')
32 files changed, 3 insertions, 3552 deletions
diff --git a/nx-X11/config/cf/X11.tmpl b/nx-X11/config/cf/X11.tmpl index 2b43ca562..4ae57252a 100644 --- a/nx-X11/config/cf/X11.tmpl +++ b/nx-X11/config/cf/X11.tmpl @@ -180,9 +180,6 @@ XORGRELSTRING = XorgManVersionString #ifndef BuildXKBlib #define BuildXKBlib (BuildXKB && !BuildServersOnly) #endif -#ifndef BuildXKBfilelib -#define BuildXKBfilelib (BuildXKB && !BuildServersOnly) -#endif /* * WARNING: Setting UseXKBInClients to YES cause incompatibilities @@ -1235,56 +1232,11 @@ MOTIFINCLUDES = -I$(MOTIFINCDIR) #endif #if BuildXKBlib -# ifndef SharedLibxkbfile -# define SharedLibxkbfile HasSharedLibraries -# endif -# ifndef NormalLibxkbfile -# define NormalLibxkbfile (!SharedLibxkbfile | ForceNormalLib) -# endif -# ifndef DebugLibxkbfile -# define DebugLibxkbfile NO -# endif -# ifndef ProfileLibxkbfile -# define ProfileLibxkbfile NO -# endif -#else -# ifndef SharedLibxkbfile -# define SharedLibxkbfile NO -# endif -# ifndef NormalLibxkbfile -# define NormalLibxkbfile NO -# endif -# ifndef DebugLibxkbfile -# define DebugLibxkbfile NO -# endif -# ifndef ProfileLibxkbfile -# define ProfileLibxkbfile NO -# endif -#endif - XKBFILELIBSRC = $(LIBSRC)/xkbfile -#if SharedLibxkbfile -# ifndef SharedxkbfileRev -# define SharedxkbfileRev 1.0 -# endif -SharedLibReferences(XKBFILE,NX_xkbfile,$(XKBFILESRC),SOXKBFILEREV, SharedxkbfileRev) -#else -ProjectUnsharedLibReferences(XKBFILE,NX_xkbfile,$(XKBFILELIBSRC),XBuildLibDir) -#endif - -#if BuildXKBlib # ifndef XkbClientDepLibs -# if UseXKBInClients -# define XkbClientDepLibs $(DEPXKBFILELIB) -# else # define XkbClientDepLibs /**/ -# endif # endif # ifndef XkbClientLibs -# if UseXKBInClients -# define XkbClientLibs $(XKBFILELIB) -# else # define XkbClientLibs /**/ -# endif # endif #else /* !BuildXKBlib */ diff --git a/nx-X11/config/cf/lnxLib.tmpl b/nx-X11/config/cf/lnxLib.tmpl index 3f9c65813..a6e7f48d3 100644 --- a/nx-X11/config/cf/lnxLib.tmpl +++ b/nx-X11/config/cf/lnxLib.tmpl @@ -9,6 +9,4 @@ XCOMM $XFree86: xc/config/cf/lnxLib.tmpl,v 3.19 2003/10/15 22:47:48 herrb Exp $ #define SharedXlibi18nReqs $(LDPRELIB) $(XONLYLIB) #define SharedXextReqs $(LDPRELIB) $(XONLYLIB) -#define SharedxkbfileReqs $(LDPRELIB) $(XONLYLIB) - #define NoMessageCatalog diff --git a/nx-X11/config/cf/xorg.cf b/nx-X11/config/cf/xorg.cf index 3a391b152..b05ed5fd0 100644 --- a/nx-X11/config/cf/xorg.cf +++ b/nx-X11/config/cf/xorg.cf @@ -193,7 +193,6 @@ NX_VERSION_CURRENT_STRING = nxVersionString #if BuildXFree86ConfigTools && BuildLibrariesForConfigTools #define BuildLibraries YES #define BuildXKBlib YES -#define BuildXKBfilelib YES #endif /* diff --git a/nx-X11/include/extensions/Imakefile b/nx-X11/include/extensions/Imakefile index f9c9598c7..d2be4b324 100644 --- a/nx-X11/include/extensions/Imakefile +++ b/nx-X11/include/extensions/Imakefile @@ -41,6 +41,8 @@ DAMAGEHEADERS = damagewire.h damageproto.h XRESHEADERS = XResproto.h #endif +XKBFILEHEADERS = XKMformat.h XKM.h XKBconfig.h XKBfile.h XKBrules.h + EXTRAHEADERS = \ $(SCREENSAVERHEADERS) \ $(XINERAMAHEADERS) \ @@ -53,6 +55,7 @@ EXTRAHEADERS = \ $(COMPOSITEHEADERS) \ $(DAMAGEHEADERS) \ $(XRESHEADERS) \ + $(XKBFILEHEADERS) \ $(NULL) HEADERS = \ diff --git a/nx-X11/lib/xkbfile/XKBconfig.h b/nx-X11/include/extensions/XKBconfig.h index 4816917c8..4816917c8 100644 --- a/nx-X11/lib/xkbfile/XKBconfig.h +++ b/nx-X11/include/extensions/XKBconfig.h diff --git a/nx-X11/lib/xkbfile/XKBfile.h b/nx-X11/include/extensions/XKBfile.h index 045193813..045193813 100644 --- a/nx-X11/lib/xkbfile/XKBfile.h +++ b/nx-X11/include/extensions/XKBfile.h diff --git a/nx-X11/lib/xkbfile/XKBrules.h b/nx-X11/include/extensions/XKBrules.h index 59d11cd88..59d11cd88 100644 --- a/nx-X11/lib/xkbfile/XKBrules.h +++ b/nx-X11/include/extensions/XKBrules.h diff --git a/nx-X11/lib/xkbfile/XKM.h b/nx-X11/include/extensions/XKM.h index 13dbed54c..13dbed54c 100644 --- a/nx-X11/lib/xkbfile/XKM.h +++ b/nx-X11/include/extensions/XKM.h diff --git a/nx-X11/lib/xkbfile/XKMformat.h b/nx-X11/include/extensions/XKMformat.h index ed414a365..ed414a365 100644 --- a/nx-X11/lib/xkbfile/XKMformat.h +++ b/nx-X11/include/extensions/XKMformat.h diff --git a/nx-X11/lib/Imakefile b/nx-X11/lib/Imakefile index 79b7e96c1..4615b8932 100644 --- a/nx-X11/lib/Imakefile +++ b/nx-X11/lib/Imakefile @@ -11,17 +11,12 @@ XCOMM $XFree86: xc/lib/Imakefile,v 3.74 2003/04/14 20:37:07 herrb Exp $ NULL = -#if BuildXKBfilelib || BuildXKB -XKBLIBDIR = xkbfile -#endif - #if BuildX11Lib X11LIBDIR = X11 #endif LINTSUBDIRS = \ $(X11LIBDIR) \ - $(XKBLIBDIR) \ $(NULL) SUBDIRS = xtrans $(LINTSUBDIRS) diff --git a/nx-X11/lib/xkbfile/Imakefile b/nx-X11/lib/xkbfile/Imakefile deleted file mode 100644 index 6a675dc9a..000000000 --- a/nx-X11/lib/xkbfile/Imakefile +++ /dev/null @@ -1,43 +0,0 @@ -XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:46:42 cpqbld Exp $ - - - - -XCOMM $XFree86: xc/lib/xkbfile/Imakefile,v 3.5 2003/10/15 21:23:38 herrb Exp $ - -#define DoNormalLib NormalLibxkbfile -#define DoSharedLib SharedLibxkbfile -#define DoExtraLib SharedLibxkbfile -#define DoDebugLib DebugLibxkbfile -#define DoProfileLib ProfileLibxkbfile -#define HasSharedData NO -#define LibName NX_xkbfile -#define SoRev SOXKBFILEREV -#define IncSubdir nx-X11 -#define IncSubSubdir extensions - -#ifdef SharedxkbfileReqs -REQUIREDLIBS = SharedxkbfileReqs -#endif - -#if !BuildXKBfilelib -#define LibBuild NO -#endif - - SRCS = xkbtext.c xkbdraw.c xkbmisc.c xkbatom.c xkberrs.c \ - cout.c xkbout.c xkmout.c \ - xkmread.c srvmisc.c \ - xkbconfig.c xkbbells.c maprules.c - OBJS = xkbtext.o xkbdraw.o xkbmisc.o xkbatom.o xkberrs.o \ - cout.o xkbout.o xkmout.o \ - xkmread.o srvmisc.o \ - xkbconfig.o xkbbells.o maprules.o - HEADERS = XKBfile.h XKM.h XKMformat.h XKBrules.h \ - XKBconfig.h XKBbells.h - INCLUDES = -I. -I$(EXTINCSRC) - -ROOT_DEFINES = -DDFLT_XKB_CONFIG_ROOT=\"$(LIBDIR)/xkb\" - -#include <Library.tmpl> - -DependTarget() diff --git a/nx-X11/lib/xkbfile/XKBbells.h b/nx-X11/lib/xkbfile/XKBbells.h deleted file mode 100644 index a2fc9ede6..000000000 --- a/nx-X11/lib/xkbfile/XKBbells.h +++ /dev/null @@ -1,142 +0,0 @@ -#ifndef _XKBBELLS_H_ -#define _XKBBELLS_H_ 1 - -/************************************************************ - Copyright (c) 1995 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. - - ********************************************************/ -/* $XFree86$ */ - -#define XkbBN_Info "Info" -#define XkbBN_Warning "Warning" -#define XkbBN_MinorError "MinorError" -#define XkbBN_MajorError "MajorError" -#define XkbBN_BadValue "BadValue" -#define XkbBN_InvalidLocation "InvalidLocation" -#define XkbBN_Question "Question" -#define XkbBN_Start "Start" -#define XkbBN_End "End" -#define XkbBN_Success "Success" -#define XkbBN_Failure "Failure" -#define XkbBN_Wait "Wait" -#define XkbBN_Proceed "Proceed" -#define XkbBN_Ignore "Ignore" -#define XkbBN_Iconify "Iconify" -#define XkbBN_Deiconify "Deconify" -#define XkbBN_Open "Open" -#define XkbBN_Close "Close" -#define XkbBN_TerminalBell "TerminalBell" -#define XkbBN_MarginBell "MarginBell" -#define XkbBN_CursorStuck "CursorStuck" -#define XkbBN_NewMail "NewMail" -#define XkbBN_LaunchApp "LaunchApp" -#define XkbBN_AppDeath "AppDeath" -#define XkbBN_ImAlive "ImAlive" -#define XkbBN_ClockChimeHour "ClockChimeHour" -#define XkbBN_ClockChimeHalf "ClockChimeHalf" -#define XkbBN_ClockChimeQuarter "ClockChimeQuarter" -#define XkbBN_RepeatingLastBell "RepeatingLastBell" -#define XkbBN_ComposeFail "ComposeFail" -#define XkbBN_AX_FeatureOn "AX_FeatureOn" -#define XkbBN_AX_FeatureOff "AX_FeatureOff" -#define XkbBN_AX_FeatureChange "AX_FeatureChange" -#define XkbBN_AX_IndicatorOn "AX_IndicatorOn" -#define XkbBN_AX_IndicatorOff "AX_IndicatorOff" -#define XkbBN_AX_IndicatorChange "AX_IndicatorChange" -#define XkbBN_AX_SlowKeysWarning "AX_SlowKeysWarning" -#define XkbBN_AX_SlowKeyPress "AX_SlowKeyPress" -#define XkbBN_AX_SlowKeyAccept "AX_SlowKeyAccept" -#define XkbBN_AX_SlowKeyReject "AX_SlowKeyReject" -#define XkbBN_AX_SlowKeyRelease "AX_SlowKeyRelease" -#define XkbBN_AX_BounceKeyReject "AX_BounceKeyReject" -#define XkbBN_AX_StickyLatch "AX_StickyLatch" -#define XkbBN_AX_StickyLock "AX_StickyLock" -#define XkbBN_AX_StickyUnlock "AX_StickyUnlock" - -#define XkbBI_Info 0 -#define XkbBI_Warning 1 -#define XkbBI_MinorError 2 -#define XkbBI_MajorError 3 -#define XkbBI_BadValue 4 -#define XkbBI_InvalidLocation 5 -#define XkbBI_Question 6 -#define XkbBI_Start 7 -#define XkbBI_End 8 -#define XkbBI_Success 9 -#define XkbBI_Failure 10 -#define XkbBI_Wait 11 -#define XkbBI_Proceed 12 -#define XkbBI_Ignore 13 -#define XkbBI_Iconify 14 -#define XkbBI_Deiconify 15 -#define XkbBI_Open 16 -#define XkbBI_Close 17 -#define XkbBI_TerminalBell 18 -#define XkbBI_MarginBell 19 -#define XkbBI_CursorStuck 20 -#define XkbBI_NewMail 21 -#define XkbBI_LaunchApp 22 -#define XkbBI_AppDeath 23 -#define XkbBI_ImAlive 24 -#define XkbBI_ClockChimeHour 25 -#define XkbBI_ClockChimeHalf 26 -#define XkbBI_ClockChimeQuarter 27 -#define XkbBI_RepeatingLastBell 28 -#define XkbBI_ComposeFail 29 -#define XkbBI_AX_FeatureOn 30 -#define XkbBI_AX_FeatureOff 31 -#define XkbBI_AX_FeatureChange 32 -#define XkbBI_AX_IndicatorOn 33 -#define XkbBI_AX_IndicatorOff 34 -#define XkbBI_AX_IndicatorChange 35 -#define XkbBI_AX_SlowKeysWarning 36 -#define XkbBI_AX_SlowKeyPress 37 -#define XkbBI_AX_SlowKeyAccept 38 -#define XkbBI_AX_SlowKeyReject 39 -#define XkbBI_AX_SlowKeyRelease 40 -#define XkbBI_AX_BounceKeyReject 41 -#define XkbBI_AX_StickyLatch 42 -#define XkbBI_AX_StickyLock 43 -#define XkbBI_AX_StickyUnlock 44 -#define XkbBI_NumBells 45 - -_XFUNCPROTOBEGIN - -extern Bool XkbStdBell( - Display * /* dpy */, - Window /* win */, - int /* percent */, - int /* bellDef */ -); - -extern Bool XkbStdBellEvent( - Display * /* dpy */, - Window /* win */, - int /* percent */, - int /* bellDef */ -); - -_XFUNCPROTOEND - -#endif /* _XKBBELLS_H_ */ diff --git a/nx-X11/lib/xkbfile/XKBfileInt.h b/nx-X11/lib/xkbfile/XKBfileInt.h deleted file mode 100644 index 2a58dcdfb..000000000 --- a/nx-X11/lib/xkbfile/XKBfileInt.h +++ /dev/null @@ -1,78 +0,0 @@ -#ifndef _XKBFILEINT_H_ -#define _XKBFILEINT_H_ 1 - -/************************************************************ - 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. - - ********************************************************/ -/* $XFree86$ */ - -#include "XKBfile.h" - -#ifdef DEBUG -#define _XkbLibError(c,l,d) \ - { fprintf(stderr,"xkbfile: %s in %s\n",_XkbErrMessages[c],(l)); \ - _XkbErrCode= (c); _XkbErrLocation= (l); _XkbErrData= (d); } -#else -#define _XkbLibError(c,l,d) \ - { _XkbErrCode= (c); _XkbErrLocation= (l); _XkbErrData= (d); } -#endif - -#ifndef XKB_IN_SERVER - -#define _XkbAlloc(s) malloc((s)) -#define _XkbCalloc(n,s) calloc((n),(s)) -#define _XkbRealloc(o,s) realloc((o),(s)) -#define _XkbTypedAlloc(t) ((t *)malloc(sizeof(t))) -#define _XkbTypedCalloc(n,t) ((t *)calloc((n),sizeof(t))) -#define _XkbTypedRealloc(o,n,t) \ - ((o)?(t *)realloc((o),(n)*sizeof(t)):_XkbTypedCalloc(n,t)) -#define _XkbClearElems(a,f,l,t) bzero(&(a)[f],((l)-(f)+1)*sizeof(t)) -#define _XkbFree(p) free(p) - -#ifndef PATH_MAX -#ifdef MAXPATHLEN -#define PATH_MAX MAXPATHLEN -#else -#define PATH_MAX 1024 -#endif -#endif - -#endif - -_XFUNCPROTOBEGIN - -extern char * _XkbDupString( - char * /* old_str */ -); - -extern int _XkbStrCaseCmp( - char * /* str1 */, - char * /* str2 */ -); -#define _XkbStrCaseEqual(s1,s2) (_XkbStrCaseCmp(s1,s2)==0) - -_XFUNCPROTOEND - -#endif /* _XKBFILEINT_H_ */ diff --git a/nx-X11/lib/xkbfile/cout.c b/nx-X11/lib/xkbfile/cout.c deleted file mode 100644 index eb97d1d73..000000000 --- a/nx-X11/lib/xkbfile/cout.c +++ /dev/null @@ -1,1034 +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_CONFIG_H -#include <config.h> -#endif -#include <stdio.h> -#include <ctype.h> -#include <stdlib.h> -#include <nx-X11/Xos.h> -#include <nx-X11/Xlib.h> -#include <nx-X11/XKBlib.h> -#include <nx-X11/extensions/XKBgeom.h> - -#include "XKMformat.h" -#include "XKBfileInt.h" - -#define lowbit(x) ((x) & (-(x))) - -static Bool -WriteCHdrVMods(FILE *file,Display *dpy,XkbDescPtr xkb) -{ -register int i,nOut; - - if ((!xkb)||(!xkb->names)||(!xkb->names->vmods)) - return False; - for (i=nOut=0;i<XkbNumVirtualMods;i++) { - if (xkb->names->vmods[i]!=None) { - fprintf(file,"%s#define vmod_%s %d\n",(nOut<1?"\n":""), - XkbAtomText(dpy,xkb->names->vmods[i],XkbCFile), - i); - nOut++; - } - } - for (i=nOut=0;i<XkbNumVirtualMods;i++) { - if (xkb->names->vmods[i]!=None) { - fprintf(file,"%s#define vmod_%sMask (1<<%d)\n", - (nOut<1?"\n":""), - XkbAtomText(dpy,xkb->names->vmods[i],XkbCFile) - ,i); - nOut++; - } - } - if (nOut>0) - fprintf(file,"\n"); - return True; -} - -static Bool -WriteCHdrKeycodes(FILE *file,XkbDescPtr xkb) -{ -Atom kcName; -register unsigned i; -char buf[8]; - - if ((!xkb)||(!xkb->names)||(!xkb->names->keys)) { - _XkbLibError(_XkbErrMissingNames,"WriteCHdrKeycodes",0); - return False; - } - kcName= xkb->names->keycodes; - buf[4]= '\0'; - if (xkb->names->keycodes!=None) - fprintf(file,"/* keycodes name is \"%s\" */\n", - XkbAtomText(xkb->dpy,kcName,XkbMessage)); - fprintf(file,"static XkbKeyNameRec keyNames[NUM_KEYS]= {\n"); - for (i=0;i<=xkb->max_key_code;i++) { - sprintf(buf,"\"%s\"",XkbKeyNameText(xkb->names->keys[i].name,XkbCFile)); - if (i!=xkb->max_key_code) { - fprintf(file," { %6s },",buf); - if ((i&3)==3) - fprintf(file,"\n"); - } - else { - fprintf(file," { %6s }\n",buf); - } - } - fprintf(file,"};\n"); - return True; -} - -static void -WriteTypePreserve( FILE * file, - Display * dpy, - char * prefix, - XkbDescPtr xkb, - XkbKeyTypePtr type) -{ -register unsigned i; -XkbModsPtr pre; - - fprintf(file,"static XkbModsRec preserve_%s[%d]= {\n",prefix, - type->map_count); - for (i=0,pre=type->preserve;i<type->map_count;i++,pre++) { - if (i!=0) - fprintf(file,",\n"); - fprintf(file," { %15s, ",XkbModMaskText(pre->mask,XkbCFile)); - fprintf(file,"%15s, ",XkbModMaskText(pre->real_mods,XkbCFile)); - fprintf(file,"%15s }",XkbVModMaskText(dpy,xkb,0,pre->vmods,XkbCFile)); - } - fprintf(file,"\n};\n"); - return; -} - -static void -WriteTypeInitFunc(FILE *file,Display *dpy,XkbDescPtr xkb) -{ -register unsigned i,n; -XkbKeyTypePtr type; -Atom * names; -char prefix[32]; - - fprintf(file,"\n\nstatic void\n"); - fprintf(file,"initTypeNames(DPYTYPE dpy)\n"); - fprintf(file,"{\n"); - for (i=0,type=xkb->map->types;i<xkb->map->num_types;i++,type++) { - strcpy(prefix,XkbAtomText(dpy,type->name,XkbCFile)); - if (type->name!=None) - fprintf(file," dflt_types[%d].name= GET_ATOM(dpy,\"%s\");\n",i, - XkbAtomText(dpy,type->name,XkbCFile)); - names= type->level_names; - if (names!=NULL) { - char *tmp; - for (n=0;n<type->num_levels;n++) { - if (names[n]==None) - continue; - tmp= XkbAtomText(dpy,names[n],XkbCFile); - if (tmp==NULL) - continue; - fprintf(file," lnames_%s[%d]= ",prefix,n); - fprintf(file,"GET_ATOM(dpy,\"%s\");\n",tmp); - } - } - } - fprintf(file,"}\n"); - return; -} - -static Bool -WriteCHdrKeyTypes(FILE *file,Display *dpy,XkbDescPtr xkb) -{ -register unsigned i,n; -XkbClientMapPtr map; -XkbKeyTypePtr type; -char prefix[32]; - - if ((!xkb)||(!xkb->map)||(!xkb->map->types)) { - _XkbLibError(_XkbErrMissingTypes,"WriteCHdrKeyTypes",0); - return False; - } - if (xkb->map->num_types<XkbNumRequiredTypes) { - _XkbLibError(_XkbErrMissingReqTypes,"WriteCHdrKeyTypes",0); - return 0; - } - map= xkb->map; - if ((xkb->names!=NULL)&&(xkb->names->types!=None)) { - fprintf(file,"/* types name is \"%s\" */\n", - XkbAtomText(dpy,xkb->names->types,XkbCFile)); - } - for (i=0,type=map->types;i<map->num_types;i++,type++) { - strcpy(prefix,XkbAtomText(dpy,type->name,XkbCFile)); - - if (type->map_count>0) { - XkbKTMapEntryPtr entry; - entry= type->map; - fprintf(file,"static XkbKTMapEntryRec map_%s[%d]= {\n",prefix, - type->map_count); - for (n=0;n<(unsigned)type->map_count;n++,entry++) { - if (n!=0) - fprintf(file,",\n"); - fprintf(file," { %d, %6d, { %15s, %15s, %15s } }", - entry->active, - entry->level, - XkbModMaskText(entry->mods.mask,XkbCFile), - XkbModMaskText(entry->mods.real_mods,XkbCFile), - XkbVModMaskText(dpy,xkb,0,entry->mods.vmods,XkbCFile)); - } - fprintf(file,"\n};\n"); - - if (type->preserve) - WriteTypePreserve(file,dpy,prefix,xkb,type); - } - if (type->level_names!=NULL) { - fprintf(file,"static Atom lnames_%s[%d];\n",prefix, - type->num_levels); - } - fprintf(file,"\n"); - } - fprintf(file,"static XkbKeyTypeRec dflt_types[]= {\n"); - for (i=0,type=map->types;i<(unsigned)map->num_types;i++,type++) { - strcpy(prefix,XkbAtomText(dpy,type->name,XkbCFile)); - if (i!=0) fprintf(file,",\n"); - fprintf(file," {\n { %15s, %15s, %15s },\n", - XkbModMaskText(type->mods.mask,XkbCFile), - XkbModMaskText(type->mods.real_mods,XkbCFile), - XkbVModMaskText(dpy,xkb,0,type->mods.vmods,XkbCFile)); - fprintf(file," %d,\n",type->num_levels); - fprintf(file," %d,",type->map_count); - if (type->map_count>0) - fprintf(file," map_%s,",prefix); - else fprintf(file," NULL,"); - if (type->preserve) - fprintf(file," preserve_%s,\n",prefix); - else fprintf(file," NULL,\n"); - if (type->level_names!=NULL) - fprintf(file," None, lnames_%s\n }",prefix); - else fprintf(file," None, NULL\n }"); - } - fprintf(file,"\n};\n"); - fprintf(file,"#define num_dflt_types (sizeof(dflt_types)/sizeof(XkbKeyTypeRec))\n"); - WriteTypeInitFunc(file,dpy,xkb); - return True; -} - -static Bool -WriteCHdrCompatMap(FILE *file,Display *dpy,XkbDescPtr xkb) -{ -register unsigned i; -XkbCompatMapPtr compat; -XkbSymInterpretPtr interp; - - if ((!xkb)||(!xkb->compat)||(!xkb->compat->sym_interpret)) { - _XkbLibError(_XkbErrMissingSymInterps,"WriteCHdrInterp",0); - return False; - } - compat= xkb->compat; - if ((xkb->names!=NULL)&&(xkb->names->compat!=None)) { - fprintf(file,"/* compat name is \"%s\" */\n", - XkbAtomText(dpy,xkb->names->compat,XkbCFile)); - } - fprintf(file,"static XkbSymInterpretRec dfltSI[%d]= {\n", - compat->num_si); - interp= compat->sym_interpret; - for (i=0;i<compat->num_si;i++,interp++) { - XkbAction *act; - act= (XkbAction *)&interp->act; - if (i!=0) fprintf(file,",\n"); - fprintf(file," { %s, ",XkbKeysymText(interp->sym,XkbCFile)); - fprintf(file,"0x%04x,\n",interp->flags); - fprintf(file," %s, ",XkbSIMatchText(interp->match,XkbCFile)); - fprintf(file,"%s,\n",XkbModMaskText(interp->mods,XkbCFile)); - fprintf(file," %d,\n",interp->virtual_mod); - fprintf(file," %s }",XkbActionText(dpy,xkb,act,XkbCFile)); - } - fprintf(file,"\n};\n"); - fprintf(file, - "#define num_dfltSI (sizeof(dfltSI)/sizeof(XkbSymInterpretRec))\n"); - fprintf(file,"\nstatic XkbCompatMapRec compatMap= {\n"); - fprintf(file," dfltSI,\n"); - fprintf(file," { /* group compatibility */\n "); - for (i=0;i<XkbNumKbdGroups;i++) { - XkbModsPtr gc; - gc= &xkb->compat->groups[i]; - fprintf(file,"%s{ %12s, %12s, %12s }", - ((i==0)?"":",\n "), - XkbModMaskText(gc->mask,XkbCFile), - XkbModMaskText(gc->real_mods,XkbCFile), - XkbVModMaskText(xkb->dpy,xkb,0,gc->vmods,XkbCFile)); - } - fprintf(file,"\n },\n"); - fprintf(file," num_dfltSI, num_dfltSI\n"); - fprintf(file,"};\n\n"); - return True; -} - -static Bool -WriteCHdrSymbols(FILE *file,XkbDescPtr xkb) -{ -register unsigned i; - - if ((!xkb)||(!xkb->map)||(!xkb->map->syms)||(!xkb->map->key_sym_map)) { - _XkbLibError(_XkbErrMissingSymbols,"WriteCHdrSymbols",0); - return False; - } - fprintf(file,"#define NUM_SYMBOLS %d\n",xkb->map->num_syms); - if (xkb->map->num_syms>0) { - register KeySym *sym; - sym= xkb->map->syms; - fprintf(file,"static KeySym symCache[NUM_SYMBOLS]= {\n"); - for (i=0;i<xkb->map->num_syms;i++,sym++) { - if (i==0) fprintf(file," "); - else if (i%4==0) fprintf(file,",\n "); - else fprintf(file,", "); - fprintf(file,"%15s",XkbKeysymText(*sym,XkbCFile)); - } - fprintf(file,"\n};\n"); - } - if (xkb->max_key_code>0) { - register XkbSymMapPtr map; - map= xkb->map->key_sym_map; - fprintf(file,"static XkbSymMapRec symMap[NUM_KEYS]= {\n"); - for (i=0;i<=xkb->max_key_code;i++,map++) { - if (i==0) fprintf(file," "); - else if ((i&3)==0) fprintf(file,",\n "); - else fprintf(file,", "); - fprintf(file, "{ %2d, 0x%x, %3d }", - map->kt_index[0], map->group_info, map->offset); - } - fprintf(file,"\n};\n"); - } - return True; -} - -static Bool -WriteCHdrClientMap(FILE *file,Display *dpy,XkbDescPtr xkb) -{ - if ((!xkb)||(!xkb->map)||(!xkb->map->syms)||(!xkb->map->key_sym_map)) { - _XkbLibError(_XkbErrMissingSymbols,"WriteCHdrClientMap",0); - return False; - } - if (!WriteCHdrKeyTypes(file,dpy,xkb)) - return False; - if (!WriteCHdrSymbols(file,xkb)) - return False; - fprintf(file,"static XkbClientMapRec clientMap= {\n"); - fprintf(file," NUM_TYPES, NUM_TYPES, types, \n"); - fprintf(file," NUM_SYMBOLS, NUM_SYMBOLS, symCache, symMap\n"); - fprintf(file,"};\n\n"); - return True; -} - -static Bool -WriteCHdrServerMap(FILE *file,Display *dpy,XkbDescPtr xkb) -{ -register unsigned i; - - if ((!xkb)||(!xkb->map)||(!xkb->map->syms)||(!xkb->map->key_sym_map)) { - _XkbLibError(_XkbErrMissingSymbols,"WriteCHdrServerMap",0); - return False; - } - if (xkb->server->num_acts>0) { - register XkbAnyAction *act; - act= (XkbAnyAction *)xkb->server->acts; - fprintf(file,"#define NUM_ACTIONS %d\n",xkb->server->num_acts); - fprintf(file,"static XkbAnyAction actionCache[NUM_ACTIONS]= {\n"); - for (i=0;i<xkb->server->num_acts;i++,act++) { - if (i==0) fprintf(file," "); - else fprintf(file,",\n "); - fprintf(file,"%s",XkbActionText(dpy,xkb,(XkbAction *)act,XkbCFile)); - } - fprintf(file,"\n};\n"); - } - fprintf(file,"static unsigned short keyActions[NUM_KEYS]= {\n"); - for (i=0;i<=xkb->max_key_code;i++) { - if (i==0) fprintf(file," "); - else if ((i&0xf)==0) fprintf(file,",\n "); - else fprintf(file,", "); - fprintf(file,"%2d",xkb->server->key_acts[i]); - } - fprintf(file,"\n};\n"); - fprintf(file,"static XkbBehavior behaviors[NUM_KEYS]= {\n"); - for (i=0;i<=xkb->max_key_code;i++) { - if (i==0) fprintf(file," "); - else if ((i&0x3)==0) fprintf(file,",\n "); - else fprintf(file,", "); - if (xkb->server->behaviors) { - fprintf(file,"%s", - XkbBehaviorText(xkb,&xkb->server->behaviors[i],XkbCFile)); - } - else fprintf(file,"{ 0, 0 }"); - } - fprintf(file,"\n};\n"); - fprintf(file,"static unsigned char explicit_parts[NUM_KEYS]= {\n"); - for (i=0;i<=xkb->max_key_code;i++) { - if (i==0) fprintf(file," "); - else if ((i&0x7)==0) fprintf(file,",\n "); - else fprintf(file,", "); - if ((xkb->server->explicit==NULL)||(xkb->server->explicit[i]==0)) - fprintf(file," 0"); - else fprintf(file,"0x%02x",xkb->server->explicit[i]); - } - fprintf(file,"\n};\n"); - fprintf(file,"static unsigned short vmodmap[NUM_KEYS]= {\n"); - for (i=0;i<xkb->max_key_code;i++) { - if (i==0) fprintf(file," "); - else if ((i&0x7)==0) fprintf(file,",\n "); - else fprintf(file,", "); - if ((xkb->server->vmodmap==NULL)||(xkb->server->vmodmap[i]==0)) - fprintf(file," 0"); - else fprintf(file,"0x%04x",xkb->server->vmodmap[i]); - } - fprintf(file,"};\n"); - fprintf(file,"static XkbServerMapRec serverMap= {\n"); - fprintf(file," %d, %d, (XkbAction *)actionCache,\n", - xkb->server->num_acts,xkb->server->num_acts); - fprintf(file," behaviors, keyActions, explicit_parts,\n"); - for (i=0;i<XkbNumVirtualMods;i++) { - if (i==0) fprintf(file," { "); - else if (i==8) fprintf(file,",\n "); - else fprintf(file,", "); - fprintf(file,"%3d",xkb->server->vmods[i]); - } - fprintf(file," },\n"); - fprintf(file," vmodmap\n"); - fprintf(file,"};\n\n"); - return True; -} - -static Bool -WriteCHdrIndicators(FILE *file,Display *dpy,XkbDescPtr xkb) -{ -register int i,nNames; -XkbIndicatorMapPtr imap; - - if (xkb->indicators==NULL) - return True; - fprintf(file, "static XkbIndicatorRec indicators= {\n"); - fprintf(file, " 0x%lx,\n {\n", - (long)xkb->indicators->phys_indicators); - for (imap=xkb->indicators->maps,i=nNames=0;i<XkbNumIndicators;i++,imap++) { - fprintf(file,"%s { 0x%02x, %s, 0x%02x, %s, { %s, ", - (i!=0?",\n":""), - imap->flags, - XkbIMWhichStateMaskText(imap->which_groups,XkbCFile), - imap->groups, - XkbIMWhichStateMaskText(imap->which_mods,XkbCFile), - XkbModMaskText(imap->mods.mask,XkbCFile)); - fprintf(file," %s, %s }, %s }", - XkbModMaskText(imap->mods.real_mods,XkbCFile), - XkbVModMaskText(dpy,xkb,0,imap->mods.vmods,XkbCFile), - XkbControlsMaskText(imap->ctrls,XkbCFile)); - if (xkb->names && (xkb->names->indicators[i]!=None)) - nNames++; - } - fprintf(file,"\n }\n};\n"); - if (nNames>0) { - fprintf(file,"static void\n"); - fprintf(file,"initIndicatorNames(DPYTYPE dpy,XkbDescPtr xkb)\n"); - fprintf(file,"{\n"); - for (i=0;i<XkbNumIndicators;i++) { - Atom name; - if (xkb->names->indicators[i]==None) - continue; - name= xkb->names->indicators[i]; - fprintf(file," xkb->names->indicators[%2d]= ",i); - fprintf(file,"GET_ATOM(dpy,\"%s\");\n", - XkbAtomText(dpy,name,XkbCFile)); - } - fprintf(file,"}\n"); - } - return True; -} - -static Bool -WriteCHdrGeomProps(FILE *file,XkbDescPtr xkb,XkbGeometryPtr geom) -{ - if (geom->num_properties>0) { - register int i; - fprintf(file,"\nstatic XkbPropertyRec g_props[%d]= {\n", - geom->num_properties); - for (i=0;i<geom->num_properties;i++) { - fprintf(file,"%s { \"%s\", \"%s\" }",(i==0?"":",\n"), - XkbStringText(geom->properties[i].name,XkbCFile), - XkbStringText(geom->properties[i].value,XkbCFile)); - } - fprintf(file,"\n};\n"); - } - return True; -} - -static Bool -WriteCHdrGeomColors(FILE *file,XkbDescPtr xkb,XkbGeometryPtr geom) -{ - if (geom->num_colors>0) { - register int i; - fprintf(file,"\nstatic XkbColorRec g_colors[%d]= {\n",geom->num_colors); - for (i=0;i<geom->num_colors;i++) { - fprintf(file,"%s { %3d, \"%s\" }",(i==0?"":",\n"), - geom->colors[i].pixel, - XkbStringText(geom->colors[i].spec,XkbCFile)); - } - fprintf(file,"\n};\n"); - } - return True; -} - -static Bool -WriteCHdrGeomOutlines(FILE *file,int nOL,XkbOutlinePtr ol,int shapeNdx) -{ -register int o,p; - - - for (o=0;o<nOL;o++) { - fprintf(file,"\nstatic XkbPointRec pts_sh%02do%02d[]= {\n",shapeNdx,o); - for (p=0;p<ol[o].num_points;p++) { - if (p==0) fprintf(file," "); - else if ((p&0x3)==0) fprintf(file,",\n "); - else fprintf(file,", "); - fprintf(file,"{ %4d, %4d }", - ol[o].points[p].x,ol[o].points[p].y); - } - fprintf(file,"\n};"); - } - fprintf(file,"\n\nstatic XkbOutlineRec ol_sh%02d[]= {\n",shapeNdx); - for (o=0;o<nOL;o++) { - fprintf(file,"%s { %d, %d, %d, pts_sh%02do%02d }", - (o==0?"":",\n"), - ol[o].num_points,ol[o].num_points, - ol[o].corner_radius,shapeNdx,o); - } - fprintf(file,"\n};\n"); - return True; -} - -static Bool -WriteCHdrGeomShapes(FILE *file,XkbDescPtr xkb,XkbGeometryPtr geom) -{ -register int s; -register XkbShapePtr shape; - - for (s=0,shape=geom->shapes;s<geom->num_shapes;s++,shape++) { - WriteCHdrGeomOutlines(file,shape->num_outlines,shape->outlines,s); - } - fprintf(file,"\n\nstatic XkbShapeRec g_shapes[%d]= {\n",geom->num_shapes); - for (s=0,shape=geom->shapes;s<geom->num_shapes;s++,shape++) { - fprintf(file,"%s { None, %3d, %3d, ol_sh%02d, ", - (s==0?"":",\n"),shape->num_outlines, - shape->num_outlines,s); - if (shape->approx) { - fprintf(file,"&ol_sh%02d[%2d], ",s, - XkbOutlineIndex(shape,shape->approx)); - } - else fprintf(file," NULL, "); - if (shape->primary) { - fprintf(file,"&ol_sh%02d[%2d],\n",s, - XkbOutlineIndex(shape,shape->primary)); - } - else fprintf(file," NULL,\n"); - fprintf(file," { %4d, %4d, %4d, %4d } }", - shape->bounds.x1,shape->bounds.y1, - shape->bounds.x2,shape->bounds.y2); - } - fprintf(file,"\n};\n"); - return True; -} - -static Bool -WriteCHdrGeomDoodads( FILE * file, - XkbDescPtr xkb, - XkbGeometryPtr geom, - XkbSectionPtr section, - int section_num) -{ -int nd,d; -XkbDoodadPtr doodad; -Display * dpy; - - dpy= xkb->dpy; - if (section==NULL) { - if (geom->num_doodads>0) { - fprintf(file,"static XkbDoodadRec g_doodads[%d];\n", - geom->num_doodads); - } - fprintf(file,"static void\n"); - fprintf(file,"_InitGeomDoodads(DPYTYPE dpy,XkbGeometryPtr geom)\n"); - fprintf(file,"{\n"); - fprintf(file,"register XkbDoodadPtr doodads;\n\n"); - fprintf(file," doodads= geom->doodads;\n"); - nd= geom->num_doodads; - doodad= geom->doodads; - } - else { - if (section->num_doodads>0) { - fprintf(file,"static XkbDoodadRec doodads_s%02d[%d];\n", - section_num,section->num_doodads); - } - fprintf(file,"static void\n"); - fprintf(file,"_InitS%02dDoodads(",section_num); - fprintf(file," DPYTYPE dpy,\n"); - fprintf(file," XkbGeometryPtr geom,\n"); - fprintf(file," XkbSectionPtr section)\n"); - fprintf(file,"{\n"); - fprintf(file,"register XkbDoodadPtr doodads;\n\n"); - fprintf(file," doodads= section->doodads;\n"); - nd= geom->num_doodads; - doodad= geom->doodads; - } - for (d=0;d<nd;d++,doodad++) { - if (d!=0) fprintf(file,"\n"); - fprintf(file," doodads[%d].any.name= GET_ATOM(dpy,\"%s\");\n",d, - XkbAtomText(dpy,doodad->any.name,XkbCFile)); - fprintf(file," doodads[%d].any.type= %s;\n",d, - XkbDoodadTypeText(doodad->any.type,XkbCFile)); - fprintf(file," doodads[%d].any.priority= %d;\n",d, - doodad->any.priority); - fprintf(file," doodads[%d].any.top= %d;\n",d,doodad->any.top); - fprintf(file," doodads[%d].any.left= %d;\n",d,doodad->any.left); - fprintf(file," doodads[%d].any.angle= %d;\n",d,doodad->any.angle); - switch (doodad->any.type) { - case XkbOutlineDoodad: - case XkbSolidDoodad: - fprintf(file," doodads[%d].shape.color_ndx= %d;\n",d, - doodad->shape.color_ndx); - fprintf(file," doodads[%d].shape.shape_ndx= %d;\n",d, - doodad->shape.shape_ndx); - break; - case XkbTextDoodad: - fprintf(file," doodads[%d].text.width= %d;\n",d, - doodad->text.width); - fprintf(file," doodads[%d].text.height= %d;\n",d, - doodad->text.height); - fprintf(file," doodads[%d].text.color_ndx= %d;\n",d, - doodad->text.color_ndx); - fprintf(file," doodads[%d].text.text= \"%s\";\n",d, - XkbStringText(doodad->text.text,XkbCFile)); - fprintf(file," doodads[%d].text.font= \"%s\";\n",d, - XkbStringText(doodad->text.font,XkbCFile)); - break; - case XkbIndicatorDoodad: - fprintf(file," doodads[%d].indicator.shape_ndx= %d;\n",d, - doodad->indicator.shape_ndx); - fprintf(file," doodads[%d].indicator.on_color_ndx= %d;\n",d, - doodad->indicator.on_color_ndx); - fprintf(file," doodads[%d].indicator.off_color_ndx= %d;\n",d, - doodad->indicator.off_color_ndx); - break; - case XkbLogoDoodad: - fprintf(file," doodads[%d].logo.color_ndx= %d;\n",d, - doodad->logo.color_ndx); - fprintf(file," doodads[%d].logo.shape_ndx= %d;\n",d, - doodad->logo.shape_ndx); - fprintf(file," doodads[%d].logo.logo_name= \"%s\";\n",d, - XkbStringText(doodad->logo.logo_name,XkbCFile)); - break; - } - } - fprintf(file,"}\n"); - return True; -} - -static Bool -WriteCHdrGeomOverlays( FILE * file, - XkbDescPtr xkb, - XkbSectionPtr section, - int section_num) -{ -register int o,r,k; -XkbOverlayPtr ol; -XkbOverlayRowPtr row; -XkbOverlayKeyPtr key; - - if (section->num_overlays<1) - return True; - for (o=0,ol=section->overlays;o<section->num_overlays;o++,ol++) { - for (r=0,row=ol->rows;r<ol->num_rows;r++,row++) { - fprintf(file,"static XkbOverlayKeyRec olkeys_s%02dr%02d[%d]= {\n", - section_num,r,row->num_keys); - for (k=0,key=row->keys;k<row->num_keys;k++,key++) { - fprintf(file,"%s { {\"%s\"}, {\"%s\"} }", - (k==0?"":",\n"), - XkbKeyNameText(key->over.name,XkbCFile), - XkbKeyNameText(key->under.name,XkbCFile)); - } - fprintf(file,"\n};\n"); - } - fprintf(file,"static XkbOverlayRowRec olrows_s%02d[%d]= {\n", - section_num,section->num_rows); - for (r=0,row=ol->rows;r<ol->num_rows;r++,row++) { - fprintf(file,"%s { %4d, %4d, %4d, olkeys_s%02dr%02d }", - (r==0?"":",\n"), - row->row_under,row->num_keys,row->num_keys, - section_num,r); - } - fprintf(file,"\n};\n"); - } - fprintf(file,"static XkbOverlayRec overlays_s%02d[%d]= {\n",section_num, - section->num_overlays); - for (o=0,ol=section->overlays;o<section->num_overlays;o++,ol++) { - fprintf(file,"%s {\n",(o==0?"":",\n")); - fprintf(file," None, /* name */\n"); - fprintf(file," NULL, /* section_under */\n"); - fprintf(file," %4d, /* num_rows */\n",ol->num_rows); - fprintf(file," %4d, /* sz_rows */\n",ol->num_rows); - fprintf(file," olrows_s%02d,\n",section_num); - fprintf(file," NULL /* bounds */\n"); - fprintf(file," }"); - } - fprintf(file,"\n};\n"); - fprintf(file,"static void\n"); - fprintf(file,"_InitS%02dOverlay(",section_num); - fprintf(file," DPYTYPE dpy,\n"); - fprintf(file," XkbGeometryPtr geom,\n"); - fprintf(file," XkbSectionPtr section)\n"); - fprintf(file,"{\n"); - fprintf(file,"XkbOverlayPtr ol;\n\n"); - fprintf(file," ol= section->overlays;\n"); - for (o=0,ol=section->overlays;o<section->num_overlays;o++,ol++) { - fprintf(file," ol[%2d].name= GET_ATOM(dpy,\"%s\");\n",o, - XkbAtomText(xkb->dpy,ol->name,XkbCFile)); - fprintf(file," ol[%2d].section_under= section;\n",o); - } - fprintf(file,"}\n"); - return True; -} - -static Bool -WriteCHdrGeomRows( FILE * file, - XkbDescPtr xkb, - XkbSectionPtr section, - int section_num) -{ -register int k,r; -register XkbRowPtr row; -register XkbKeyPtr key; - - for (r=0,row=section->rows;r<section->num_rows;r++,row++) { - fprintf(file,"static XkbKeyRec keys_s%02dr%02d[]= {\n",section_num,r); - for (k=0,key=row->keys;k<row->num_keys;k++,key++) { - fprintf(file,"%s { { \"%s\" }, %4d, %4d, %4d }", - (k==0?"":",\n"), - XkbKeyNameText(key->name.name,XkbCFile), - key->gap,key->shape_ndx,key->color_ndx); - } - fprintf(file,"\n};\n"); - } - fprintf(file,"static XkbRowRec rows_s%02d[]= {\n",section_num); - for (r=0,row=section->rows;r<section->num_rows;r++,row++) { - fprintf(file,"%s { %4d, %4d, %2d, %2d, %1d, keys_s%02dr%02d, ", - (r==0?"":",\n"), - row->top,row->left,row->num_keys,row->num_keys, - (row->vertical!=0), - section_num,r); - fprintf(file," { %4d, %4d, %4d, %4d } }", - row->bounds.x1,row->bounds.y1, - row->bounds.x2,row->bounds.y2); - } - fprintf(file,"\n};\n"); - return True; -} - -static Bool -WriteCHdrGeomSections(FILE *file,XkbDescPtr xkb,XkbGeometryPtr geom) -{ -register int s; -register XkbSectionPtr section; - - for (s=0,section=geom->sections;s<geom->num_sections;s++,section++) { - WriteCHdrGeomRows(file,xkb,section,s); -#ifdef NOTYET - if (section->num_doodads>0) - WriteCHdrGeomDoodads(file,xkb,geom,section,s); -#endif - if (section->num_overlays>0) - WriteCHdrGeomOverlays(file,xkb,section,s); - } - fprintf(file,"\nstatic XkbSectionRec g_sections[%d]= {\n", - geom->num_sections); - for (s=0,section=geom->sections;s<geom->num_sections;s++,section++) { - if (s!=0) fprintf(file,",\n"); - fprintf(file," {\n None, /* name */\n"); - fprintf(file," %4d, /* priority */\n",section->priority); - fprintf(file," %4d, /* top */\n",section->top); - fprintf(file," %4d, /* left */\n",section->left); - fprintf(file," %4d, /* width */\n",section->width); - fprintf(file," %4d, /* height */\n",section->height); - fprintf(file," %4d, /* angle */\n",section->angle); - fprintf(file," %4d, /* num_rows */\n",section->num_rows); - fprintf(file," %4d, /* num_doodads */\n",section->num_doodads); - fprintf(file," %4d, /* num_overlays */\n",section->num_overlays); - fprintf(file," %4d, /* sz_rows */\n",section->num_rows); - fprintf(file," %4d, /* sz_doodads */\n",section->num_doodads); - fprintf(file," %4d, /* sz_overlays */\n",section->num_overlays); - if (section->num_rows>0) - fprintf(file," rows_s%02d,\n",s); - else fprintf(file," NULL, /* rows */\n"); - if (section->num_doodads>0) - fprintf(file," doodads_s%02d,\n",s); - else fprintf(file," NULL, /* doodads */\n"); - fprintf(file," { %4d, %4d, %4d, %4d }, /* bounds */\n", - section->bounds.x1,section->bounds.y1, - section->bounds.x2,section->bounds.y2); - if (section->num_overlays>0) - fprintf(file," overlays_s%02d\n",s); - else fprintf(file," NULL /* overlays */\n"); - fprintf(file," }"); - } - fprintf(file,"\n};\n"); - fprintf(file,"\nstatic Bool\n"); - fprintf(file,"_InitSections(DPYTYPE dpy,XkbGeometryPtr geom)\n"); - fprintf(file,"{\nXkbSectionPtr sections;\n\n"); - fprintf(file," sections= geom->sections;\n"); - for (s=0,section=geom->sections;s<geom->num_sections;s++,section++) { - if (section->num_doodads>0) { - fprintf(file," _InitS%02dDoodads(dpy,geom,§ions[%d]);\n", - s,s); - } - if (section->num_overlays>0) { - fprintf(file," _InitS%02dOverlays(dpy,geom,§ions[%d]);\n", - s,s); - } - } - fprintf(file,"}\n"); - return True; -} - -static Bool -WriteCHdrGeomAliases(FILE *file,XkbDescPtr xkb,XkbGeometryPtr geom) -{ - if (geom->num_key_aliases>0) { - register int i; - fprintf(file,"\nstatic XkbKeyAliasRec g_aliases[%d]= {\n", - geom->num_key_aliases); - for (i=0;i<geom->num_key_aliases;i++) { - fprintf(file,"%s { \"%s\", \"%s\" }",(i==0?"":",\n"), - XkbKeyNameText(geom->key_aliases[i].real,XkbCFile), - XkbKeyNameText(geom->key_aliases[i].alias,XkbCFile)); - } - fprintf(file,"\n};\n"); - } - return True; -} - -static Bool -WriteCHdrGeometry(FILE *file,XkbDescPtr xkb) -{ -XkbGeometryPtr geom; -register int i; - - if ((!xkb)||(!xkb->geom)) { - _XkbLibError(_XkbErrMissingGeometry,"WriteCHdrGeometry",0); - return False; - } - geom= xkb->geom; - WriteCHdrGeomProps(file,xkb,geom); - WriteCHdrGeomColors(file,xkb,geom); - WriteCHdrGeomShapes(file,xkb,geom); - WriteCHdrGeomSections(file,xkb,geom); - WriteCHdrGeomDoodads(file,xkb,geom,NULL,0); - WriteCHdrGeomAliases(file,xkb,geom); - fprintf(file,"\nstatic XkbGeometryRec geom= {\n"); - fprintf(file," None, /* name */\n"); - fprintf(file," %d, %d, /* width, height */\n",geom->width_mm, - geom->height_mm); - if (geom->label_font) { - fprintf(file," \"%s\",/* label font */\n", - XkbStringText(geom->label_font,XkbCFile)); - } - else fprintf(file," NULL, /* label font */\n"); - if (geom->label_color) { - fprintf(file," &g_colors[%d], /* label color */\n", - XkbGeomColorIndex(geom,geom->label_color)); - } - else fprintf(file," NULL, /* label color */\n"); - if (geom->base_color) { - fprintf(file," &g_colors[%d], /* base color */\n", - XkbGeomColorIndex(geom,geom->base_color)); - } - else fprintf(file," NULL, /* base color */\n"); - fprintf(file," %d, %d, %d, /* sz: props, colors, shapes */\n", - geom->num_properties,geom->num_colors, - geom->num_shapes); - fprintf(file," %d, %d, %d, /* sz: sections, doodads, aliases */\n", - geom->num_sections,geom->num_doodads, - geom->num_key_aliases); - fprintf(file," %d, %d, %d, /* num: props, colors, shapes */\n", - geom->num_properties,geom->num_colors, - geom->num_shapes); - fprintf(file," %d, %d, %d, /* num: sections, doodads, aliases */\n", - geom->num_sections,geom->num_doodads, - geom->num_key_aliases); - fprintf(file," %s, %s, %s,\n", - (geom->num_properties>0?"g_props":"NULL"), - (geom->num_colors>0?"g_colors":"NULL"), - (geom->num_shapes>0?"g_shapes":"NULL")); - fprintf(file," %s, %s, %s\n", - (geom->num_sections>0?"g_sections":"NULL"), - (geom->num_doodads>0?"g_doodads":"NULL"), - (geom->num_key_aliases>0?"g_aliases":"NULL")); - fprintf(file,"};\n\n"); - fprintf(file,"static Bool\n"); - fprintf(file,"_InitHdrGeom(DPYTYPE dpy,XkbGeometryPtr geom)\n"); - fprintf(file,"{\n"); - if (geom->name!=None) { - fprintf(file," geom->name= GET_ATOM(dpy,\"%s\");\n", - XkbAtomText(xkb->dpy,geom->name,XkbCFile)); - } - for (i=0;i<geom->num_shapes;i++) { - fprintf(file," geom->shapes[%2d].name= GET_ATOM(dpy,\"%s\");\n",i, - XkbAtomText(xkb->dpy,geom->shapes[i].name,XkbCFile)); - } - if (geom->num_doodads>0) - fprintf(file," _InitGeomDoodads(dpy,geom);\n"); - fprintf(file," _InitSections(dpy,geom);\n"); - fprintf(file,"}\n\n"); - return True; -} - -static Bool -WriteCHdrGeomFile(FILE *file,XkbFileInfo *result) -{ -Bool ok; - - ok= WriteCHdrGeometry(file,result->xkb); - return ok; -} - -static Bool -WriteCHdrLayout(FILE *file,XkbFileInfo *result) -{ -Bool ok; -XkbDescPtr xkb; - - xkb= result->xkb; - ok= WriteCHdrVMods(file,xkb->dpy,xkb); - ok= WriteCHdrKeycodes(file,xkb)&&ok; - ok= WriteCHdrSymbols(file,xkb)&&ok; - ok= WriteCHdrGeometry(file,xkb)&&ok; - return ok; -} - -static Bool -WriteCHdrSemantics(FILE *file,XkbFileInfo *result) -{ -Bool ok; -XkbDescPtr xkb; - - xkb= result->xkb; - ok= WriteCHdrVMods(file,xkb->dpy,xkb); - ok= WriteCHdrKeyTypes(file,xkb->dpy,xkb)&&ok; - ok= WriteCHdrCompatMap(file,xkb->dpy,xkb)&&ok; - ok= WriteCHdrIndicators(file,xkb->dpy,xkb)&&ok; - return ok; -} - -static Bool -WriteCHdrKeymap(FILE *file,XkbFileInfo *result) -{ -Bool ok; -XkbDescPtr xkb; - - xkb= result->xkb; - ok= WriteCHdrVMods(file,xkb->dpy,xkb); - ok= ok&&WriteCHdrKeycodes(file,xkb); - ok= ok&&WriteCHdrClientMap(file,xkb->dpy,xkb); - ok= ok&&WriteCHdrServerMap(file,xkb->dpy,xkb); - ok= ok&&WriteCHdrCompatMap(file,xkb->dpy,xkb); - ok= WriteCHdrIndicators(file,xkb->dpy,xkb)&&ok; - ok= ok&&WriteCHdrGeometry(file,xkb); - return ok; -} - -Bool -XkbWriteCFile(FILE *out,char *name,XkbFileInfo *result) -{ -Bool ok; -XkbDescPtr xkb; -Bool (*func)( - FILE * /* file*/, - XkbFileInfo * /* result */ -); - - switch (result->type) { - case XkmSemanticsFile: - func= WriteCHdrSemantics; - break; - case XkmLayoutFile: - func= WriteCHdrLayout; - break; - case XkmKeymapFile: - func= WriteCHdrKeymap; - break; - case XkmGeometryIndex: - case XkmGeometryFile: - func= WriteCHdrGeomFile; - break; - default: - _XkbLibError(_XkbErrIllegalContents,"XkbWriteCFile",result->type); - return False; - } - xkb= result->xkb; - if (out==NULL) { - _XkbLibError(_XkbErrFileCannotOpen,"XkbWriteCFile",0); - ok= False; - } - else { - char *tmp,*hdrdef; - tmp= (char *)strrchr(name,'/'); - if (tmp==NULL) - tmp= name; - else tmp++; - hdrdef= (char *)_XkbCalloc(strlen(tmp)+1,sizeof(char)); - if (hdrdef) { - strcpy(hdrdef,tmp); - tmp= hdrdef; - while (*tmp) { - if (islower(*tmp)) *tmp= toupper(*tmp); - else if (!isalnum(*tmp)) *tmp= '_'; - tmp++; - } - fprintf(out,"/* This file generated automatically by xkbcomp */\n"); - fprintf(out,"/* DO NOT EDIT */\n"); - fprintf(out,"#ifndef %s\n",hdrdef); - fprintf(out,"#define %s 1\n\n",hdrdef); - } - fprintf(out,"#ifndef XKB_IN_SERVER\n"); - fprintf(out,"#define GET_ATOM(d,s) XInternAtom(d,s,0)\n"); - fprintf(out,"#define DPYTYPE Display *\n"); - fprintf(out,"#else\n"); - fprintf(out,"#define GET_ATOM(d,s) MakeAtom(s,strlen(s),1)\n"); - fprintf(out,"#define DPYTYPE char *\n"); - fprintf(out,"#endif\n"); - fprintf(out,"#define NUM_KEYS %d\n",xkb->max_key_code+1); - ok= (*func)(out,result); - if (hdrdef) - fprintf(out,"#endif /* %s */\n",hdrdef); - } - - if (!ok) { - return False; - } - return True; -} diff --git a/nx-X11/lib/xkbfile/magic b/nx-X11/lib/xkbfile/magic deleted file mode 100644 index 9c433ad02..000000000 --- a/nx-X11/lib/xkbfile/magic +++ /dev/null @@ -1,11 +0,0 @@ -# $Xorg: magic,v 1.3 2000/08/17 19:46:43 cpqbld Exp $ -# Here are some lines you can add to /etc/magic -# to identify XKM (compiled X keymap) files -# and determine their version and the byte ordering -# with which they were compiled -1 string mkx Compiled XKB Keymap: lsb, ->0 byte >0 version %d ->0 byte =0 obsolete -0 string xkm Compiled XKB Keymap: msb, ->3 byte >0 version %d ->0 byte =0 obsolete diff --git a/nx-X11/lib/xkbfile/srvmisc.c b/nx-X11/lib/xkbfile/srvmisc.c deleted file mode 100644 index 8d2e228ed..000000000 --- a/nx-X11/lib/xkbfile/srvmisc.c +++ /dev/null @@ -1,214 +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_CONFIG_H -#include <config.h> -#endif -#include <stdio.h> -#include <ctype.h> -#include <stdlib.h> -#include <nx-X11/Xlib.h> -#include <nx-X11/XKBlib.h> -#include <nx-X11/extensions/XKBgeom.h> - -#include "XKMformat.h" -#include "XKBfileInt.h" - -Bool -XkbWriteToServer(XkbFileInfo *result) -{ -XkbDescPtr xkb; -Display * dpy; - - if ((result==NULL)||(result->xkb==NULL)||(result->xkb->dpy==NULL)) - return False; - xkb= result->xkb; - dpy= xkb->dpy; - if (!XkbSetMap(dpy,XkbAllMapComponentsMask,xkb)) - return False; - if (!XkbSetIndicatorMap(dpy,~0,xkb)) - return False; -#ifdef NOTYET - if (!XkbSetControls(dpy,XkbAllControlsMask,xkb)) - return False; -#endif - if (!XkbSetCompatMap(dpy,XkbAllCompatMask,xkb,True)) - return False; - if (!XkbSetNames(dpy,XkbAllNamesMask,0,xkb->map->num_types,xkb)) - return False; - if (xkb->geom) { - if (XkbSetGeometry(dpy,xkb->device_spec,xkb->geom)!=Success) - return False; - } - return True; -#ifdef NOTYET - switch (result->type) { - case XkmSemanticsFile: - func= WriteCHdrSemantics; - break; - case XkmLayoutFile: - func= WriteCHdrLayout; - break; - case XkmKeymapFile: - func= WriteCHdrKeymap; - break; - default: - _XkbLibError(_XkbErrIllegalContents,"XkbWriteToServer",result->type); - break; - } - return ok; -#endif -} - -unsigned -XkbReadFromServer(Display *dpy,unsigned need,unsigned want,XkbFileInfo *result) -{ -unsigned which= need|want; -unsigned tmp = 0; - - if ((result==NULL)||(dpy==NULL)) - return which; - - if (which&XkmSymbolsMask) tmp= XkbAllMapComponentsMask; - else if (which&XkmTypesMask) tmp= XkbKeyTypesMask; - if (result->xkb==NULL) { - result->xkb= XkbGetMap(dpy,tmp,XkbUseCoreKbd); - if (!result->xkb) - return which; - else which&= ~(XkmSymbolsMask|XkmTypesMask|XkmVirtualModsMask); - } - else if ((tmp)&&(XkbGetUpdatedMap(dpy,tmp,result->xkb)==Success)) - which&= ~(XkmSymbolsMask|XkmTypesMask|XkmVirtualModsMask); - - if (which&XkmIndicatorsMask) { - if (XkbGetIndicatorMap(dpy,XkbAllIndicatorsMask,result->xkb)==Success) - which&= ~XkmIndicatorsMask; - } - - if (which&XkmCompatMapMask) { - if (XkbGetCompatMap(dpy,XkbAllCompatMask,result->xkb)==Success) - which&= ~XkmCompatMapMask; - } - if (which&XkmGeometryMask) { - if (XkbGetGeometry(dpy,result->xkb)==Success) - which&= ~XkmGeometryMask; - } - XkbGetNames(dpy,XkbAllNamesMask,result->xkb); - return which; -} - -Status -XkbChangeKbdDisplay(Display *newDpy,XkbFileInfo *result) -{ -register int i; -XkbDescPtr xkb; -Display * oldDpy; -Atom * atm; - - if ((result->xkb==NULL)||(result->xkb->dpy==newDpy)) - return Success; - xkb= result->xkb; - oldDpy= xkb->dpy; - if (xkb->names) { - XkbNamesPtr names= xkb->names; - names->keycodes= XkbChangeAtomDisplay(oldDpy,newDpy,names->keycodes); - names->geometry= XkbChangeAtomDisplay(oldDpy,newDpy,names->geometry); - names->symbols= XkbChangeAtomDisplay(oldDpy,newDpy,names->symbols); - names->types= XkbChangeAtomDisplay(oldDpy,newDpy,names->types); - names->compat= XkbChangeAtomDisplay(oldDpy,newDpy,names->compat); - names->phys_symbols= XkbChangeAtomDisplay(oldDpy,newDpy, - names->phys_symbols); - for (i=0,atm=names->vmods;i<XkbNumVirtualMods;i++,atm++) { - *atm= XkbChangeAtomDisplay(oldDpy,newDpy,*atm); - } - for (i=0,atm=names->indicators;i<XkbNumIndicators;i++,atm++) { - *atm= XkbChangeAtomDisplay(oldDpy,newDpy,*atm); - } - for (i=0,atm=names->groups;i<XkbNumKbdGroups;i++,atm++) { - *atm= XkbChangeAtomDisplay(oldDpy,newDpy,*atm); - } - for (i=0,atm=names->radio_groups;i<names->num_rg;i++,atm++) { - *atm= XkbChangeAtomDisplay(oldDpy,newDpy,*atm); - } - } - if (xkb->map) { - register int t; - XkbKeyTypePtr type; - for (t=0,type=xkb->map->types;t<xkb->map->num_types;t++,type++) { - type->name= XkbChangeAtomDisplay(oldDpy,newDpy,type->name); - if (type->level_names!=NULL) { - for (i=0,atm=type->level_names;i<type->num_levels;i++,atm++) { - *atm= XkbChangeAtomDisplay(oldDpy,newDpy,*atm); - } - } - } - } - if (xkb->geom) { - XkbGeometryPtr geom= xkb->geom; - geom->name= XkbChangeAtomDisplay(oldDpy,newDpy,geom->name); - if (geom->shapes) { - register int s; - XkbShapePtr shape; - for (s=0,shape=geom->shapes;s<geom->num_shapes;s++,shape++) { - shape->name= XkbChangeAtomDisplay(oldDpy,newDpy,shape->name); - } - } - if (geom->sections) { - register int s; - XkbSectionPtr section; - for (s=0,section=geom->sections;s<geom->num_sections;s++,section++){ - section->name=XkbChangeAtomDisplay(oldDpy,newDpy,section->name); - if (section->doodads) { - register int d; - XkbDoodadPtr doodad; - for (d=0,doodad=section->doodads;d<section->num_doodads; - d++,doodad++) { - doodad->any.name= XkbChangeAtomDisplay(oldDpy,newDpy, - doodad->any.name); - } - } - if (section->overlays) { - register int o; - register XkbOverlayPtr ol; - for (o=0,ol=section->overlays;o<section->num_overlays; - o++,ol++) { - ol->name= XkbChangeAtomDisplay(oldDpy,newDpy,ol->name); - } - } - } - } - if (geom->doodads) { - register int d; - XkbDoodadPtr doodad; - for (d=0,doodad=geom->doodads;d<geom->num_doodads;d++,doodad++) { - doodad->any.name= XkbChangeAtomDisplay(oldDpy,newDpy, - doodad->any.name); - } - } - } - xkb->dpy= newDpy; - return Success; -} diff --git a/nx-X11/lib/xkbfile/xkbatom.c b/nx-X11/lib/xkbfile/xkbatom.c deleted file mode 100644 index 3669f6805..000000000 --- a/nx-X11/lib/xkbfile/xkbatom.c +++ /dev/null @@ -1,243 +0,0 @@ -/*********************************************************** - -Copyright 1987, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -documentation for any purpose is hereby granted without fee, provided that -the above copyright notice appear in all copies and that both that -copyright notice and this permission notice appear in supporting -documentation. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - - -Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. - - All Rights Reserved - -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 Digital not be -used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. - -DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING -ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL -DIGITAL 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. - -******************************************************************/ - -/************************************************************ - Copyright 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_CONFIG_H -#include <config.h> -#endif -#include <stdio.h> -#include <ctype.h> -#include <stdlib.h> -#include <nx-X11/Xos.h> -#include <nx-X11/Xlib.h> -#include <nx-X11/XKBlib.h> - -#include "XKMformat.h" -#include "XKBfileInt.h" - -/***====================================================================***/ - -#define InitialTableSize 100 - -typedef struct _Node { - struct _Node *left, *right; - Atom a; - unsigned int fingerPrint; - char *string; -} NodeRec, *NodePtr; - -#define BAD_RESOURCE 0xe0000000 - -static Atom lastAtom = None; -static NodePtr atomRoot = (NodePtr)NULL; -static unsigned long tableLength; -static NodePtr *nodeTable; - -static Atom -_XkbMakeAtom(char *string,unsigned len,Bool makeit) -{ - register NodePtr * np; - unsigned i; - int comp; - register unsigned int fp = 0; - - np = &atomRoot; - for (i = 0; i < (len+1)/2; i++) - { - fp = fp * 27 + string[i]; - fp = fp * 27 + string[len - 1 - i]; - } - while (*np != (NodePtr) NULL) - { - if (fp < (*np)->fingerPrint) - np = &((*np)->left); - else if (fp > (*np)->fingerPrint) - np = &((*np)->right); - else - { /* now start testing the strings */ - comp = strncmp(string, (*np)->string, (int)len); - if ((comp < 0) || ((comp == 0) && (len < strlen((*np)->string)))) - np = &((*np)->left); - else if (comp > 0) - np = &((*np)->right); - else - return(*np)->a; - } - } - if (makeit) - { - register NodePtr nd; - - nd = (NodePtr) _XkbAlloc(sizeof(NodeRec)); - if (!nd) - return BAD_RESOURCE; - nd->string = (char *) _XkbAlloc(len + 1); - if (!nd->string) { - _XkbFree(nd); - return BAD_RESOURCE; - } - strncpy(nd->string, string, (int)len); - nd->string[len] = 0; - if ((lastAtom + 1) >= tableLength) { - NodePtr *table; - - table = (NodePtr *) _XkbRealloc(nodeTable, - tableLength * (2 * sizeof(NodePtr))); - if (!table) { - if (nd->string != string) - _XkbFree(nd->string); - _XkbFree(nd); - return BAD_RESOURCE; - } - tableLength <<= 1; - nodeTable = table; - } - *np = nd; - nd->left = nd->right = (NodePtr) NULL; - nd->fingerPrint = fp; - nd->a = (++lastAtom); - *(nodeTable+lastAtom) = nd; - return nd->a; - } - else - return None; -} - -static char * -_XkbNameForAtom(Atom atom) -{ - NodePtr node; - if (atom > lastAtom) return 0; - if ((node = nodeTable[atom]) == (NodePtr)NULL) return 0; - return node->string; -} - -static void -_XkbInitAtoms(void) -{ - tableLength = InitialTableSize; - nodeTable = (NodePtr *)_XkbAlloc(InitialTableSize*sizeof(NodePtr)); - nodeTable[None] = (NodePtr)NULL; -} - -/***====================================================================***/ - -char * -XkbAtomGetString(Display *dpy,Atom atm) -{ - if (atm==None) - return NULL; - if (dpy==NULL) - return _XkbNameForAtom(atm); - return XGetAtomName(dpy,atm); -} - -/***====================================================================***/ - -Atom -XkbInternAtom(Display *dpy,char *name,Bool onlyIfExists) -{ - if (name==NULL) - return None; - if (dpy==NULL) { - return _XkbMakeAtom(name, strlen(name), (!onlyIfExists)); - } - return XInternAtom(dpy,name,onlyIfExists); -} - -/***====================================================================***/ - -Atom -XkbChangeAtomDisplay(Display *oldDpy,Display *newDpy,Atom atm) -{ -char *tmp; - - if (atm!=None) { - tmp= XkbAtomGetString(oldDpy,atm); - if (tmp!=NULL) - return XkbInternAtom(newDpy,tmp,False); - } - return None; -} - -/***====================================================================***/ - -void -XkbInitAtoms(Display *dpy) -{ -static int been_here= 0; - if ((dpy==NULL)&&(!been_here)) { - _XkbInitAtoms(); - been_here= 1; - } - return; -} diff --git a/nx-X11/lib/xkbfile/xkbbells.c b/nx-X11/lib/xkbfile/xkbbells.c deleted file mode 100644 index 944cefd9f..000000000 --- a/nx-X11/lib/xkbfile/xkbbells.c +++ /dev/null @@ -1,103 +0,0 @@ -/************************************************************ - Copyright (c) 1995 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. - - ********************************************************/ -/* $XFree86$ */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif -#include <nx-X11/Xlib.h> -#include <nx-X11/XKBlib.h> -#include "XKBbells.h" - -static char *_xkbStdBellNames[XkbBI_NumBells] = { - "Info", - "Warning", - "MinorError", - "MajorError", - "BadValue", - "InvalidLocation", - "Question", - "Start", - "End", - "Success", - "Failure", - "Wait", - "Proceed", - "Ignore", - "Iconify", - "Deconify", - "Open", - "Close", - "TerminalBell", - "MarginBell", - "CursorStuck", - "NewMail", - "LaunchApp", - "AppDeath", - "ImAlive", - "ClockChimeHour", - "ClockChimeHalf", - "ClockChimeQuarter", - "RepeatingLastBell", - "ComposeFail", - "AX_FeatureOn", - "AX_FeatureOff", - "AX_FeatureChange", - "AX_IndicatorOn", - "AX_IndicatorOff", - "AX_IndicatorChange", - "AX_SlowKeysWarning", - "AX_SlowKeyPress", - "AX_SlowKeyAccept", - "AX_SlowKeyReject", - "AX_SlowKeyRelease", - "AX_BounceKeyReject", - "AX_StickyLatch", - "AX_StickyLock", - "AX_StickyUnlock" -}; - -static Atom _xkbStdBellAtoms[XkbBI_NumBells]; - -Bool -XkbStdBell(Display *dpy,Window win,int percent,int bellDef) -{ - if ((bellDef<0)||(bellDef>=XkbBI_NumBells)) - bellDef= XkbBI_Info; - if (_xkbStdBellAtoms[bellDef]==None) - _xkbStdBellAtoms[bellDef]= XInternAtom(dpy,_xkbStdBellNames[bellDef],0); - return XkbBell(dpy,win,percent,_xkbStdBellAtoms[bellDef]); -} - -Bool -XkbStdBellEvent(Display *dpy,Window win,int percent,int bellDef) -{ - if ((bellDef<0)||(bellDef>=XkbBI_NumBells)) - bellDef= XkbBI_Info; - if (_xkbStdBellAtoms[bellDef]==None) - _xkbStdBellAtoms[bellDef]= XInternAtom(dpy,_xkbStdBellNames[bellDef],0); - return XkbBellEvent(dpy,win,percent,_xkbStdBellAtoms[bellDef]); -} diff --git a/nx-X11/lib/xkbfile/xkbdraw.c b/nx-X11/lib/xkbfile/xkbdraw.c deleted file mode 100644 index 42d8ff6cc..000000000 --- a/nx-X11/lib/xkbfile/xkbdraw.c +++ /dev/null @@ -1,133 +0,0 @@ -/************************************************************ - Copyright (c) 1995 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_CONFIG_H -#include <config.h> -#endif -#include <stdio.h> -#include <ctype.h> -#include <stdlib.h> - -#include <nx-X11/Xos.h> -#include <nx-X11/Xfuncs.h> -#include <nx-X11/Xlib.h> -#include <nx-X11/keysym.h> -#include <nx-X11/XKBlib.h> -#include <nx-X11/extensions/XKBgeom.h> -#include "XKMformat.h" -#include "XKBfileInt.h" - -static void -_XkbAddDrawable(XkbDrawablePtr *pfirst,XkbDrawablePtr *plast,XkbDrawablePtr tmp) -{ -XkbDrawablePtr old; - - if (*pfirst==NULL) { - *pfirst= *plast= tmp; - } - else if (tmp->priority>=(*plast)->priority) { - (*plast)->next= tmp; - *plast= tmp; - } - else if (tmp->priority<(*pfirst)->priority) { - tmp->next= (*pfirst); - (*pfirst)= tmp; - } - else { - old= *pfirst; - while ((old->next)&&(old->next->priority<=tmp->priority)) { - old= old->next; - } - tmp->next= old->next; - old->next= tmp; - } - return; -} - -XkbDrawablePtr -XkbGetOrderedDrawables(XkbGeometryPtr geom,XkbSectionPtr section) -{ -XkbDrawablePtr first,last,tmp; -int i; - - first= last= NULL; - if (geom!=NULL) { - XkbSectionPtr section; - XkbDoodadPtr doodad; - for (i=0,section=geom->sections;i<geom->num_sections;i++,section++) { - tmp= _XkbTypedCalloc(1,XkbDrawableRec); - if (!tmp) { - XkbFreeOrderedDrawables(first); - return NULL; - } - tmp->type= XkbDW_Section; - tmp->priority= section->priority; - tmp->u.section= section; - tmp->next= NULL; - _XkbAddDrawable(&first,&last,tmp); - } - for (i=0,doodad=geom->doodads;i<geom->num_doodads;i++,doodad++) { - tmp= _XkbTypedCalloc(1,XkbDrawableRec); - if (!tmp) { - XkbFreeOrderedDrawables(first); - return NULL; - } - tmp->type= XkbDW_Doodad; - tmp->priority= doodad->any.priority; - tmp->u.doodad= doodad; - tmp->next= NULL; - _XkbAddDrawable(&first,&last,tmp); - } - } - if (section!=NULL) { - XkbDoodadPtr doodad; - for (i=0,doodad=section->doodads;i<section->num_doodads;i++,doodad++) { - tmp= _XkbTypedCalloc(1,XkbDrawableRec); - if (!tmp) { - XkbFreeOrderedDrawables(first); - return NULL; - } - tmp->type= XkbDW_Doodad; - tmp->priority= doodad->any.priority; - tmp->u.doodad= doodad; - tmp->next= NULL; - _XkbAddDrawable(&first,&last,tmp); - } - } - return first; -} - -void -XkbFreeOrderedDrawables(XkbDrawablePtr draw) -{ -XkbDrawablePtr tmp; - - for (;draw!=NULL;draw=tmp) { - tmp= draw->next; - _XkbFree(draw); - } - return; -} diff --git a/nx-X11/lib/xkbfile/xkbfile-def.cpp b/nx-X11/lib/xkbfile/xkbfile-def.cpp deleted file mode 100644 index 3e680a75e..000000000 --- a/nx-X11/lib/xkbfile/xkbfile-def.cpp +++ /dev/null @@ -1,96 +0,0 @@ -LIBRARY xkbfile -VERSION LIBRARY_VERSION -EXPORTS - XkbAccessXDetailText - XkbActionText - XkbActionTypeText - XkbAtomGetString - XkbAtomText - XkbBehaviorText - XkbCFAddModByName - XkbCFAddPrivate - XkbCFApplyMods - XkbCFApplyRtrnValues - XkbCFBindMods - XkbCFDup - XkbCFFree - XkbCFFreeRtrn - XkbCFParse - XkbCFReportError - XkbCFScan - XkbChangeAtomDisplay - XkbChangeKbdDisplay - XkbConfigText - XkbControlsMaskText - XkbConvertGetByNameComponents - XkbConvertXkbComponents - XkbDetermineFileType - XkbDoodadTypeText - XkbEnsureSafeMapName - XkbFindKeycodeByName - XkbFreeOrderedDrawables - XkbGeomFPText - XkbGetOrderedDrawables - XkbIMWhichStateMaskText - XkbIndentText - XkbInitAtoms - XkbInternAtom - XkbKeyNameText - XkbKeysymText - XkbLookupCanonicalRGBColor - XkbLookupGroupAndLevel - XkbMergeFile - XkbModIndexText - XkbModMaskText - XkbNKNDetailMaskText - XkbNameMatchesPattern - XkbRF_AddGroup - XkbRF_AddRule - XkbRF_AddVarDesc - XkbRF_AddVarDescCopy - XkbRF_AddVarToDescribe - XkbRF_Create - XkbRF_Free - XkbRF_GetComponents - XkbRF_GetNamesProp - XkbRF_Load - XkbRF_LoadDescriptions - XkbRF_LoadDescriptionsByName - XkbRF_LoadRules - XkbRF_LoadRulesByName - XkbRF_SetNamesProp - XkbReadFromServer - XkbSIMatchText - XkbStdBell - XkbStdBellEvent - XkbStringText - XkbVModIndexText - XkbVModMaskText - XkbWriteCFile - XkbWriteToServer - XkbWriteXKBCompatMap - XkbWriteXKBFile - XkbWriteXKBGeometry - XkbWriteXKBKeyTypes - XkbWriteXKBKeycodes - XkbWriteXKBKeymap - XkbWriteXKBKeymapForNames - XkbWriteXKBLayout - XkbWriteXKBSemantics - XkbWriteXKBSymbols - XkbWriteXKMFile - XkmFindTOCEntry - XkmProbe - XkmReadFile - XkmReadFileSection - XkmReadFileSectionName - XkmReadTOC -#ifdef __UNIXOS2__ - _XkbStrCaseCmp - XkbCFDflts - _XkbErrLocation - _XkbErrCode - _XkbErrMessages - _XkbKSCheckCase -#endif - diff --git a/nx-X11/lib/xkbfile/xkmout.c b/nx-X11/lib/xkbfile/xkmout.c deleted file mode 100644 index 10e1ad7a0..000000000 --- a/nx-X11/lib/xkbfile/xkmout.c +++ /dev/null @@ -1,1387 +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_CONFIG_H -#include <config.h> -#endif -#include <stdio.h> -#include <ctype.h> -#include <stdlib.h> -#include <nx-X11/Xfuncs.h> -#include <nx-X11/Xlib.h> -#include <nx-X11/XKBlib.h> -#include <nx-X11/extensions/XKBgeom.h> - -#include "XKMformat.h" -#include "XKBfileInt.h" - -typedef struct _XkmInfo { - unsigned short bound_vmods; - unsigned short named_vmods; - unsigned char num_bound; - unsigned char group_compat; - unsigned short num_group_compat; - unsigned short num_leds; - int total_vmodmaps; -} XkmInfo; - -/***====================================================================***/ - -#define xkmPutCARD8(f,v) (putc(v,f),1) - -static int -xkmPutCARD16(FILE *file,unsigned val) -{ -CARD16 tmp= val; - - fwrite(&tmp,2,1,file); - return 2; -} - -static int -xkmPutCARD32(FILE *file,unsigned long val) -{ -CARD32 tmp= val; - - fwrite(&tmp,4,1,file); - return 4; -} - -static int -xkmPutPadding(FILE *file,unsigned pad) -{ -int i; - for (i=0;i<pad;i++) { - putc('\0',file); - } - return pad; -} - -static int -xkmPutCountedBytes(FILE *file,char *ptr,unsigned count) -{ -register int nOut; -register unsigned pad; - - if (count==0) - return xkmPutCARD32(file,(unsigned long)0); - - xkmPutCARD16(file,count); - nOut= fwrite(ptr,1,count,file); - if (nOut<0) - return 2; - nOut= count+2; - pad= XkbPaddedSize(nOut)-nOut; - if (pad) - xkmPutPadding(file,pad); - return nOut+pad; -} - -static unsigned -xkmSizeCountedString(char *str) -{ - if (str==NULL) - return 4; - return XkbPaddedSize(strlen(str)+2); -} - -static int -xkmPutCountedString(FILE *file,char *str) -{ - if (str==NULL) - return xkmPutCARD32(file,(unsigned long)0); - return xkmPutCountedBytes(file,str,strlen(str)); -} - -#define xkmSizeCountedAtomString(d,a) \ - xkmSizeCountedString(XkbAtomGetString((d),(a))) - -#define xkmPutCountedAtomString(d,f,a) \ - xkmPutCountedString((f),XkbAtomGetString((d),(a))) - -/***====================================================================***/ - -static unsigned -SizeXKMVirtualMods( XkbFileInfo * result, - XkmInfo * info, - xkmSectionInfo * toc, - int * offset_inout) -{ -Display * dpy; -XkbDescPtr xkb; -unsigned nBound,bound; -unsigned nNamed,named,szNames; -register unsigned i,bit; - - xkb= result->xkb; - dpy= xkb->dpy; - if ((!xkb)||(!xkb->names)||(!xkb->server)) { - _XkbLibError(_XkbErrMissingVMods,"SizeXKMVirtualMods",0); - return 0; - } - bound=named=0; - for (i=nBound=nNamed=szNames=0,bit=1;i<XkbNumVirtualMods;i++,bit<<=1) { - if (xkb->server->vmods[i]!=XkbNoModifierMask) { - bound|= bit; - nBound++; - } - if (xkb->names->vmods[i]!=None) { - named|= bit; - szNames+= xkmSizeCountedAtomString(dpy,xkb->names->vmods[i]); - nNamed++; - } - } - info->num_bound= nBound; - info->bound_vmods= bound; - info->named_vmods= named; - if ((nBound==0)&&(nNamed==0)) - return 0; - toc->type= XkmVirtualModsIndex; - toc->format= MSBFirst; - toc->size= 4+XkbPaddedSize(nBound)+szNames+SIZEOF(xkmSectionInfo); - toc->offset= *offset_inout; - (*offset_inout)+= toc->size; - return 1; -} - -static unsigned -WriteXKMVirtualMods(FILE *file,XkbFileInfo *result,XkmInfo *info) -{ -register unsigned int i,bit; -XkbDescPtr xkb; -Display * dpy; -unsigned size= 0; - - xkb= result->xkb; - dpy= xkb->dpy; - size+= xkmPutCARD16(file,info->bound_vmods); - size+= xkmPutCARD16(file,info->named_vmods); - for (i=0,bit=1;i<XkbNumVirtualMods;i++,bit<<=1) { - if (info->bound_vmods&bit) - size+= xkmPutCARD8(file,xkb->server->vmods[i]); - } - if ((i= XkbPaddedSize(info->num_bound)-info->num_bound)>0) - size+= xkmPutPadding(file,i); - for (i=0,bit=1;i<XkbNumVirtualMods;i++,bit<<=1) { - if (info->named_vmods&bit) { - register char *name; - name= XkbAtomGetString(dpy,xkb->names->vmods[i]); - size+= xkmPutCountedString(file,name); - } - } - return size; -} - -/***====================================================================***/ - -static unsigned -SizeXKMKeycodes(XkbFileInfo *result,xkmSectionInfo *toc,int *offset_inout) -{ -XkbDescPtr xkb; -Atom kcName; -int size=0; -Display * dpy; - - xkb= result->xkb; - dpy= xkb->dpy; - if ((!xkb)||(!xkb->names)||(!xkb->names->keys)) { - _XkbLibError(_XkbErrMissingNames,"SizeXKMKeycodes",0); - return 0; - } - kcName= xkb->names->keycodes; - size+= 4; /* min and max keycode */ - size+= xkmSizeCountedAtomString(dpy,kcName); - size+= XkbNumKeys(xkb)*sizeof(XkbKeyNameRec); - if (xkb->names->num_key_aliases>0) { - if (xkb->names->key_aliases!=NULL) - size+= xkb->names->num_key_aliases*sizeof(XkbKeyAliasRec); - else xkb->names->num_key_aliases= 0; - } - toc->type= XkmKeyNamesIndex; - toc->format= MSBFirst; - toc->size= size+SIZEOF(xkmSectionInfo); - toc->offset= (*offset_inout); - (*offset_inout)+= toc->size; - return 1; -} - -static unsigned -WriteXKMKeycodes(FILE *file,XkbFileInfo *result) -{ -XkbDescPtr xkb; -Atom kcName; -char *start; -Display * dpy; -unsigned tmp,size= 0; - - xkb= result->xkb; - dpy= xkb->dpy; - kcName= xkb->names->keycodes; - start= xkb->names->keys[xkb->min_key_code].name; - - size+= xkmPutCountedString(file,XkbAtomGetString(dpy,kcName)); - size+= xkmPutCARD8(file,xkb->min_key_code); - size+= xkmPutCARD8(file,xkb->max_key_code); - size+= xkmPutCARD8(file,xkb->names->num_key_aliases); - size+= xkmPutPadding(file,1); - tmp= fwrite(start,sizeof(XkbKeyNameRec),XkbNumKeys(xkb),file); - size+= tmp*sizeof(XkbKeyNameRec); - if (xkb->names->num_key_aliases>0) { - tmp= fwrite((char *)xkb->names->key_aliases, - sizeof(XkbKeyAliasRec),xkb->names->num_key_aliases, - file); - size+= tmp*sizeof(XkbKeyAliasRec); - } - return size; -} - -/***====================================================================***/ - -static unsigned -SizeXKMKeyTypes(XkbFileInfo *result,xkmSectionInfo *toc,int *offset_inout) -{ -register unsigned i,n,size; -XkbKeyTypePtr type; -XkbDescPtr xkb; -Display * dpy; -char * name; - - xkb= result->xkb; - dpy= xkb->dpy; - if ((!xkb)||(!xkb->map)||(!xkb->map->types)) { - _XkbLibError(_XkbErrMissingTypes,"SizeXKBKeyTypes",0); - return 0; - } - if (xkb->map->num_types<XkbNumRequiredTypes) { - _XkbLibError(_XkbErrMissingReqTypes,"SizeXKBKeyTypes",0); - return 0; - } - if (xkb->names) name= XkbAtomGetString(dpy,xkb->names->types); - else name= NULL; - size= xkmSizeCountedString(name); - size+= 4; /* room for # of key types + padding */ - for (i=0,type=xkb->map->types;i<xkb->map->num_types;i++,type++) { - size+= SIZEOF(xkmKeyTypeDesc); - size+= SIZEOF(xkmKTMapEntryDesc)*type->map_count; - size+= xkmSizeCountedAtomString(dpy,type->name); - if (type->preserve) - size+= SIZEOF(xkmModsDesc)*type->map_count; - if (type->level_names) { - Atom *names; - names= type->level_names; - for (n=0;n<(unsigned)type->num_levels;n++) { - size+= xkmSizeCountedAtomString(dpy,names[n]); - } - } - } - toc->type= XkmTypesIndex; - toc->format= MSBFirst; - toc->size= size+SIZEOF(xkmSectionInfo); - toc->offset= (*offset_inout); - (*offset_inout)+= toc->size; - return 1; -} - -static unsigned -WriteXKMKeyTypes(FILE *file,XkbFileInfo *result) -{ -register unsigned i,n; -XkbDescPtr xkb; -XkbKeyTypePtr type; -xkmKeyTypeDesc wire; -XkbKTMapEntryPtr entry; -xkmKTMapEntryDesc wire_entry; -Atom * names; -Display * dpy; -unsigned tmp,size= 0; -char * name; - - xkb= result->xkb; - dpy= xkb->dpy; - if (xkb->names) name= XkbAtomGetString(dpy,xkb->names->types); - else name= NULL; - size+= xkmPutCountedString(file,name); - size+= xkmPutCARD16(file,xkb->map->num_types); - size+= xkmPutPadding(file,2); - type= xkb->map->types; - for (i=0;i<xkb->map->num_types;i++,type++) { - wire.realMods= type->mods.real_mods; - wire.virtualMods= type->mods.vmods; - wire.numLevels= type->num_levels; - wire.nMapEntries= type->map_count; - wire.preserve= (type->preserve!=NULL); - if (type->level_names!=NULL) - wire.nLevelNames= type->num_levels; - else wire.nLevelNames= 0; - tmp= fwrite(&wire,SIZEOF(xkmKeyTypeDesc),1,file); - size+= tmp*SIZEOF(xkmKeyTypeDesc); - for (n=0,entry= type->map;n<type->map_count;n++,entry++) { - wire_entry.level= entry->level; - wire_entry.realMods= entry->mods.real_mods; - wire_entry.virtualMods= entry->mods.vmods; - tmp= fwrite(&wire_entry,SIZEOF(xkmKTMapEntryDesc),1,file); - size+= tmp*SIZEOF(xkmKTMapEntryDesc); - } - size+= xkmPutCountedString(file,XkbAtomGetString(dpy,type->name)); - if (type->preserve) { - xkmModsDesc p_entry; - XkbModsPtr pre; - for (n=0,pre=type->preserve;n<type->map_count;n++,pre++) { - p_entry.realMods= pre->real_mods; - p_entry.virtualMods= pre->vmods; - tmp= fwrite(&p_entry,SIZEOF(xkmModsDesc),1,file); - size+= tmp*SIZEOF(xkmModsDesc); - } - } - if (type->level_names!=NULL) { - names= type->level_names; - for (n=0;n<wire.nLevelNames;n++) { - size+= xkmPutCountedString(file,XkbAtomGetString(dpy,names[n])); - } - } - } - return size; -} - -/***====================================================================***/ - -static unsigned -SizeXKMCompatMap( XkbFileInfo * result, - XkmInfo * info, - xkmSectionInfo * toc, - int * offset_inout) -{ -XkbDescPtr xkb; -char * name; -int size; -register int i; -unsigned groups,nGroups; -Display * dpy; - - xkb= result->xkb; - dpy= xkb->dpy; - if ((!xkb)||(!xkb->compat)||(!xkb->compat->sym_interpret)) { - _XkbLibError(_XkbErrMissingCompatMap,"SizeXKMCompatMap",0); - return 0; - } - if (xkb->names) name= XkbAtomGetString(dpy,xkb->names->compat); - else name= NULL; - - for (i=groups=nGroups=0;i<XkbNumKbdGroups;i++) { - if ((xkb->compat->groups[i].real_mods!=0)|| - (xkb->compat->groups[i].vmods!=0)) { - groups|= (1<<i); - nGroups++; - } - } - info->group_compat= groups; - info->num_group_compat= nGroups; - size= 4; /* room for num_si and group_compat mask */ - size+= xkmSizeCountedString(name); - size+= (SIZEOF(xkmSymInterpretDesc)*xkb->compat->num_si); - size+= (SIZEOF(xkmModsDesc)*nGroups); - toc->type= XkmCompatMapIndex; - toc->format= MSBFirst; - toc->size= size+SIZEOF(xkmSectionInfo); - toc->offset= (*offset_inout); - (*offset_inout)+= toc->size; - return 1; -} - -static unsigned -WriteXKMCompatMap(FILE *file,XkbFileInfo *result,XkmInfo *info) -{ -register unsigned i; -char * name; -XkbDescPtr xkb; -XkbSymInterpretPtr interp; -xkmSymInterpretDesc wire; -Display * dpy; -unsigned tmp,size=0; - - xkb= result->xkb; - dpy= xkb->dpy; - if (xkb->names) name= XkbAtomGetString(dpy,xkb->names->compat); - else name= NULL; - size+= xkmPutCountedString(file,name); - size+= xkmPutCARD16(file,xkb->compat->num_si); - size+= xkmPutCARD8(file,info->group_compat); - size+= xkmPutPadding(file,1); - interp= xkb->compat->sym_interpret; - for (i=0;i<xkb->compat->num_si;i++,interp++) { - wire.sym= interp->sym; - wire.mods= interp->mods; - wire.match= interp->match; - wire.virtualMod= interp->virtual_mod; - wire.flags= interp->flags; - wire.actionType= interp->act.type; - wire.actionData[0]= interp->act.data[0]; - wire.actionData[1]= interp->act.data[1]; - wire.actionData[2]= interp->act.data[2]; - wire.actionData[3]= interp->act.data[3]; - wire.actionData[4]= interp->act.data[4]; - wire.actionData[5]= interp->act.data[5]; - wire.actionData[6]= interp->act.data[6]; - tmp= fwrite(&wire,SIZEOF(xkmSymInterpretDesc),1,file); - size+= tmp*SIZEOF(xkmSymInterpretDesc); - } - if (info->group_compat) { - register unsigned bit; - xkmModsDesc modsWire; - for (i=0,bit=1;i<XkbNumKbdGroups;i++,bit<<=1) { - if (info->group_compat&bit) { - modsWire.realMods= xkb->compat->groups[i].real_mods; - modsWire.virtualMods= xkb->compat->groups[i].vmods; - fwrite(&modsWire,SIZEOF(xkmModsDesc),1,file); - size+= SIZEOF(xkmModsDesc); - } - } - } - return size; -} - -/***====================================================================***/ - -static unsigned -SizeXKMSymbols( XkbFileInfo * result, - XkmInfo * info, - xkmSectionInfo * toc, - int * offset_inout) -{ -Display * dpy; -XkbDescPtr xkb; -unsigned size; -register int i,nSyms; -char * name; - - xkb= result->xkb; - dpy= xkb->dpy; - if ((!xkb)||(!xkb->map)||((!xkb->map->syms))) { - _XkbLibError(_XkbErrMissingSymbols,"SizeXKMSymbols",0); - return 0; - } - if (xkb->names && (xkb->names->symbols!=None)) - name= XkbAtomGetString(dpy,xkb->names->symbols); - else name= NULL; - size= xkmSizeCountedString(name); - size+= 4; /* min and max keycode, group names mask */ - for (i=0;i<XkbNumKbdGroups;i++) { - if (xkb->names->groups[i]!=None) - size+= xkmSizeCountedAtomString(dpy,xkb->names->groups[i]); - } - info->total_vmodmaps= 0; - for (i=xkb->min_key_code;i<=(int)xkb->max_key_code;i++) { - nSyms= XkbKeyNumSyms(xkb,i); - size+= SIZEOF(xkmKeySymMapDesc)+(nSyms*4); - if (xkb->server) { - if (xkb->server->explicit[i]&XkbExplicitKeyTypesMask) { - register int g; - for (g=XkbKeyNumGroups(xkb,i)-1;g>=0;g--) { - if (xkb->server->explicit[i]&(1<<g)) { - XkbKeyTypePtr type; - char * name; - type= XkbKeyKeyType(xkb,i,g); - name= XkbAtomGetString(dpy,type->name); - if (name!=NULL) - size+= xkmSizeCountedString(name); - } - } - } - if (XkbKeyHasActions(xkb,i)) - size+= nSyms*SIZEOF(xkmActionDesc); - if (xkb->server->behaviors[i].type!=XkbKB_Default) - size+= SIZEOF(xkmBehaviorDesc); - if (xkb->server->vmodmap && (xkb->server->vmodmap[i]!=0)) - info->total_vmodmaps++; - } - } - size+= info->total_vmodmaps*SIZEOF(xkmVModMapDesc); - toc->type= XkmSymbolsIndex; - toc->format= MSBFirst; - toc->size= size+SIZEOF(xkmSectionInfo); - toc->offset= (*offset_inout); - (*offset_inout)+= toc->size; - return 1; -} - -static unsigned -WriteXKMSymbols(FILE *file,XkbFileInfo *result,XkmInfo *info) -{ -Display * dpy; -XkbDescPtr xkb; -register int i,n; -xkmKeySymMapDesc wireMap; -char * name; -unsigned tmp,size= 0; - - xkb= result->xkb; - dpy= xkb->dpy; - if (xkb->names && (xkb->names->symbols!=None)) - name= XkbAtomGetString(dpy,xkb->names->symbols); - else name= NULL; - size+= xkmPutCountedString(file,name); - for (tmp=i=0;i<XkbNumKbdGroups;i++) { - if (xkb->names->groups[i]!=None) - tmp|= (1<<i); - } - size+= xkmPutCARD8(file,xkb->min_key_code); - size+= xkmPutCARD8(file,xkb->max_key_code); - size+= xkmPutCARD8(file,tmp); - size+= xkmPutCARD8(file,info->total_vmodmaps); - for (i=0,n=1;i<XkbNumKbdGroups;i++,n<<=1) { - if ((tmp&n)==0) - continue; - size+= xkmPutCountedAtomString(dpy,file,xkb->names->groups[i]); - } - for (i=xkb->min_key_code;i<=(int)xkb->max_key_code;i++) { - char *typeName[XkbNumKbdGroups]; - wireMap.width= XkbKeyGroupsWidth(xkb,i); - wireMap.num_groups= XkbKeyGroupInfo(xkb,i); - if (xkb->map && xkb->map->modmap) - wireMap.modifier_map= xkb->map->modmap[i]; - else wireMap.modifier_map= 0; - wireMap.flags= 0; - bzero((char *)typeName,XkbNumKbdGroups*sizeof(char *)); - if (xkb->server) { - if (xkb->server->explicit[i]&XkbExplicitKeyTypesMask) { - register int g; - for (g=0;g<XkbKeyNumGroups(xkb,i);g++) { - if (xkb->server->explicit[i]&(1<<g)) { - XkbKeyTypePtr type; - type= XkbKeyKeyType(xkb,i,g); - typeName[g]= XkbAtomGetString(dpy,type->name); - if (typeName[g]!=NULL) - wireMap.flags|= (1<<g); - } - } - } - if (XkbKeyHasActions(xkb,i)) - wireMap.flags|= XkmKeyHasActions; - if (xkb->server->behaviors[i].type!=XkbKB_Default) - wireMap.flags|= XkmKeyHasBehavior; - if ((xkb->server->explicit[i]&XkbExplicitAutoRepeatMask)&& - (xkb->ctrls!=NULL)) { - if (xkb->ctrls->per_key_repeat[(i/8)]&(1<<(i%8))) - wireMap.flags|= XkmRepeatingKey; - else wireMap.flags|= XkmNonRepeatingKey; - } - } - tmp= fwrite(&wireMap,SIZEOF(xkmKeySymMapDesc),1,file); - size+= tmp*SIZEOF(xkmKeySymMapDesc); - if (xkb->server->explicit[i]&XkbExplicitKeyTypesMask) { - register int g; - for (g=0;g<XkbNumKbdGroups;g++) { - if (typeName[g]!=NULL) - size+= xkmPutCountedString(file,typeName[g]); - } - } - if (XkbNumGroups(wireMap.num_groups)>0) { - KeySym *sym; - sym= XkbKeySymsPtr(xkb,i); - for (n=XkbKeyNumSyms(xkb,i);n>0;n--,sym++) { - size+= xkmPutCARD32(file,(CARD32)*sym); - } - if (wireMap.flags&XkmKeyHasActions) { - XkbAction * act; - act= XkbKeyActionsPtr(xkb,i); - for (n=XkbKeyNumActions(xkb,i);n>0;n--,act++) { - tmp= fwrite(act,SIZEOF(xkmActionDesc),1,file); - size+= tmp*SIZEOF(xkmActionDesc); - } - } - } - if (wireMap.flags&XkmKeyHasBehavior) { - xkmBehaviorDesc b; - b.type= xkb->server->behaviors[i].type; - b.data= xkb->server->behaviors[i].data; - tmp= fwrite(&b,SIZEOF(xkmBehaviorDesc),1,file); - size+= tmp*SIZEOF(xkmBehaviorDesc); - } - } - if (info->total_vmodmaps>0) { - xkmVModMapDesc v; - for (i=xkb->min_key_code;i<=xkb->max_key_code;i++) { - if (xkb->server->vmodmap[i]!=0) { - v.key= i; - v.vmods= xkb->server->vmodmap[i]; - tmp= fwrite(&v,SIZEOF(xkmVModMapDesc),1,file); - size+= tmp*SIZEOF(xkmVModMapDesc); - } - } - } - return size; -} - -/***====================================================================***/ - -static unsigned -SizeXKMIndicators(XkbFileInfo *result,XkmInfo *info,xkmSectionInfo *toc, - int *offset_inout) -{ -Display * dpy; -XkbDescPtr xkb; -unsigned size; -register unsigned i,nLEDs; - - xkb= result->xkb; - dpy= xkb->dpy; - if ((xkb==NULL)||(xkb->indicators==NULL)) { -/* _XkbLibError(_XkbErrMissingIndicators,"SizeXKMIndicators",0);*/ - return 0; - } - nLEDs=0; - size= 8; /* number of indicator maps/physical indicators */ - if (xkb->indicators!=NULL) { - for (i=0;i<XkbNumIndicators;i++) { - XkbIndicatorMapPtr map= &xkb->indicators->maps[i]; - if ((map->flags!=0)||(map->which_groups!=0)||(map->groups!=0)|| - (map->which_mods!=0)|| - (map->mods.real_mods!=0)||(map->mods.vmods!=0)|| - (map->ctrls!=0) || - (xkb->names && (xkb->names->indicators[i]!=None))) { - char *name; - if (xkb->names && xkb->names->indicators[i]!=None) { - name= XkbAtomGetString(dpy,xkb->names->indicators[i]); - } - else name= NULL; - size+= xkmSizeCountedString(name); - size+= SIZEOF(xkmIndicatorMapDesc); - nLEDs++; - } - } - } - info->num_leds= nLEDs; - toc->type= XkmIndicatorsIndex; - toc->format= MSBFirst; - toc->size= size+SIZEOF(xkmSectionInfo); - toc->offset= (*offset_inout); - (*offset_inout)+= toc->size; - return 1; -} - -static unsigned -WriteXKMIndicators(FILE *file,XkbFileInfo *result,XkmInfo *info) -{ -Display * dpy; -XkbDescPtr xkb; -register unsigned i; -xkmIndicatorMapDesc wire; -unsigned tmp,size= 0; - - xkb= result->xkb; - dpy= xkb->dpy; - size+= xkmPutCARD8(file,info->num_leds); - size+= xkmPutPadding(file,3); - size+= xkmPutCARD32(file,xkb->indicators->phys_indicators); - if (xkb->indicators!=NULL) { - for (i=0;i<XkbNumIndicators;i++) { - XkbIndicatorMapPtr map= &xkb->indicators->maps[i]; - if ((map->flags!=0)||(map->which_groups!=0)||(map->groups!=0)|| - (map->which_mods!=0)|| - (map->mods.real_mods!=0)||(map->mods.vmods!=0)|| - (map->ctrls!=0) || - (xkb->names && (xkb->names->indicators[i]!=None))) { - char *name; - if (xkb->names && xkb->names->indicators[i]!=None) { - name= XkbAtomGetString(dpy,xkb->names->indicators[i]); - } - else name= NULL; - size+= xkmPutCountedString(file,name); - wire.indicator= i+1; - wire.flags= map->flags; - wire.which_mods= map->which_mods; - wire.real_mods= map->mods.real_mods; - wire.vmods= map->mods.vmods; - wire.which_groups= map->which_groups; - wire.groups= map->groups; - wire.ctrls= map->ctrls; - tmp= fwrite(&wire,SIZEOF(xkmIndicatorMapDesc),1,file); - size+= tmp*SIZEOF(xkmIndicatorMapDesc); - } - } - } - return size; -} - -/***====================================================================***/ - -static unsigned -SizeXKMGeomDoodad(XkbFileInfo *result,XkbDoodadPtr doodad) -{ -unsigned size; - - size= SIZEOF(xkmAnyDoodadDesc); - size+= xkmSizeCountedAtomString(result->xkb->dpy,doodad->any.name); - if (doodad->any.type==XkbTextDoodad) { - size+= xkmSizeCountedString(doodad->text.text); - size+= xkmSizeCountedString(doodad->text.font); - } - else if (doodad->any.type==XkbLogoDoodad) { - size+= xkmSizeCountedString(doodad->logo.logo_name); - } - return size; -} - -static unsigned -SizeXKMGeomSection(XkbFileInfo *result,XkbSectionPtr section) -{ -register int i; -unsigned size; - - size= SIZEOF(xkmSectionDesc); - size+= xkmSizeCountedAtomString(result->xkb->dpy,section->name); - if (section->rows) { - XkbRowPtr row; - for (row=section->rows,i=0;i<section->num_rows;i++,row++) { - size+= SIZEOF(xkmRowDesc); - size+= row->num_keys*SIZEOF(xkmKeyDesc); - } - } - if (section->doodads) { - XkbDoodadPtr doodad; - for (doodad=section->doodads,i=0;i<section->num_doodads;i++,doodad++) { - size+= SizeXKMGeomDoodad(result,doodad); - } - } - if (section->overlays) { - XkbOverlayPtr ol; - for (ol=section->overlays,i=0;i<section->num_overlays;i++,ol++) { - register int r; - XkbOverlayRowPtr row; - size+= xkmSizeCountedAtomString(result->xkb->dpy,ol->name); - size+= SIZEOF(xkmOverlayDesc); - for (r=0,row=ol->rows;r<ol->num_rows;r++,row++) { - size+= SIZEOF(xkmOverlayRowDesc); - size+= row->num_keys*SIZEOF(xkmOverlayKeyDesc); - } - } - } - return size; -} - -static unsigned -SizeXKMGeometry(XkbFileInfo *result,xkmSectionInfo *toc,int *offset_inout) -{ -register int i; -Display * dpy; -XkbDescPtr xkb; -XkbGeometryPtr geom; -unsigned size; - - xkb= result->xkb; - dpy= xkb->dpy; - if ((!xkb)||(!xkb->geom)) - return 0; - geom= xkb->geom; - size= xkmSizeCountedAtomString(dpy,geom->name); - size+= SIZEOF(xkmGeometryDesc); - size+= xkmSizeCountedString(geom->label_font); - if (geom->properties) { - XkbPropertyPtr prop; - for (i=0,prop=geom->properties;i<geom->num_properties;i++,prop++) { - size+= xkmSizeCountedString(prop->name); - size+= xkmSizeCountedString(prop->value); - } - } - if (geom->colors) { - XkbColorPtr color; - for (i=0,color=geom->colors;i<geom->num_colors;i++,color++) { - size+= xkmSizeCountedString(color->spec); - } - } - if (geom->shapes) { - XkbShapePtr shape; - for (i=0,shape=geom->shapes;i<geom->num_shapes;i++,shape++) { - register int n; - register XkbOutlinePtr ol; - size+= xkmSizeCountedAtomString(dpy,shape->name); - size+= SIZEOF(xkmShapeDesc); - for (n=0,ol=shape->outlines;n<shape->num_outlines;n++,ol++) { - size+= SIZEOF(xkmOutlineDesc); - size+= ol->num_points*SIZEOF(xkmPointDesc); - } - } - } - if (geom->sections) { - XkbSectionPtr section; - for (i=0,section=geom->sections;i<geom->num_sections;i++,section++) { - size+= SizeXKMGeomSection(result,section); - } - } - if (geom->doodads) { - XkbDoodadPtr doodad; - for (i=0,doodad=geom->doodads;i<geom->num_doodads;i++,doodad++) { - size+= SizeXKMGeomDoodad(result,doodad); - } - } - if (geom->key_aliases) { - size+= geom->num_key_aliases*(XkbKeyNameLength*2); - } - toc->type= XkmGeometryIndex; - toc->format= MSBFirst; - toc->size= size+SIZEOF(xkmSectionInfo); - toc->offset= (*offset_inout); - (*offset_inout)+= toc->size; - return 1; -} - -static unsigned -WriteXKMGeomDoodad(FILE *file,XkbFileInfo *result,XkbDoodadPtr doodad) -{ -Display * dpy; -XkbDescPtr xkb; -xkmDoodadDesc doodadWire; -unsigned tmp,size= 0; - - xkb= result->xkb; - dpy= xkb->dpy; - bzero((char *)&doodadWire,sizeof(doodadWire)); - doodadWire.any.type= doodad->any.type; - doodadWire.any.priority= doodad->any.priority; - doodadWire.any.top= doodad->any.top; - doodadWire.any.left= doodad->any.left; - switch (doodad->any.type) { - case XkbOutlineDoodad: - case XkbSolidDoodad: - doodadWire.shape.angle= doodad->shape.angle; - doodadWire.shape.color_ndx= doodad->shape.color_ndx; - doodadWire.shape.shape_ndx= doodad->shape.shape_ndx; - break; - case XkbTextDoodad: - doodadWire.text.angle= doodad->text.angle; - doodadWire.text.width= doodad->text.width; - doodadWire.text.height= doodad->text.height; - doodadWire.text.color_ndx= doodad->text.color_ndx; - break; - case XkbIndicatorDoodad: - doodadWire.indicator.shape_ndx= doodad->indicator.shape_ndx; - doodadWire.indicator.on_color_ndx= doodad->indicator.on_color_ndx; - doodadWire.indicator.off_color_ndx= doodad->indicator.off_color_ndx; - break; - case XkbLogoDoodad: - doodadWire.logo.angle= doodad->logo.angle; - doodadWire.logo.color_ndx= doodad->logo.color_ndx; - doodadWire.logo.shape_ndx= doodad->logo.shape_ndx; - break; - default: - _XkbLibError(_XkbErrIllegalDoodad,"WriteXKMGeomDoodad", - doodad->any.type); - return 0; - } - size+= xkmPutCountedAtomString(dpy,file,doodad->any.name); - tmp= fwrite(&doodadWire,SIZEOF(xkmDoodadDesc),1,file); - size+= tmp*SIZEOF(xkmDoodadDesc); - if (doodad->any.type==XkbTextDoodad) { - size+= xkmPutCountedString(file,doodad->text.text); - size+= xkmPutCountedString(file,doodad->text.font); - } - else if (doodad->any.type==XkbLogoDoodad) { - size+= xkmPutCountedString(file,doodad->logo.logo_name); - } - return size; -} - -static unsigned -WriteXKMGeomOverlay(FILE *file,XkbFileInfo *result,XkbOverlayPtr ol) -{ -register int r,k; -Display * dpy; -XkbDescPtr xkb; -XkbOverlayRowPtr row; -xkmOverlayDesc olWire; -xkmOverlayRowDesc rowWire; -xkmOverlayKeyDesc keyWire; -unsigned tmp,size= 0; - - xkb= result->xkb; - dpy= xkb->dpy; - bzero((char *)&olWire,sizeof(olWire)); - bzero((char *)&rowWire,sizeof(rowWire)); - bzero((char *)&keyWire,sizeof(keyWire)); - size+= xkmPutCountedAtomString(dpy,file,ol->name); - olWire.num_rows= ol->num_rows; - tmp= fwrite(&olWire,SIZEOF(xkmOverlayDesc),1,file); - size+= tmp*SIZEOF(xkmOverlayDesc); - for (r=0,row=ol->rows;r<ol->num_rows;r++,row++) { - XkbOverlayKeyPtr key; - rowWire.row_under= row->row_under; - rowWire.num_keys= row->num_keys; - tmp= fwrite(&rowWire,SIZEOF(xkmOverlayRowDesc),1,file); - size+= tmp*SIZEOF(xkmOverlayRowDesc); - for (k=0,key=row->keys;k<row->num_keys;k++,key++) { - memcpy(keyWire.over,key->over.name,XkbKeyNameLength); - memcpy(keyWire.under,key->under.name,XkbKeyNameLength); - tmp= fwrite(&keyWire,SIZEOF(xkmOverlayKeyDesc),1,file); - size+= tmp*SIZEOF(xkmOverlayKeyDesc); - } - } - return size; -} - -static unsigned -WriteXKMGeomSection(FILE *file,XkbFileInfo *result,XkbSectionPtr section) -{ -register int i; -Display * dpy; -XkbDescPtr xkb; -xkmSectionDesc sectionWire; -unsigned tmp,size= 0; - - xkb= result->xkb; - dpy= xkb->dpy; - size+= xkmPutCountedAtomString(dpy,file,section->name); - sectionWire.top= section->top; - sectionWire.left= section->left; - sectionWire.width= section->width; - sectionWire.height= section->height; - sectionWire.angle= section->angle; - sectionWire.priority= section->priority; - sectionWire.num_rows= section->num_rows; - sectionWire.num_doodads= section->num_doodads; - sectionWire.num_overlays= section->num_overlays; - tmp= fwrite(§ionWire,SIZEOF(xkmSectionDesc),1,file); - size+= tmp*SIZEOF(xkmSectionDesc); - if (section->rows) { - register unsigned k; - XkbRowPtr row; - xkmRowDesc rowWire; - XkbKeyPtr key; - xkmKeyDesc keyWire; - for (i=0,row=section->rows;i<section->num_rows;i++,row++) { - rowWire.top= row->top; - rowWire.left= row->left; - rowWire.num_keys= row->num_keys; - rowWire.vertical= row->vertical; - tmp= fwrite(&rowWire,SIZEOF(xkmRowDesc),1,file); - size+= tmp*SIZEOF(xkmRowDesc); - for (k=0,key=row->keys;k<row->num_keys;k++,key++) { - memcpy(keyWire.name,key->name.name,XkbKeyNameLength); - keyWire.gap= key->gap; - keyWire.shape_ndx= key->shape_ndx; - keyWire.color_ndx= key->color_ndx; - tmp= fwrite(&keyWire,SIZEOF(xkmKeyDesc),1,file); - size+= tmp*SIZEOF(xkmKeyDesc); - } - } - } - if (section->doodads) { - XkbDoodadPtr doodad; - for (i=0,doodad=section->doodads;i<section->num_doodads;i++,doodad++) { - size+= WriteXKMGeomDoodad(file,result,doodad); - } - } - if (section->overlays) { - XkbOverlayPtr ol; - for (i=0,ol=section->overlays;i<section->num_overlays;i++,ol++) { - size+= WriteXKMGeomOverlay(file,result,ol); - } - } - return size; -} - -static unsigned -WriteXKMGeometry(FILE *file,XkbFileInfo *result) -{ -register int i; -Display * dpy; -XkbDescPtr xkb; -XkbGeometryPtr geom; -xkmGeometryDesc wire; -unsigned tmp,size= 0; - - xkb= result->xkb; - dpy= xkb->dpy; - if ((!xkb)||(!xkb->geom)) - return 0; - geom= xkb->geom; - wire.width_mm= geom->width_mm; - wire.height_mm= geom->height_mm; - wire.base_color_ndx= XkbGeomColorIndex(geom,geom->base_color); - wire.label_color_ndx= XkbGeomColorIndex(geom,geom->label_color); - wire.num_properties= geom->num_properties; - wire.num_colors= geom->num_colors; - wire.num_shapes= geom->num_shapes; - wire.num_sections= geom->num_sections; - wire.num_doodads= geom->num_doodads; - wire.num_key_aliases= geom->num_key_aliases; - size+= xkmPutCountedAtomString(dpy,file,geom->name); - tmp= fwrite(&wire,SIZEOF(xkmGeometryDesc),1,file); - size+= tmp*SIZEOF(xkmGeometryDesc); - size+= xkmPutCountedString(file,geom->label_font); - if (geom->properties) { - XkbPropertyPtr prop; - for (i=0,prop=geom->properties;i<geom->num_properties;i++,prop++) { - size+= xkmPutCountedString(file,prop->name); - size+= xkmPutCountedString(file,prop->value); - } - } - if (geom->colors) { - XkbColorPtr color; - for (i=0,color=geom->colors;i<geom->num_colors;i++,color++) { - size+= xkmPutCountedString(file,color->spec); - } - } - if (geom->shapes) { - XkbShapePtr shape; - xkmShapeDesc shapeWire; - - for (i=0,shape=geom->shapes;i<geom->num_shapes;i++,shape++) { - register int n; - XkbOutlinePtr ol; - xkmOutlineDesc olWire; - bzero((char *)&shapeWire,sizeof(xkmShapeDesc)); - size+= xkmPutCountedAtomString(dpy,file,shape->name); - shapeWire.num_outlines= shape->num_outlines; - if (shape->primary!=NULL) - shapeWire.primary_ndx= XkbOutlineIndex(shape,shape->primary); - else shapeWire.primary_ndx= XkbNoShape; - if (shape->approx!=NULL) - shapeWire.approx_ndx= XkbOutlineIndex(shape,shape->approx); - else shapeWire.approx_ndx= XkbNoShape; - tmp= fwrite(&shapeWire,SIZEOF(xkmShapeDesc),1,file); - size+= tmp*SIZEOF(xkmShapeDesc); - for (n=0,ol=shape->outlines;n<shape->num_outlines;n++,ol++) { - register int p; - XkbPointPtr pt; - xkmPointDesc ptWire; - olWire.num_points= ol->num_points; - olWire.corner_radius= ol->corner_radius; - tmp= fwrite(&olWire,SIZEOF(xkmOutlineDesc),1,file); - size+= tmp*SIZEOF(xkmOutlineDesc); - for (p=0,pt=ol->points;p<ol->num_points;p++,pt++) { - ptWire.x= pt->x; - ptWire.y= pt->y; - tmp= fwrite(&ptWire,SIZEOF(xkmPointDesc),1,file); - size+= tmp*SIZEOF(xkmPointDesc); - } - } - } - } - if (geom->sections) { - XkbSectionPtr section; - for (i=0,section=geom->sections;i<geom->num_sections;i++,section++) { - size+= WriteXKMGeomSection(file,result,section); - } - } - if (geom->doodads) { - XkbDoodadPtr doodad; - for (i=0,doodad=geom->doodads;i<geom->num_doodads;i++,doodad++) { - size+= WriteXKMGeomDoodad(file,result,doodad); - } - } - if (geom->key_aliases) { - tmp= fwrite(geom->key_aliases,2*XkbKeyNameLength,geom->num_key_aliases, - file); - size+= tmp*(2*XkbKeyNameLength); - } - return size; -} - -/***====================================================================***/ - -/*ARGSUSED*/ -static int -GetXKMKeyNamesTOC( XkbFileInfo * result, - XkmInfo * info, - int max_toc, - xkmSectionInfo *toc_rtrn) -{ -int num_toc; -int total_size; - - total_size= num_toc=0; - if (SizeXKMKeycodes(result,&toc_rtrn[num_toc],&total_size)) - num_toc++; - if (SizeXKMIndicators(result,info,&toc_rtrn[num_toc],&total_size)) - num_toc++; - return num_toc; -} - -/*ARGSUSED*/ -static int -GetXKMTypesTOC( XkbFileInfo * result, - XkmInfo * info, - int max_toc, - xkmSectionInfo *toc_rtrn) -{ -int num_toc; -int total_size; - - total_size= num_toc=0; - if (SizeXKMVirtualMods(result,info,&toc_rtrn[num_toc],&total_size)) - num_toc++; - if (SizeXKMKeyTypes(result,&toc_rtrn[num_toc],&total_size)) - num_toc++; - return num_toc; -} - -/*ARGSUSED*/ -static int -GetXKMCompatMapTOC( XkbFileInfo * result, - XkmInfo * info, - int max_toc, - xkmSectionInfo *toc_rtrn) -{ -int num_toc; -int total_size; - - total_size= num_toc=0; - if (SizeXKMVirtualMods(result,info,&toc_rtrn[num_toc],&total_size)) - num_toc++; - if (SizeXKMCompatMap(result,info,&toc_rtrn[num_toc],&total_size)) - num_toc++; - if (SizeXKMIndicators(result,info,&toc_rtrn[num_toc],&total_size)) - num_toc++; - return num_toc; -} - -/*ARGSUSED*/ -static int -GetXKMSemanticsTOC( XkbFileInfo * result, - XkmInfo * info, - int max_toc, - xkmSectionInfo *toc_rtrn) -{ -int num_toc; -int total_size; - - total_size= num_toc=0; - if (SizeXKMVirtualMods(result,info,&toc_rtrn[num_toc],&total_size)) - num_toc++; - if (SizeXKMKeyTypes(result,&toc_rtrn[num_toc],&total_size)) - num_toc++; - if (SizeXKMCompatMap(result,info,&toc_rtrn[num_toc],&total_size)) - num_toc++; - if (SizeXKMIndicators(result,info,&toc_rtrn[num_toc],&total_size)) - num_toc++; - return num_toc; -} - -/*ARGSUSED*/ -static int -GetXKMLayoutTOC( XkbFileInfo * result, - XkmInfo * info, - int max_toc, - xkmSectionInfo *toc_rtrn) -{ -int num_toc; -int total_size; - - total_size= num_toc=0; - if (SizeXKMVirtualMods(result,info,&toc_rtrn[num_toc],&total_size)) - num_toc++; - if (SizeXKMKeycodes(result,&toc_rtrn[num_toc],&total_size)) - num_toc++; - if (SizeXKMKeyTypes(result,&toc_rtrn[num_toc],&total_size)) - num_toc++; - if (SizeXKMSymbols(result,info,&toc_rtrn[num_toc],&total_size)) - num_toc++; - if (SizeXKMIndicators(result,info,&toc_rtrn[num_toc],&total_size)) - num_toc++; - if (SizeXKMGeometry(result,&toc_rtrn[num_toc],&total_size)) - num_toc++; - return num_toc; -} - -/*ARGSUSED*/ -static int -GetXKMKeymapTOC( XkbFileInfo * result, - XkmInfo * info, - int max_toc, - xkmSectionInfo *toc_rtrn) -{ -int num_toc; -int total_size; - - total_size= num_toc=0; - if (SizeXKMVirtualMods(result,info,&toc_rtrn[num_toc],&total_size)) - num_toc++; - if (SizeXKMKeycodes(result,&toc_rtrn[num_toc],&total_size)) - num_toc++; - if (SizeXKMKeyTypes(result,&toc_rtrn[num_toc],&total_size)) - num_toc++; - if (SizeXKMCompatMap(result,info,&toc_rtrn[num_toc],&total_size)) - num_toc++; - if (SizeXKMSymbols(result,info,&toc_rtrn[num_toc],&total_size)) - num_toc++; - if (SizeXKMIndicators(result,info,&toc_rtrn[num_toc],&total_size)) - num_toc++; - if (SizeXKMGeometry(result,&toc_rtrn[num_toc],&total_size)) - num_toc++; - return num_toc; -} - -/*ARGSUSED*/ -static int -GetXKMGeometryTOC( XkbFileInfo * result, - XkmInfo * info, - int max_toc, - xkmSectionInfo *toc_rtrn) -{ -int num_toc; -int total_size; - - total_size= num_toc=0; - if (SizeXKMGeometry(result,&toc_rtrn[num_toc],&total_size)) - num_toc++; - return num_toc; -} - -static Bool -WriteXKMFile( FILE * file, - XkbFileInfo * result, - int num_toc, - xkmSectionInfo *toc, - XkmInfo * info) -{ -register int i; -unsigned tmp,size,total= 0; - - for (i=0;i<num_toc;i++) { - tmp= fwrite(&toc[i],SIZEOF(xkmSectionInfo),1,file); - total+= tmp*SIZEOF(xkmSectionInfo); - switch (toc[i].type) { - case XkmTypesIndex: - size= WriteXKMKeyTypes(file,result); - break; - case XkmCompatMapIndex: - size= WriteXKMCompatMap(file,result,info); - break; - case XkmSymbolsIndex: - size= WriteXKMSymbols(file,result,info); - break; - case XkmIndicatorsIndex: - size= WriteXKMIndicators(file,result,info); - break; - case XkmKeyNamesIndex: - size= WriteXKMKeycodes(file,result); - break; - case XkmGeometryIndex: - size= WriteXKMGeometry(file,result); - break; - case XkmVirtualModsIndex: - size= WriteXKMVirtualMods(file,result,info); - break; - default: - _XkbLibError(_XkbErrIllegalTOCType,"WriteXKMFile",toc[i].type); - return False; - } - size+= SIZEOF(xkmSectionInfo); - if (size!=toc[i].size) { - _XkbLibError(_XkbErrBadLength,XkbConfigText(toc[i].type,XkbMessage), - size-toc[i].size); - return False; - } - } - return True; -} - - -#define MAX_TOC 16 - -Bool -XkbWriteXKMFile(FILE *out,XkbFileInfo *result) -{ -Bool ok; -XkbDescPtr xkb; -XkmInfo info; -int size_toc,i; -unsigned hdr,present; -xkmFileInfo fileInfo; -xkmSectionInfo toc[MAX_TOC]; -int (*getTOC)( - XkbFileInfo * /* result */, - XkmInfo * /* info */, - int /* max_to */, - xkmSectionInfo */* toc_rtrn */ -); - - switch (result->type) { - case XkmKeyNamesIndex: - getTOC= GetXKMKeyNamesTOC; - break; - case XkmTypesIndex: - getTOC= GetXKMTypesTOC; - break; - case XkmCompatMapIndex: - getTOC= GetXKMCompatMapTOC; - break; - case XkmSemanticsFile: - getTOC= GetXKMSemanticsTOC; - break; - case XkmLayoutFile: - getTOC= GetXKMLayoutTOC; - break; - case XkmKeymapFile: - getTOC= GetXKMKeymapTOC; - break; - case XkmGeometryFile: - case XkmGeometryIndex: - getTOC= GetXKMGeometryTOC; - break; - default: - _XkbLibError(_XkbErrIllegalContents, - XkbConfigText(result->type,XkbMessage),0); - return False; - } - xkb= result->xkb; - - bzero((char *)&info,sizeof(XkmInfo)); - size_toc= (*getTOC)(result,&info,MAX_TOC,toc); - if (size_toc<1) { - _XkbLibError(_XkbErrEmptyFile,"XkbWriteXKMFile",0); - return False; - } - if (out==NULL) { - _XkbLibError(_XkbErrFileCannotOpen,"XkbWriteXKMFile",0); - return False; - } - for (i=present=0;i<size_toc;i++) { - toc[i].offset+= 4+SIZEOF(xkmFileInfo); - toc[i].offset+= (size_toc*SIZEOF(xkmSectionInfo)); - if (toc[i].type<=XkmLastIndex) { - present|= (1<<toc[i].type); - } -#ifdef DEBUG - else { - fprintf(stderr,"Illegal section type %d\n",toc[i].type); - fprintf(stderr,"Ignored\n"); - } -#endif - } - hdr= (('x'<<24)|('k'<<16)|('m'<<8)|XkmFileVersion); - xkmPutCARD32(out,(unsigned long)hdr); - fileInfo.type= result->type; - fileInfo.min_kc= xkb->min_key_code; - fileInfo.max_kc= xkb->max_key_code; - fileInfo.num_toc= size_toc; - fileInfo.present= present; - fileInfo.pad= 0; - fwrite(&fileInfo,SIZEOF(xkmFileInfo),1,out); - fwrite(toc,SIZEOF(xkmSectionInfo),size_toc,out); - ok= WriteXKMFile(out,result,size_toc,toc,&info); - return ok; -} diff --git a/nx-X11/programs/Xserver/os/Imakefile b/nx-X11/programs/Xserver/os/Imakefile index 60a005fb6..b1873b8fd 100644 --- a/nx-X11/programs/Xserver/os/Imakefile +++ b/nx-X11/programs/Xserver/os/Imakefile @@ -190,11 +190,6 @@ SpecialCObjectRule(oscolor,$(ICONFIGFILES),$(DBM_DEFINES)) LinkSourceFile(snprintf.c,$(LIBSRC)/misc) #endif -#if !HasStrlcat -LinkSourceFile(strlcat.c,$(LIBSRC)/misc) -LinkSourceFile(strlcpy.c,$(LIBSRC)/misc) -#endif - #if DoLoadableServer AllTarget(libcwrapper.o) ObjectFromSpecialSource(libcwrapper,$(XF86OSSRC)/shared/libc_wrapper,-DSELF_CONTAINED_WRAPPER) diff --git a/nx-X11/lib/misc/strlcat.c b/nx-X11/programs/Xserver/os/strlcat.c index 28e2338f9..28e2338f9 100644 --- a/nx-X11/lib/misc/strlcat.c +++ b/nx-X11/programs/Xserver/os/strlcat.c diff --git a/nx-X11/lib/misc/strlcpy.c b/nx-X11/programs/Xserver/os/strlcpy.c index 42442cc30..42442cc30 100644 --- a/nx-X11/lib/misc/strlcpy.c +++ b/nx-X11/programs/Xserver/os/strlcpy.c diff --git a/nx-X11/programs/Xserver/xkb/Imakefile b/nx-X11/programs/Xserver/xkb/Imakefile index 3581324fc..6a949807e 100644 --- a/nx-X11/programs/Xserver/xkb/Imakefile +++ b/nx-X11/programs/Xserver/xkb/Imakefile @@ -72,14 +72,7 @@ AllTarget($(XF86_OBJS)) SpecialCObjectRule(xkbInit,$(ICONFIGFILES),$(XKB_DEFINES)) -LinkSourceFile(maprules.c,$(XKBFILELIBSRC)) -LinkSourceFile(xkmread.c,$(XKBFILELIBSRC)) -LinkSourceFile(xkbtext.c,$(XKBFILELIBSRC)) XCOMM avoid clash between XKBMisc.c and xkbmisc.c on NT -LinkFile(xkbfmisc.c,$(XKBFILELIBSRC)/xkbmisc.c) -LinkSourceFile(xkberrs.c,$(XKBFILELIBSRC)) -LinkSourceFile(xkbconfig.c,$(XKBFILELIBSRC)) -LinkSourceFile(xkbout.c,$(XKBFILELIBSRC)) LinkSourceFile(XKBMisc.c,$(XLIBSRC)) LinkSourceFile(XKBMAlloc.c,$(XLIBSRC)) LinkSourceFile(XKBAlloc.c,$(XLIBSRC)) diff --git a/nx-X11/lib/xkbfile/maprules.c b/nx-X11/programs/Xserver/xkb/maprules.c index b5d3bcd8c..b5d3bcd8c 100644 --- a/nx-X11/lib/xkbfile/maprules.c +++ b/nx-X11/programs/Xserver/xkb/maprules.c diff --git a/nx-X11/lib/xkbfile/xkbconfig.c b/nx-X11/programs/Xserver/xkb/xkbconfig.c index dce86bc15..dce86bc15 100644 --- a/nx-X11/lib/xkbfile/xkbconfig.c +++ b/nx-X11/programs/Xserver/xkb/xkbconfig.c diff --git a/nx-X11/lib/xkbfile/xkberrs.c b/nx-X11/programs/Xserver/xkb/xkberrs.c index b14f36d03..b14f36d03 100644 --- a/nx-X11/lib/xkbfile/xkberrs.c +++ b/nx-X11/programs/Xserver/xkb/xkberrs.c diff --git a/nx-X11/lib/xkbfile/xkbmisc.c b/nx-X11/programs/Xserver/xkb/xkbfmisc.c index 38bbb8216..38bbb8216 100644 --- a/nx-X11/lib/xkbfile/xkbmisc.c +++ b/nx-X11/programs/Xserver/xkb/xkbfmisc.c diff --git a/nx-X11/lib/xkbfile/xkbout.c b/nx-X11/programs/Xserver/xkb/xkbout.c index 3f52c8cf4..3f52c8cf4 100644 --- a/nx-X11/lib/xkbfile/xkbout.c +++ b/nx-X11/programs/Xserver/xkb/xkbout.c diff --git a/nx-X11/lib/xkbfile/xkbtext.c b/nx-X11/programs/Xserver/xkb/xkbtext.c index f3fcdd647..f3fcdd647 100644 --- a/nx-X11/lib/xkbfile/xkbtext.c +++ b/nx-X11/programs/Xserver/xkb/xkbtext.c diff --git a/nx-X11/lib/xkbfile/xkmread.c b/nx-X11/programs/Xserver/xkb/xkmread.c index 1ceccc9bb..1ceccc9bb 100644 --- a/nx-X11/lib/xkbfile/xkmread.c +++ b/nx-X11/programs/Xserver/xkb/xkmread.c |