diff options
author | Daniel Stone <daniel@fooishbar.org> | 2008-02-03 23:30:22 +1100 |
---|---|---|
committer | Daniel Stone <daniel@fooishbar.org> | 2008-02-17 22:52:07 +0200 |
commit | 534fc5140b039a8c98ab715d0a6740d513b41209 (patch) | |
tree | 69b0b6a9ac233f59c70627a79ca55eefefb37635 | |
parent | 0f12a448dcbbbf1f40aa98d09c9d25ee511c5bbf (diff) |
XKB: Remove a bunch of mad ifdefs
We have SEEK_SET and size_t, seriously. Also use DebugF instead of
ifdef DEBUG, and ditch a couple of random bits that were never used.
-rw-r--r-- | xkb/XKBGAlloc.c | 8 | ||||
-rw-r--r-- | xkb/XKBMAlloc.c | 4 | ||||
-rw-r--r-- | xkb/XKBMisc.c | 5 | ||||
-rw-r--r-- | xkb/ddxBeep.c | 4 | ||||
-rw-r--r-- | xkb/ddxCtrls.c | 23 | ||||
-rw-r--r-- | xkb/ddxKeyClick.c | 4 | ||||
-rw-r--r-- | xkb/ddxList.c | 13 | ||||
-rw-r--r-- | xkb/ddxLoad.c | 80 | ||||
-rw-r--r-- | xkb/maprules.c | 86 | ||||
-rw-r--r-- | xkb/xkb.c | 2 | ||||
-rw-r--r-- | xkb/xkbAccessX.c | 8 | ||||
-rw-r--r-- | xkb/xkbEvents.c | 34 | ||||
-rw-r--r-- | xkb/xkbInit.c | 17 | ||||
-rw-r--r-- | xkb/xkbPrKeyEv.c | 4 | ||||
-rw-r--r-- | xkb/xkbUtils.c | 10 | ||||
-rw-r--r-- | xkb/xkmread.c | 19 |
16 files changed, 69 insertions, 252 deletions
diff --git a/xkb/XKBGAlloc.c b/xkb/XKBGAlloc.c index 7a75d200d..94072b8ce 100644 --- a/xkb/XKBGAlloc.c +++ b/xkb/XKBGAlloc.c @@ -39,12 +39,6 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include <xkbsrv.h> #include "xkbgeom.h" -#ifdef X_NOT_POSIX -#define Size_t unsigned int -#else -#define Size_t size_t -#endif - /***====================================================================***/ static void @@ -465,7 +459,7 @@ _XkbGeomAlloc( XPointer * old, unsigned short * num, unsigned short * total, int num_new, - Size_t sz_elem) + size_t sz_elem) { if (num_new<1) return Success; diff --git a/xkb/XKBMAlloc.c b/xkb/XKBMAlloc.c index 9feaf8e93..178b5b89a 100644 --- a/xkb/XKBMAlloc.c +++ b/xkb/XKBMAlloc.c @@ -55,10 +55,8 @@ XkbClientMapPtr map; ((!XkbIsLegalKeycode(xkb->min_key_code))|| (!XkbIsLegalKeycode(xkb->max_key_code))|| (xkb->max_key_code<xkb->min_key_code))) { -#ifdef DEBUG -fprintf(stderr,"bad keycode (%d,%d) in XkbAllocClientMap\n", + DebugF("bad keycode (%d,%d) in XkbAllocClientMap\n", xkb->min_key_code,xkb->max_key_code); -#endif return BadValue; } diff --git a/xkb/XKBMisc.c b/xkb/XKBMisc.c index 0404108a2..85415a4c9 100644 --- a/xkb/XKBMisc.c +++ b/xkb/XKBMisc.c @@ -416,10 +416,7 @@ unsigned changed,tmp; if (((explicit&XkbExplicitAutoRepeatMask)==0)&&(xkb->ctrls)) { CARD8 old; old= xkb->ctrls->per_key_repeat[key/8]; -#ifdef RETURN_SHOULD_REPEAT - if (*XkbKeySymsPtr(xkb,key) != XK_Return) -#endif - xkb->ctrls->per_key_repeat[key/8]|= (1<<(key%8)); + xkb->ctrls->per_key_repeat[key/8]|= (1<<(key%8)); if (changes && (old!=xkb->ctrls->per_key_repeat[key/8])) changes->ctrls.changed_ctrls|= XkbPerKeyRepeatMask; } diff --git a/xkb/ddxBeep.c b/xkb/ddxBeep.c index 331357ded..2faed5818 100644 --- a/xkb/ddxBeep.c +++ b/xkb/ddxBeep.c @@ -139,10 +139,6 @@ Atom name; next= 0; pitch= oldPitch= ctrl->bell_pitch; duration= oldDuration= ctrl->bell_duration; -#ifdef DEBUG - if (xkbDebugFlags>1) - ErrorF("beep: %d (count= %d)\n",xkbInfo->beepType,xkbInfo->beepCount); -#endif name= None; switch (xkbInfo->beepType) { default: diff --git a/xkb/ddxCtrls.c b/xkb/ddxCtrls.c index 0f7f9187f..34ea0bd3f 100644 --- a/xkb/ddxCtrls.c +++ b/xkb/ddxCtrls.c @@ -47,12 +47,6 @@ int realRepeat; realRepeat= ctrl->autoRepeat; if ((dev->kbdfeed)&&(XkbDDXUsesSoftRepeat(dev))) ctrl->autoRepeat= 0; -#ifdef DEBUG -if (xkbDebugFlags&0x4) { - ErrorF("XkbDDXKeybdCtrlProc: setting repeat to %d (real repeat is %d)\n", - ctrl->autoRepeat,realRepeat); -} -#endif if (dev->key && dev->key->xkbInfo && dev->key->xkbInfo->kbdProc) (*dev->key->xkbInfo->kbdProc)(dev,ctrl); ctrl->autoRepeat= realRepeat; @@ -93,23 +87,6 @@ unsigned changed, i; unsigned char *rep_old, *rep_new, *rep_fb; changed= new->enabled_ctrls^old->enabled_ctrls; -#ifdef NOTDEF - if (changed&XkbRepeatKeysMask) { - if (dev->kbdfeed) { - int realRepeat; - - if (new->enabled_ctrls&XkbRepeatKeysMask) - dev->kbdfeed->ctrl.autoRepeat= realRepeat= 1; - else dev->kbdfeed->ctrl.autoRepeat= realRepeat= 0; - - if (XkbDDXUsesSoftRepeat(dev)) - dev->kbdfeed->ctrl.autoRepeat= FALSE; - if (dev->kbdfeed->CtrlProc) - (*dev->kbdfeed->CtrlProc)(dev,&dev->kbdfeed->ctrl); - dev->kbdfeed->ctrl.autoRepeat= realRepeat; - } - } -#endif for (rep_old = old->per_key_repeat, rep_new = new->per_key_repeat, rep_fb = dev->kbdfeed->ctrl.autoRepeats, diff --git a/xkb/ddxKeyClick.c b/xkb/ddxKeyClick.c index f48296dbc..51d78f56d 100644 --- a/xkb/ddxKeyClick.c +++ b/xkb/ddxKeyClick.c @@ -42,9 +42,5 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. void XkbDDXKeyClick(DeviceIntPtr pXDev,int keycode,int synthetic) { -#ifdef DEBUG - if (xkbDebugFlags) - ErrorF("Click.\n"); -#endif return; } diff --git a/xkb/ddxList.c b/xkb/ddxList.c index a91a9badf..80e050524 100644 --- a/xkb/ddxList.c +++ b/xkb/ddxList.c @@ -43,14 +43,6 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include <xkbsrv.h> #include <X11/extensions/XI.h> -#ifndef PATH_MAX -#ifdef MAXPATHLEN -#define PATH_MAX MAXPATHLEN -#else -#define PATH_MAX 1024 -#endif -#endif - #ifdef WIN32 /* from ddxLoad.c */ extern const char* Win32TempDir(); @@ -199,9 +191,8 @@ char tmpname[PATH_MAX]; #ifndef WIN32 in= Popen(buf,"r"); #else -#ifdef DEBUG_CMD - ErrorF("xkb executes: %s\n",buf); -#endif + if (xkbDebugFlags) + DebugF("xkbList executes: %s\n",buf); if (System(buf) < 0) ErrorF("Could not invoke keymap compiler\n"); else diff --git a/xkb/ddxLoad.c b/xkb/ddxLoad.c index d79ae7a7b..63122264b 100644 --- a/xkb/ddxLoad.c +++ b/xkb/ddxLoad.c @@ -52,14 +52,6 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include <paths.h> #endif -#ifndef PATH_MAX -#ifdef MAXPATHLEN -#define PATH_MAX MAXPATHLEN -#else -#define PATH_MAX 1024 -#endif -#endif - /* * If XKM_OUTPUT_DIR specifies a path without a leading slash, it is * relative to the top-level XKB configuration directory. @@ -161,44 +153,19 @@ Win32System(const char *cmdline) #define System(x) Win32System(x) #endif -#ifdef MAKE_XKM_OUTPUT_DIR -/* Borrow trans_mkdir from Xtransutil.c to more safely make directories */ -# undef X11_t -# define TRANS_SERVER -# define PRMSG(lvl,x,a,b,c) \ - if (lvl <= 1) { LogMessage(X_ERROR,x,a,b,c); } else ((void)0) -# include <X11/Xtrans/Xtransutil.c> -# ifndef XKM_OUTPUT_DIR_MODE -# define XKM_OUTPUT_DIR_MODE 0755 -# endif -#endif - static void OutputDirectory( char* outdir, size_t size) { #ifndef WIN32 - if (getuid() == 0 && (strlen(XKM_OUTPUT_DIR) < size) -#ifdef MAKE_XKM_OUTPUT_DIR - && (trans_mkdir(XKM_OUTPUT_DIR, XKM_OUTPUT_DIR_MODE) == 0) -#endif - ) + if (getuid() == 0 && (strlen(XKM_OUTPUT_DIR) < size)) { /* if server running as root it *may* be able to write */ /* FIXME: check whether directory is writable at all */ (void) strcpy (outdir, XKM_OUTPUT_DIR); } else -#endif -#ifdef _PATH_VARTMP - if ((strlen(_PATH_VARTMP) + 1) < size) - { - (void) strcpy (outdir, _PATH_VARTMP); - if (outdir[strlen(outdir) - 1] != '/') /* Hi IBM, Digital */ - (void) strcat (outdir, "/"); - } else -#endif -#ifdef WIN32 +#else if (strlen(Win32TempDir()) + 1 < size) { (void) strcpy(outdir, Win32TempDir()); @@ -256,15 +223,10 @@ char *cmd = NULL,file[PATH_MAX],xkm_output_dir[PATH_MAX],*map,*outFile; PRE_ERROR_MSG,ERROR_PREFIX,POST_ERROR_MSG1,file, xkm_output_dir,outFile); } -#ifdef DEBUG if (xkbDebugFlags) { - ErrorF("XkbDDXCompileNamedKeymap compiling keymap using:\n"); - ErrorF(" \"cmd\"\n"); + DebugF("XkbDDXCompileNamedKeymap compiling keymap using:\n"); + DebugF(" \"cmd\"\n"); } -#endif -#ifdef DEBUG_CMD - ErrorF("xkb executes: %s\n",cmd); -#endif if (System(cmd)==0) { if (nameRtrn) { strncpy(nameRtrn,outFile,nameRtrnLen); @@ -276,9 +238,7 @@ char *cmd = NULL,file[PATH_MAX],xkm_output_dir[PATH_MAX],*map,*outFile; xfree(cmd); return True; } -#ifdef DEBUG - ErrorF("Error compiling keymap (%s)\n",names->keymap); -#endif + DebugF("Error compiling keymap (%s)\n",names->keymap); if (outFile!=NULL) _XkbFree(outFile); if (cmd!=NULL) @@ -371,12 +331,8 @@ char tmpname[PATH_MAX]; if (fclose(out)==0 && System(buf) >= 0) #endif { -#ifdef DEBUG_CMD - ErrorF("xkb executes: %s\n",buf); - ErrorF("xkbcomp input:\n"); - XkbWriteXKBKeymapForNames(stderr,names,NULL,xkb,want,need); - ErrorF("end xkbcomp input\n"); -#endif + if (xkbDebugFlags) + DebugF("xkb executes: %s\n",buf); if (nameRtrn) { strncpy(nameRtrn,keymap,nameRtrnLen); nameRtrn[nameRtrnLen-1]= '\0'; @@ -385,24 +341,20 @@ char tmpname[PATH_MAX]; xfree (buf); return True; } -#ifdef DEBUG else - ErrorF("Error compiling keymap (%s)\n",keymap); -#endif + DebugF("Error compiling keymap (%s)\n",keymap); #ifdef WIN32 /* remove the temporary file */ unlink(tmpname); #endif } -#ifdef DEBUG else { #ifndef WIN32 - ErrorF("Could not invoke keymap compiler\n"); + DebugF("Could not invoke keymap compiler\n"); #else - ErrorF("Could not open file %s\n", tmpname); + DebugF("Could not open file %s\n", tmpname); #endif } -#endif if (nameRtrn) nameRtrn[0]= '\0'; if (buf != NULL) @@ -477,17 +429,13 @@ unsigned missing; return 0; } else if (!XkbDDXCompileNamedKeymap(xkb,names,nameRtrn,nameRtrnLen)) { -#ifdef NOISY - ErrorF("Couldn't compile keymap file\n"); -#endif + DebugF("Couldn't compile keymap file\n"); return 0; } } else if (!XkbDDXCompileKeymapByNames(xkb,names,want,need, nameRtrn,nameRtrnLen)){ -#ifdef NOISY - ErrorF("Couldn't compile keymap file\n"); -#endif + DebugF("Couldn't compile keymap file\n"); return 0; } file= XkbDDXOpenConfigFile(nameRtrn,fileName,PATH_MAX); @@ -502,11 +450,9 @@ unsigned missing; (void) unlink (fileName); return 0; } -#ifdef DEBUG else if (xkbDebugFlags) { - ErrorF("Loaded %s, defined=0x%x\n",fileName,finfoRtrn->defined); + DebugF("Loaded XKB keymap %s, defined=0x%x\n",fileName,finfoRtrn->defined); } -#endif fclose(file); (void) unlink (fileName); return (need|want)&(~missing); diff --git a/xkb/maprules.c b/xkb/maprules.c index 52a1cdc86..72e642fbe 100644 --- a/xkb/maprules.c +++ b/xkb/maprules.c @@ -50,16 +50,6 @@ #define XKBSRV_NEED_FILE_FUNCS #include <xkbsrv.h> -#ifdef DEBUG -#define PR_DEBUG(s) fprintf(stderr,s) -#define PR_DEBUG1(s,a) fprintf(stderr,s,a) -#define PR_DEBUG2(s,a,b) fprintf(stderr,s,a,b) -#else -#define PR_DEBUG(s) -#define PR_DEBUG1(s,a) -#define PR_DEBUG2(s,a,b) -#endif - /***====================================================================***/ #define DFLT_LINE_SIZE 128 @@ -171,8 +161,8 @@ Bool endOfFile,spacePending,slashPending,inComment; } if (checkbang && ch=='!') { if (line->num_line!=0) { - PR_DEBUG("The '!' legal only at start of line\n"); - PR_DEBUG("Line containing '!' ignored\n"); + DebugF("The '!' legal only at start of line\n"); + DebugF("Line containing '!' ignored\n"); line->num_line= 0; inComment= 0; break; @@ -273,9 +263,7 @@ unsigned present, l_ndx_present, v_ndx_present; register int i; int len, ndx; _Xstrtokparams strtok_buf; -#ifdef DEBUG Bool found; -#endif l_ndx_present = v_ndx_present = present= 0; @@ -284,9 +272,7 @@ Bool found; bzero((char *)remap,sizeof(RemapSpec)); remap->number = len; while ((tok=_XStrtok(str," ",strtok_buf))!=NULL) { -#ifdef DEBUG found= False; -#endif str= NULL; if (strcmp(tok,"=")==0) continue; @@ -299,22 +285,20 @@ Bool found; *end != '\0' || ndx == -1) break; if (ndx < 1 || ndx > XkbNumKbdGroups) { - PR_DEBUG2("Illegal %s index: %d\n", cname[i], ndx); - PR_DEBUG1("Index must be in range 1..%d\n", + DebugF("Illegal %s index: %d\n", cname[i], ndx); + DebugF("Index must be in range 1..%d\n", XkbNumKbdGroups); break; } } else { ndx = 0; } -#ifdef DEBUG found= True; -#endif if (present&(1<<i)) { if ((i == LAYOUT && l_ndx_present&(1<<ndx)) || (i == VARIANT && v_ndx_present&(1<<ndx)) ) { - PR_DEBUG1("Component \"%s\" listed twice\n",tok); - PR_DEBUG("Second definition ignored\n"); + DebugF("Component \"%s\" listed twice\n",tok); + DebugF("Second definition ignored\n"); break; } } @@ -328,38 +312,34 @@ Bool found; break; } } -#ifdef DEBUG if (!found) { fprintf(stderr,"Unknown component \"%s\" ignored\n",tok); } -#endif } if ((present&PART_MASK)==0) { -#ifdef DEBUG unsigned mask= PART_MASK; - fprintf(stderr,"Mapping needs at least one of "); + ErrorF("Mapping needs at least one of "); for (i=0; (i<MAX_WORDS); i++) { if ((1L<<i)&mask) { mask&= ~(1L<<i); - if (mask) fprintf(stderr,"\"%s,\" ",cname[i]); - else fprintf(stderr,"or \"%s\"\n",cname[i]); + if (mask) DebugF("\"%s,\" ",cname[i]); + else DebugF("or \"%s\"\n",cname[i]); } } - fprintf(stderr,"Illegal mapping ignored\n"); -#endif + DebugF("Illegal mapping ignored\n"); remap->num_remap= 0; return; } if ((present&COMPONENT_MASK)==0) { - PR_DEBUG("Mapping needs at least one component\n"); - PR_DEBUG("Illegal mapping ignored\n"); + DebugF("Mapping needs at least one component\n"); + DebugF("Illegal mapping ignored\n"); remap->num_remap= 0; return; } if (((present&COMPONENT_MASK)&(1<<KEYMAP))&& ((present&COMPONENT_MASK)!=(1<<KEYMAP))) { - PR_DEBUG("Keymap cannot appear with other components\n"); - PR_DEBUG("Illegal mapping ignored\n"); + DebugF("Keymap cannot appear with other components\n"); + DebugF("Illegal mapping ignored\n"); remap->num_remap= 0; return; } @@ -434,8 +414,8 @@ Bool append = False; } if (remap->num_remap==0) { - PR_DEBUG("Must have a mapping before first line of data\n"); - PR_DEBUG("Illegal line of data ignored\n"); + DebugF("Must have a mapping before first line of data\n"); + DebugF("Illegal line of data ignored\n"); return False; } bzero((char *)&tmp,sizeof(FileSpec)); @@ -447,8 +427,8 @@ Bool append = False; continue; } if (nread>remap->num_remap) { - PR_DEBUG("Too many words on a line\n"); - PR_DEBUG1("Extra word \"%s\" ignored\n",tok); + DebugF("Too many words on a line\n"); + DebugF("Extra word \"%s\" ignored\n",tok); continue; } tmp.name[remap->remap[nread].word]= tok; @@ -456,8 +436,8 @@ Bool append = False; append = True; } if (nread<remap->num_remap) { - PR_DEBUG1("Too few words on a line: %s\n", line->line); - PR_DEBUG("line ignored\n"); + DebugF("Too few words on a line: %s\n", line->line); + DebugF("line ignored\n"); return False; } @@ -903,9 +883,7 @@ XkbRF_AddRule(XkbRF_RulesPtr rules) } if (!rules->rules) { rules->sz_rules= rules->num_rules= 0; -#ifdef DEBUG - fprintf(stderr,"Allocation failure in XkbRF_AddRule\n"); -#endif + DebugF("Allocation failure in XkbRF_AddRule\n"); return NULL; } bzero((char *)&rules->rules[rules->num_rules],sizeof(XkbRF_RuleRec)); @@ -1022,7 +1000,7 @@ XkbRF_AddVarDesc(XkbRF_DescribeVarsPtr vars) } if (!vars->desc) { vars->sz_desc= vars->num_desc= 0; - PR_DEBUG("Allocation failure in XkbRF_AddVarDesc\n"); + DebugF("Allocation failure in XkbRF_AddVarDesc\n"); return NULL; } vars->desc[vars->num_desc].name= NULL; @@ -1059,7 +1037,7 @@ XkbRF_AddVarToDescribe(XkbRF_RulesPtr rules,char *name) XkbRF_DescribeVarsRec); } if ((!rules->extra_names)||(!rules->extra)) { - PR_DEBUG("allocation error in extra parts\n"); + DebugF("allocation error in extra parts\n"); rules->sz_extra= rules->num_extra= 0; rules->extra_names= NULL; rules->extra= NULL; @@ -1102,7 +1080,7 @@ int len,headingtype,extra_ndx = 0; } if (extra_ndx<0) { XkbRF_DescribeVarsPtr var; - PR_DEBUG1("Extra heading \"%s\" encountered\n",tok); + DebugF("Extra heading \"%s\" encountered\n",tok); var= XkbRF_AddVarToDescribe(rules,tok); if (var) extra_ndx= var-rules->extra; @@ -1113,20 +1091,20 @@ int len,headingtype,extra_ndx = 0; } if (headingtype == HEAD_NONE) { - PR_DEBUG("Must have a heading before first line of data\n"); - PR_DEBUG("Illegal line of data ignored\n"); + DebugF("Must have a heading before first line of data\n"); + DebugF("Illegal line of data ignored\n"); continue; } len = strlen(line.line); if ((tmp.name= strtok(line.line, " \t")) == NULL) { - PR_DEBUG("Huh? No token on line\n"); - PR_DEBUG("Illegal line of data ignored\n"); + DebugF("Huh? No token on line\n"); + DebugF("Illegal line of data ignored\n"); continue; } if (strlen(tmp.name) == len) { - PR_DEBUG("No description found\n"); - PR_DEBUG("Illegal line of data ignored\n"); + DebugF("No description found\n"); + DebugF("Illegal line of data ignored\n"); continue; } @@ -1134,8 +1112,8 @@ int len,headingtype,extra_ndx = 0; while ((*tok!='\n')&&isspace(*tok)) tok++; if (*tok == '\0') { - PR_DEBUG("No description found\n"); - PR_DEBUG("Illegal line of data ignored\n"); + DebugF("No description found\n"); + DebugF("Illegal line of data ignored\n"); continue; } tmp.desc= tok; @@ -5784,10 +5784,8 @@ char * str; return status; } else if (length!=0) { -#ifdef DEBUG ErrorF("Internal Error! BadLength in ProcXkbGetDeviceInfo\n"); ErrorF(" Wrote %d fewer bytes than expected\n",length); -#endif return BadLength; } if (stuff->wanted&(~supported)) { diff --git a/xkb/xkbAccessX.c b/xkb/xkbAccessX.c index d95fbcdde..75b8c5a27 100644 --- a/xkb/xkbAccessX.c +++ b/xkb/xkbAccessX.c @@ -130,11 +130,9 @@ xEvent xE; xE.u.u.type = type; xE.u.u.detail = keyCode; xE.u.keyButtonPointer.time = GetTimeInMillis(); -#ifdef DEBUG if (xkbDebugFlags&0x8) { - ErrorF("AXKE: Key %d %s\n",keyCode,(xE.u.u.type==KeyPress?"down":"up")); + DebugF("AXKE: Key %d %s\n",keyCode,(xE.u.u.type==KeyPress?"down":"up")); } -#endif if (_XkbIsPressEvent(type)) XkbDDXKeyClick(keybd,keyCode,TRUE); @@ -533,10 +531,8 @@ KeySym * sym = XkbKeySymsPtr(xkbi->desc,key); ((ctrls->enabled_ctrls&(XkbSlowKeysMask|XkbRepeatKeysMask))== XkbRepeatKeysMask)) { if (BitIsOn(keybd->kbdfeed->ctrl.autoRepeats,key)) { -#ifdef DEBUG if (xkbDebugFlags&0x10) - ErrorF("Starting software autorepeat...\n"); -#endif + DebugF("Starting software autorepeat...\n"); xkbi->repeatKey = key; xkbi->repeatKeyTimer= TimerSet(xkbi->repeatKeyTimer, 0, ctrls->repeat_delay, diff --git a/xkb/xkbEvents.c b/xkb/xkbEvents.c index 7643703e4..49725d065 100644 --- a/xkb/xkbEvents.c +++ b/xkb/xkbEvents.c @@ -813,23 +813,21 @@ XkbSrvInfoPtr xkbi; xkbi= pXDev->key->xkbInfo; if ( pClient->xkbClientFlags & _XkbClientInitialized ) { -#ifdef DEBUG if ((xkbDebugFlags&0x10)&& ((xE[0].u.u.type==KeyPress)||(xE[0].u.u.type==KeyRelease)|| (xE[0].u.u.type==DeviceKeyPress)|| (xE[0].u.u.type == DeviceKeyRelease))) { - ErrorF("XKbFilterWriteEvents:\n"); - ErrorF(" Event state= 0x%04x\n",xE[0].u.keyButtonPointer.state); - ErrorF(" XkbLastRepeatEvent!=xE (0x%p!=0x%p) %s\n", + DebugF("XKbFilterWriteEvents:\n"); + DebugF(" Event state= 0x%04x\n",xE[0].u.keyButtonPointer.state); + DebugF(" XkbLastRepeatEvent!=xE (0x%p!=0x%p) %s\n", XkbLastRepeatEvent,xE, ((XkbLastRepeatEvent!=(pointer)xE)?"True":"False")); - ErrorF(" (xkbClientEventsFlags&XWDA)==0 (0x%x) %s\n", + DebugF(" (xkbClientEventsFlags&XWDA)==0 (0x%x) %s\n", pClient->xkbClientFlags, (_XkbWantsDetectableAutoRepeat(pClient)?"True":"False")); - ErrorF(" !IsRelease(%d) %s\n",xE[0].u.u.type, + DebugF(" !IsRelease(%d) %s\n",xE[0].u.u.type, (!_XkbIsReleaseEvent(xE[0].u.u.type))?"True":"False"); } -#endif /* DEBUG */ if ( (XkbLastRepeatEvent==(pointer)xE) && (_XkbWantsDetectableAutoRepeat(pClient)) && (_XkbIsReleaseEvent(xE[0].u.u.type)) ) { @@ -866,13 +864,11 @@ XkbSrvInfoPtr xkbi; if (xE[0].u.u.type == ButtonPress && ((xE[0].u.keyButtonPointer.state >> 7) & button_mask) == button_mask && (xkbi->lockedPtrButtons & button_mask) == button_mask) { -#ifdef DEBUG /* If the MouseKeys is pressed, and the "real" mouse is also pressed * when the mouse is released, the server does not behave properly. * Faking a release of the button here solves the problem. */ - ErrorF("Faking release of button %d\n", xE[0].u.u.detail); -#endif + DebugF("Faking release of button %d\n", xE[0].u.u.detail); XkbDDXFakePointerButton(ButtonRelease, xE[0].u.u.detail); } } @@ -881,21 +877,19 @@ XkbSrvInfoPtr xkbi; for (i=0;i<nEvents;i++) { type= xE[i].u.u.type; -#ifdef DEBUG if ((xkbDebugFlags&0x4)&& ((xE[i].u.u.type==KeyPress)||(xE[i].u.u.type==KeyRelease)|| (xE[i].u.u.type==DeviceKeyPress)|| (xE[i].u.u.type == DeviceKeyRelease))) { XkbStatePtr s= &xkbi->state; - ErrorF("XKbFilterWriteEvents (non-XKB):\n"); - ErrorF("event= 0x%04x\n",xE[i].u.keyButtonPointer.state); - ErrorF("lookup= 0x%02x, grab= 0x%02x\n",s->lookup_mods, + DebugF("XKbFilterWriteEvents (non-XKB):\n"); + DebugF("event= 0x%04x\n",xE[i].u.keyButtonPointer.state); + DebugF("lookup= 0x%02x, grab= 0x%02x\n",s->lookup_mods, s->grab_mods); - ErrorF("compat lookup= 0x%02x, grab= 0x%02x\n", + DebugF("compat lookup= 0x%02x, grab= 0x%02x\n", s->compat_lookup_mods, s->compat_grab_mods); } -#endif if ( (type>=KeyPress)&&(type<=MotionNotify) ) { CARD16 old,new; @@ -924,16 +918,12 @@ XkbSrvInfoPtr xkbi; if (type == ButtonPress && ((xE[i].u.keyButtonPointer.state >> 7) & button_mask) == button_mask && (xkbi->lockedPtrButtons & button_mask) == button_mask) { -#ifdef DEBUG - ErrorF("Faking release of button %d\n", xE[i].u.u.detail); -#endif + DebugF("Faking release of button %d\n", xE[i].u.u.detail); XkbDDXFakePointerButton(ButtonRelease, xE[i].u.u.detail); } else if (type == DeviceButtonPress && ((((deviceKeyButtonPointer*)&xE[i])->state >> 7) & button_mask) == button_mask && (xkbi->lockedPtrButtons & button_mask) == button_mask) { -#ifdef DEBUG - ErrorF("Faking release of button %d\n", ((deviceKeyButtonPointer*)&xE[i])->state); -#endif + DebugF("Faking release of button %d\n", ((deviceKeyButtonPointer*)&xE[i])->state); XkbDDXFakePointerButton(DeviceButtonRelease, ((deviceKeyButtonPointer*)&xE[i])->state); } } diff --git a/xkb/xkbInit.c b/xkb/xkbInit.c index bb1de9de6..2ac51f26c 100644 --- a/xkb/xkbInit.c +++ b/xkb/xkbInit.c @@ -280,10 +280,6 @@ XkbSetRulesDflts(char *rulesFile,char *model,char *layout, /***====================================================================***/ -#if defined(luna) -#define XKB_DDX_PERMANENT_LOCK 1 -#endif - #include "xkbDflts.h" static Bool @@ -390,15 +386,6 @@ Atom unknown; names->indicators[LED_COMPOSE-1] = CREATE_ATOM("Compose"); #endif } -#ifdef DEBUG_RADIO_GROUPS - if (names->num_rg<1) { - names->radio_groups= (Atom *)_XkbCalloc(RG_COUNT, sizeof(Atom)); - if (names->radio_groups) { - names->num_rg = RG_COUNT; - names->radio_groups[RG_BOGUS_FUNCTION_GROUP]= CREATE_ATOM("BOGUS"); - } - } -#endif if (xkb->geom!=NULL) names->geometry= xkb->geom->name; else names->geometry= unknown; @@ -771,9 +758,7 @@ XkbSrvLedInfoPtr sli; sli= XkbFindSrvLedInfo(pXDev,XkbDfltXIClass,XkbDfltXIId,0); if (sli && xkbi) XkbCheckIndicatorMaps(xkbi->device,sli,XkbAllIndicatorsMask); -#ifdef DEBUG - else ErrorF("No indicator feedback in XkbFinishInit (shouldn't happen)!\n"); -#endif + else DebugF("No indicator feedback in XkbFinishInit (shouldn't happen)!\n"); return softRepeat; } diff --git a/xkb/xkbPrKeyEv.c b/xkb/xkbPrKeyEv.c index 3fec4f5ca..69c218c8c 100644 --- a/xkb/xkbPrKeyEv.c +++ b/xkb/xkbPrKeyEv.c @@ -56,11 +56,9 @@ int xiEvent; xkbi= keyc->xkbInfo; key= xE->u.u.detail; xiEvent= (xE->u.u.type & EXTENSION_EVENT_BASE); -#ifdef DEBUG if (xkbDebugFlags&0x8) { - ErrorF("XkbPKE: Key %d %s\n",key,(xE->u.u.type==KeyPress?"down":"up")); + DebugF("XkbPKE: Key %d %s\n",key,(xE->u.u.type==KeyPress?"down":"up")); } -#endif if ( (xkbi->repeatKey==key) && (xE->u.u.type==KeyRelease) && ((xkbi->desc->ctrls->enabled_ctrls&XkbRepeatKeysMask)==0) ) { diff --git a/xkb/xkbUtils.c b/xkb/xkbUtils.c index 67843e9fb..28d66b38b 100644 --- a/xkb/xkbUtils.c +++ b/xkb/xkbUtils.c @@ -211,16 +211,6 @@ KeySym tsyms[XkbMaxSymsPerKey],*syms; XkbMapChangesPtr mc; xkb= pXDev->key->xkbInfo->desc; -#ifdef NOTYET - if (first<xkb->min_key_code) { - if (first>=XkbMinLegalKeyCode) { - xkb->min_key_code= first; - /* 1/12/95 (ef) -- XXX! should zero out the new maps */ - changes->map.changed|= XkbKeycodesMask; -/* generate a NewKeyboard notify here? */ - } - } -#endif if (first+num-1>xkb->max_key_code) { /* 1/12/95 (ef) -- XXX! should allow XKB structures to grow */ num= xkb->max_key_code-first+1; diff --git a/xkb/xkmread.c b/xkb/xkmread.c index 88296188a..2bb02896b 100644 --- a/xkb/xkmread.c +++ b/xkb/xkmread.c @@ -40,8 +40,7 @@ #include "misc.h" #include "inputstr.h" #include "xkbstr.h" -#define XKBSRV_NEED_FILE_FUNCS -#include <xkbsrv.h> +#include "xkbsrv.h" #include "xkbgeom.h" Atom @@ -52,10 +51,6 @@ XkbInternAtom(Display *dpy,char *str,Bool only_if_exists) return MakeAtom(str,strlen(str),!only_if_exists); } -#ifndef SEEK_SET -#define SEEK_SET 0 -#endif - char * _XkbDupString(char *str) { @@ -562,10 +557,8 @@ FindTypeForKey(XkbDescPtr xkb,Atom name,unsigned width,KeySym *syms) register unsigned i; for (i=0;i<xkb->map->num_types;i++) { if (xkb->map->types[i].name==name) { -#ifdef DEBUG if (xkb->map->types[i].num_levels!=width) - fprintf(stderr,"Group width mismatch between key and type\n"); -#endif + DebugF("Group width mismatch between key and type\n"); return &xkb->map->types[i]; } } @@ -1086,10 +1079,8 @@ unsigned i,size_toc; fread(file_info,SIZEOF(xkmFileInfo),1,file); size_toc= file_info->num_toc; if (size_toc>max_toc) { -#ifdef DEBUG - fprintf(stderr,"Warning! Too many TOC entries; last %d ignored\n", + DebugF("Warning! Too many TOC entries; last %d ignored\n", size_toc-max_toc); -#endif size_toc= max_toc; } for (i=0;i<size_toc;i++) { @@ -1227,11 +1218,7 @@ unsigned which= need|want; if (result->xkb==NULL) result->xkb= XkbAllocKeyboard(); for (i=0;i<fileInfo.num_toc;i++) { -#ifdef SEEK_SET fseek(file,toc[i].offset,SEEK_SET); -#else - fseek(file,toc[i].offset,0); -#endif tmp= fread(&tmpTOC,SIZEOF(xkmSectionInfo),1,file); nRead= tmp*SIZEOF(xkmSectionInfo); if ((tmpTOC.type!=toc[i].type)||(tmpTOC.format!=toc[i].format)|| |