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.
This commit is contained in:
Daniel Stone 2008-02-03 23:30:22 +11:00
parent 0f12a448dc
commit 534fc5140b
16 changed files with 69 additions and 252 deletions

View File

@ -39,12 +39,6 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include <xkbsrv.h> #include <xkbsrv.h>
#include "xkbgeom.h" #include "xkbgeom.h"
#ifdef X_NOT_POSIX
#define Size_t unsigned int
#else
#define Size_t size_t
#endif
/***====================================================================***/ /***====================================================================***/
static void static void
@ -465,7 +459,7 @@ _XkbGeomAlloc( XPointer * old,
unsigned short * num, unsigned short * num,
unsigned short * total, unsigned short * total,
int num_new, int num_new,
Size_t sz_elem) size_t sz_elem)
{ {
if (num_new<1) if (num_new<1)
return Success; return Success;

View File

@ -55,10 +55,8 @@ XkbClientMapPtr map;
((!XkbIsLegalKeycode(xkb->min_key_code))|| ((!XkbIsLegalKeycode(xkb->min_key_code))||
(!XkbIsLegalKeycode(xkb->max_key_code))|| (!XkbIsLegalKeycode(xkb->max_key_code))||
(xkb->max_key_code<xkb->min_key_code))) { (xkb->max_key_code<xkb->min_key_code))) {
#ifdef DEBUG DebugF("bad keycode (%d,%d) in XkbAllocClientMap\n",
fprintf(stderr,"bad keycode (%d,%d) in XkbAllocClientMap\n",
xkb->min_key_code,xkb->max_key_code); xkb->min_key_code,xkb->max_key_code);
#endif
return BadValue; return BadValue;
} }

View File

@ -416,10 +416,7 @@ unsigned changed,tmp;
if (((explicit&XkbExplicitAutoRepeatMask)==0)&&(xkb->ctrls)) { if (((explicit&XkbExplicitAutoRepeatMask)==0)&&(xkb->ctrls)) {
CARD8 old; CARD8 old;
old= xkb->ctrls->per_key_repeat[key/8]; old= xkb->ctrls->per_key_repeat[key/8];
#ifdef RETURN_SHOULD_REPEAT xkb->ctrls->per_key_repeat[key/8]|= (1<<(key%8));
if (*XkbKeySymsPtr(xkb,key) != XK_Return)
#endif
xkb->ctrls->per_key_repeat[key/8]|= (1<<(key%8));
if (changes && (old!=xkb->ctrls->per_key_repeat[key/8])) if (changes && (old!=xkb->ctrls->per_key_repeat[key/8]))
changes->ctrls.changed_ctrls|= XkbPerKeyRepeatMask; changes->ctrls.changed_ctrls|= XkbPerKeyRepeatMask;
} }

View File

@ -139,10 +139,6 @@ Atom name;
next= 0; next= 0;
pitch= oldPitch= ctrl->bell_pitch; pitch= oldPitch= ctrl->bell_pitch;
duration= oldDuration= ctrl->bell_duration; duration= oldDuration= ctrl->bell_duration;
#ifdef DEBUG
if (xkbDebugFlags>1)
ErrorF("beep: %d (count= %d)\n",xkbInfo->beepType,xkbInfo->beepCount);
#endif
name= None; name= None;
switch (xkbInfo->beepType) { switch (xkbInfo->beepType) {
default: default:

View File

@ -47,12 +47,6 @@ int realRepeat;
realRepeat= ctrl->autoRepeat; realRepeat= ctrl->autoRepeat;
if ((dev->kbdfeed)&&(XkbDDXUsesSoftRepeat(dev))) if ((dev->kbdfeed)&&(XkbDDXUsesSoftRepeat(dev)))
ctrl->autoRepeat= 0; 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) if (dev->key && dev->key->xkbInfo && dev->key->xkbInfo->kbdProc)
(*dev->key->xkbInfo->kbdProc)(dev,ctrl); (*dev->key->xkbInfo->kbdProc)(dev,ctrl);
ctrl->autoRepeat= realRepeat; ctrl->autoRepeat= realRepeat;
@ -93,23 +87,6 @@ unsigned changed, i;
unsigned char *rep_old, *rep_new, *rep_fb; unsigned char *rep_old, *rep_new, *rep_fb;
changed= new->enabled_ctrls^old->enabled_ctrls; 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, for (rep_old = old->per_key_repeat,
rep_new = new->per_key_repeat, rep_new = new->per_key_repeat,
rep_fb = dev->kbdfeed->ctrl.autoRepeats, rep_fb = dev->kbdfeed->ctrl.autoRepeats,

View File

@ -42,9 +42,5 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
void void
XkbDDXKeyClick(DeviceIntPtr pXDev,int keycode,int synthetic) XkbDDXKeyClick(DeviceIntPtr pXDev,int keycode,int synthetic)
{ {
#ifdef DEBUG
if (xkbDebugFlags)
ErrorF("Click.\n");
#endif
return; return;
} }

View File

@ -43,14 +43,6 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include <xkbsrv.h> #include <xkbsrv.h>
#include <X11/extensions/XI.h> #include <X11/extensions/XI.h>
#ifndef PATH_MAX
#ifdef MAXPATHLEN
#define PATH_MAX MAXPATHLEN
#else
#define PATH_MAX 1024
#endif
#endif
#ifdef WIN32 #ifdef WIN32
/* from ddxLoad.c */ /* from ddxLoad.c */
extern const char* Win32TempDir(); extern const char* Win32TempDir();
@ -199,9 +191,8 @@ char tmpname[PATH_MAX];
#ifndef WIN32 #ifndef WIN32
in= Popen(buf,"r"); in= Popen(buf,"r");
#else #else
#ifdef DEBUG_CMD if (xkbDebugFlags)
ErrorF("xkb executes: %s\n",buf); DebugF("xkbList executes: %s\n",buf);
#endif
if (System(buf) < 0) if (System(buf) < 0)
ErrorF("Could not invoke keymap compiler\n"); ErrorF("Could not invoke keymap compiler\n");
else else

View File

@ -50,14 +50,6 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#if defined(CSRG_BASED) || defined(linux) || defined(__sgi) || defined(AIXV3) || defined(__osf__) || defined(__GNU__) #if defined(CSRG_BASED) || defined(linux) || defined(__sgi) || defined(AIXV3) || defined(__osf__) || defined(__GNU__)
#include <paths.h> #include <paths.h>
#endif
#ifndef PATH_MAX
#ifdef MAXPATHLEN
#define PATH_MAX MAXPATHLEN
#else
#define PATH_MAX 1024
#endif
#endif #endif
/* /*
@ -161,44 +153,19 @@ Win32System(const char *cmdline)
#define System(x) Win32System(x) #define System(x) Win32System(x)
#endif #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 static void
OutputDirectory( OutputDirectory(
char* outdir, char* outdir,
size_t size) size_t size)
{ {
#ifndef WIN32 #ifndef WIN32
if (getuid() == 0 && (strlen(XKM_OUTPUT_DIR) < size) 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 server running as root it *may* be able to write */ /* if server running as root it *may* be able to write */
/* FIXME: check whether directory is writable at all */ /* FIXME: check whether directory is writable at all */
(void) strcpy (outdir, XKM_OUTPUT_DIR); (void) strcpy (outdir, XKM_OUTPUT_DIR);
} else } else
#endif #else
#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
if (strlen(Win32TempDir()) + 1 < size) if (strlen(Win32TempDir()) + 1 < size)
{ {
(void) strcpy(outdir, Win32TempDir()); (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, PRE_ERROR_MSG,ERROR_PREFIX,POST_ERROR_MSG1,file,
xkm_output_dir,outFile); xkm_output_dir,outFile);
} }
#ifdef DEBUG
if (xkbDebugFlags) { if (xkbDebugFlags) {
ErrorF("XkbDDXCompileNamedKeymap compiling keymap using:\n"); DebugF("XkbDDXCompileNamedKeymap compiling keymap using:\n");
ErrorF(" \"cmd\"\n"); DebugF(" \"cmd\"\n");
} }
#endif
#ifdef DEBUG_CMD
ErrorF("xkb executes: %s\n",cmd);
#endif
if (System(cmd)==0) { if (System(cmd)==0) {
if (nameRtrn) { if (nameRtrn) {
strncpy(nameRtrn,outFile,nameRtrnLen); strncpy(nameRtrn,outFile,nameRtrnLen);
@ -276,9 +238,7 @@ char *cmd = NULL,file[PATH_MAX],xkm_output_dir[PATH_MAX],*map,*outFile;
xfree(cmd); xfree(cmd);
return True; return True;
} }
#ifdef DEBUG DebugF("Error compiling keymap (%s)\n",names->keymap);
ErrorF("Error compiling keymap (%s)\n",names->keymap);
#endif
if (outFile!=NULL) if (outFile!=NULL)
_XkbFree(outFile); _XkbFree(outFile);
if (cmd!=NULL) if (cmd!=NULL)
@ -371,12 +331,8 @@ char tmpname[PATH_MAX];
if (fclose(out)==0 && System(buf) >= 0) if (fclose(out)==0 && System(buf) >= 0)
#endif #endif
{ {
#ifdef DEBUG_CMD if (xkbDebugFlags)
ErrorF("xkb executes: %s\n",buf); DebugF("xkb executes: %s\n",buf);
ErrorF("xkbcomp input:\n");
XkbWriteXKBKeymapForNames(stderr,names,NULL,xkb,want,need);
ErrorF("end xkbcomp input\n");
#endif
if (nameRtrn) { if (nameRtrn) {
strncpy(nameRtrn,keymap,nameRtrnLen); strncpy(nameRtrn,keymap,nameRtrnLen);
nameRtrn[nameRtrnLen-1]= '\0'; nameRtrn[nameRtrnLen-1]= '\0';
@ -385,24 +341,20 @@ char tmpname[PATH_MAX];
xfree (buf); xfree (buf);
return True; return True;
} }
#ifdef DEBUG
else else
ErrorF("Error compiling keymap (%s)\n",keymap); DebugF("Error compiling keymap (%s)\n",keymap);
#endif
#ifdef WIN32 #ifdef WIN32
/* remove the temporary file */ /* remove the temporary file */
unlink(tmpname); unlink(tmpname);
#endif #endif
} }
#ifdef DEBUG
else { else {
#ifndef WIN32 #ifndef WIN32
ErrorF("Could not invoke keymap compiler\n"); DebugF("Could not invoke keymap compiler\n");
#else #else
ErrorF("Could not open file %s\n", tmpname); DebugF("Could not open file %s\n", tmpname);
#endif #endif
} }
#endif
if (nameRtrn) if (nameRtrn)
nameRtrn[0]= '\0'; nameRtrn[0]= '\0';
if (buf != NULL) if (buf != NULL)
@ -477,17 +429,13 @@ unsigned missing;
return 0; return 0;
} }
else if (!XkbDDXCompileNamedKeymap(xkb,names,nameRtrn,nameRtrnLen)) { else if (!XkbDDXCompileNamedKeymap(xkb,names,nameRtrn,nameRtrnLen)) {
#ifdef NOISY DebugF("Couldn't compile keymap file\n");
ErrorF("Couldn't compile keymap file\n");
#endif
return 0; return 0;
} }
} }
else if (!XkbDDXCompileKeymapByNames(xkb,names,want,need, else if (!XkbDDXCompileKeymapByNames(xkb,names,want,need,
nameRtrn,nameRtrnLen)){ nameRtrn,nameRtrnLen)){
#ifdef NOISY DebugF("Couldn't compile keymap file\n");
ErrorF("Couldn't compile keymap file\n");
#endif
return 0; return 0;
} }
file= XkbDDXOpenConfigFile(nameRtrn,fileName,PATH_MAX); file= XkbDDXOpenConfigFile(nameRtrn,fileName,PATH_MAX);
@ -502,11 +450,9 @@ unsigned missing;
(void) unlink (fileName); (void) unlink (fileName);
return 0; return 0;
} }
#ifdef DEBUG
else if (xkbDebugFlags) { 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); fclose(file);
(void) unlink (fileName); (void) unlink (fileName);
return (need|want)&(~missing); return (need|want)&(~missing);

View File

@ -50,16 +50,6 @@
#define XKBSRV_NEED_FILE_FUNCS #define XKBSRV_NEED_FILE_FUNCS
#include <xkbsrv.h> #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 #define DFLT_LINE_SIZE 128
@ -171,8 +161,8 @@ Bool endOfFile,spacePending,slashPending,inComment;
} }
if (checkbang && ch=='!') { if (checkbang && ch=='!') {
if (line->num_line!=0) { if (line->num_line!=0) {
PR_DEBUG("The '!' legal only at start of line\n"); DebugF("The '!' legal only at start of line\n");
PR_DEBUG("Line containing '!' ignored\n"); DebugF("Line containing '!' ignored\n");
line->num_line= 0; line->num_line= 0;
inComment= 0; inComment= 0;
break; break;
@ -273,9 +263,7 @@ unsigned present, l_ndx_present, v_ndx_present;
register int i; register int i;
int len, ndx; int len, ndx;
_Xstrtokparams strtok_buf; _Xstrtokparams strtok_buf;
#ifdef DEBUG
Bool found; Bool found;
#endif
l_ndx_present = v_ndx_present = present= 0; l_ndx_present = v_ndx_present = present= 0;
@ -284,9 +272,7 @@ Bool found;
bzero((char *)remap,sizeof(RemapSpec)); bzero((char *)remap,sizeof(RemapSpec));
remap->number = len; remap->number = len;
while ((tok=_XStrtok(str," ",strtok_buf))!=NULL) { while ((tok=_XStrtok(str," ",strtok_buf))!=NULL) {
#ifdef DEBUG
found= False; found= False;
#endif
str= NULL; str= NULL;
if (strcmp(tok,"=")==0) if (strcmp(tok,"=")==0)
continue; continue;
@ -299,22 +285,20 @@ Bool found;
*end != '\0' || ndx == -1) *end != '\0' || ndx == -1)
break; break;
if (ndx < 1 || ndx > XkbNumKbdGroups) { if (ndx < 1 || ndx > XkbNumKbdGroups) {
PR_DEBUG2("Illegal %s index: %d\n", cname[i], ndx); DebugF("Illegal %s index: %d\n", cname[i], ndx);
PR_DEBUG1("Index must be in range 1..%d\n", DebugF("Index must be in range 1..%d\n",
XkbNumKbdGroups); XkbNumKbdGroups);
break; break;
} }
} else { } else {
ndx = 0; ndx = 0;
} }
#ifdef DEBUG
found= True; found= True;
#endif
if (present&(1<<i)) { if (present&(1<<i)) {
if ((i == LAYOUT && l_ndx_present&(1<<ndx)) || if ((i == LAYOUT && l_ndx_present&(1<<ndx)) ||
(i == VARIANT && v_ndx_present&(1<<ndx)) ) { (i == VARIANT && v_ndx_present&(1<<ndx)) ) {
PR_DEBUG1("Component \"%s\" listed twice\n",tok); DebugF("Component \"%s\" listed twice\n",tok);
PR_DEBUG("Second definition ignored\n"); DebugF("Second definition ignored\n");
break; break;
} }
} }
@ -328,38 +312,34 @@ Bool found;
break; break;
} }
} }
#ifdef DEBUG
if (!found) { if (!found) {
fprintf(stderr,"Unknown component \"%s\" ignored\n",tok); fprintf(stderr,"Unknown component \"%s\" ignored\n",tok);
} }
#endif
} }
if ((present&PART_MASK)==0) { if ((present&PART_MASK)==0) {
#ifdef DEBUG
unsigned mask= PART_MASK; 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++) { for (i=0; (i<MAX_WORDS); i++) {
if ((1L<<i)&mask) { if ((1L<<i)&mask) {
mask&= ~(1L<<i); mask&= ~(1L<<i);
if (mask) fprintf(stderr,"\"%s,\" ",cname[i]); if (mask) DebugF("\"%s,\" ",cname[i]);
else fprintf(stderr,"or \"%s\"\n",cname[i]); else DebugF("or \"%s\"\n",cname[i]);
} }
} }
fprintf(stderr,"Illegal mapping ignored\n"); DebugF("Illegal mapping ignored\n");
#endif
remap->num_remap= 0; remap->num_remap= 0;
return; return;
} }
if ((present&COMPONENT_MASK)==0) { if ((present&COMPONENT_MASK)==0) {
PR_DEBUG("Mapping needs at least one component\n"); DebugF("Mapping needs at least one component\n");
PR_DEBUG("Illegal mapping ignored\n"); DebugF("Illegal mapping ignored\n");
remap->num_remap= 0; remap->num_remap= 0;
return; return;
} }
if (((present&COMPONENT_MASK)&(1<<KEYMAP))&& if (((present&COMPONENT_MASK)&(1<<KEYMAP))&&
((present&COMPONENT_MASK)!=(1<<KEYMAP))) { ((present&COMPONENT_MASK)!=(1<<KEYMAP))) {
PR_DEBUG("Keymap cannot appear with other components\n"); DebugF("Keymap cannot appear with other components\n");
PR_DEBUG("Illegal mapping ignored\n"); DebugF("Illegal mapping ignored\n");
remap->num_remap= 0; remap->num_remap= 0;
return; return;
} }
@ -434,8 +414,8 @@ Bool append = False;
} }
if (remap->num_remap==0) { if (remap->num_remap==0) {
PR_DEBUG("Must have a mapping before first line of data\n"); DebugF("Must have a mapping before first line of data\n");
PR_DEBUG("Illegal line of data ignored\n"); DebugF("Illegal line of data ignored\n");
return False; return False;
} }
bzero((char *)&tmp,sizeof(FileSpec)); bzero((char *)&tmp,sizeof(FileSpec));
@ -447,8 +427,8 @@ Bool append = False;
continue; continue;
} }
if (nread>remap->num_remap) { if (nread>remap->num_remap) {
PR_DEBUG("Too many words on a line\n"); DebugF("Too many words on a line\n");
PR_DEBUG1("Extra word \"%s\" ignored\n",tok); DebugF("Extra word \"%s\" ignored\n",tok);
continue; continue;
} }
tmp.name[remap->remap[nread].word]= tok; tmp.name[remap->remap[nread].word]= tok;
@ -456,8 +436,8 @@ Bool append = False;
append = True; append = True;
} }
if (nread<remap->num_remap) { if (nread<remap->num_remap) {
PR_DEBUG1("Too few words on a line: %s\n", line->line); DebugF("Too few words on a line: %s\n", line->line);
PR_DEBUG("line ignored\n"); DebugF("line ignored\n");
return False; return False;
} }
@ -903,9 +883,7 @@ XkbRF_AddRule(XkbRF_RulesPtr rules)
} }
if (!rules->rules) { if (!rules->rules) {
rules->sz_rules= rules->num_rules= 0; rules->sz_rules= rules->num_rules= 0;
#ifdef DEBUG DebugF("Allocation failure in XkbRF_AddRule\n");
fprintf(stderr,"Allocation failure in XkbRF_AddRule\n");
#endif
return NULL; return NULL;
} }
bzero((char *)&rules->rules[rules->num_rules],sizeof(XkbRF_RuleRec)); bzero((char *)&rules->rules[rules->num_rules],sizeof(XkbRF_RuleRec));
@ -1022,7 +1000,7 @@ XkbRF_AddVarDesc(XkbRF_DescribeVarsPtr vars)
} }
if (!vars->desc) { if (!vars->desc) {
vars->sz_desc= vars->num_desc= 0; vars->sz_desc= vars->num_desc= 0;
PR_DEBUG("Allocation failure in XkbRF_AddVarDesc\n"); DebugF("Allocation failure in XkbRF_AddVarDesc\n");
return NULL; return NULL;
} }
vars->desc[vars->num_desc].name= NULL; vars->desc[vars->num_desc].name= NULL;
@ -1059,7 +1037,7 @@ XkbRF_AddVarToDescribe(XkbRF_RulesPtr rules,char *name)
XkbRF_DescribeVarsRec); XkbRF_DescribeVarsRec);
} }
if ((!rules->extra_names)||(!rules->extra)) { 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->sz_extra= rules->num_extra= 0;
rules->extra_names= NULL; rules->extra_names= NULL;
rules->extra= NULL; rules->extra= NULL;
@ -1102,7 +1080,7 @@ int len,headingtype,extra_ndx = 0;
} }
if (extra_ndx<0) { if (extra_ndx<0) {
XkbRF_DescribeVarsPtr var; XkbRF_DescribeVarsPtr var;
PR_DEBUG1("Extra heading \"%s\" encountered\n",tok); DebugF("Extra heading \"%s\" encountered\n",tok);
var= XkbRF_AddVarToDescribe(rules,tok); var= XkbRF_AddVarToDescribe(rules,tok);
if (var) if (var)
extra_ndx= var-rules->extra; extra_ndx= var-rules->extra;
@ -1113,20 +1091,20 @@ int len,headingtype,extra_ndx = 0;
} }
if (headingtype == HEAD_NONE) { if (headingtype == HEAD_NONE) {
PR_DEBUG("Must have a heading before first line of data\n"); DebugF("Must have a heading before first line of data\n");
PR_DEBUG("Illegal line of data ignored\n"); DebugF("Illegal line of data ignored\n");
continue; continue;
} }
len = strlen(line.line); len = strlen(line.line);
if ((tmp.name= strtok(line.line, " \t")) == NULL) { if ((tmp.name= strtok(line.line, " \t")) == NULL) {
PR_DEBUG("Huh? No token on line\n"); DebugF("Huh? No token on line\n");
PR_DEBUG("Illegal line of data ignored\n"); DebugF("Illegal line of data ignored\n");
continue; continue;
} }
if (strlen(tmp.name) == len) { if (strlen(tmp.name) == len) {
PR_DEBUG("No description found\n"); DebugF("No description found\n");
PR_DEBUG("Illegal line of data ignored\n"); DebugF("Illegal line of data ignored\n");
continue; continue;
} }
@ -1134,8 +1112,8 @@ int len,headingtype,extra_ndx = 0;
while ((*tok!='\n')&&isspace(*tok)) while ((*tok!='\n')&&isspace(*tok))
tok++; tok++;
if (*tok == '\0') { if (*tok == '\0') {
PR_DEBUG("No description found\n"); DebugF("No description found\n");
PR_DEBUG("Illegal line of data ignored\n"); DebugF("Illegal line of data ignored\n");
continue; continue;
} }
tmp.desc= tok; tmp.desc= tok;

View File

@ -5784,10 +5784,8 @@ char * str;
return status; return status;
} }
else if (length!=0) { else if (length!=0) {
#ifdef DEBUG
ErrorF("Internal Error! BadLength in ProcXkbGetDeviceInfo\n"); ErrorF("Internal Error! BadLength in ProcXkbGetDeviceInfo\n");
ErrorF(" Wrote %d fewer bytes than expected\n",length); ErrorF(" Wrote %d fewer bytes than expected\n",length);
#endif
return BadLength; return BadLength;
} }
if (stuff->wanted&(~supported)) { if (stuff->wanted&(~supported)) {

View File

@ -130,11 +130,9 @@ xEvent xE;
xE.u.u.type = type; xE.u.u.type = type;
xE.u.u.detail = keyCode; xE.u.u.detail = keyCode;
xE.u.keyButtonPointer.time = GetTimeInMillis(); xE.u.keyButtonPointer.time = GetTimeInMillis();
#ifdef DEBUG
if (xkbDebugFlags&0x8) { 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)) if (_XkbIsPressEvent(type))
XkbDDXKeyClick(keybd,keyCode,TRUE); XkbDDXKeyClick(keybd,keyCode,TRUE);
@ -533,10 +531,8 @@ KeySym * sym = XkbKeySymsPtr(xkbi->desc,key);
((ctrls->enabled_ctrls&(XkbSlowKeysMask|XkbRepeatKeysMask))== ((ctrls->enabled_ctrls&(XkbSlowKeysMask|XkbRepeatKeysMask))==
XkbRepeatKeysMask)) { XkbRepeatKeysMask)) {
if (BitIsOn(keybd->kbdfeed->ctrl.autoRepeats,key)) { if (BitIsOn(keybd->kbdfeed->ctrl.autoRepeats,key)) {
#ifdef DEBUG
if (xkbDebugFlags&0x10) if (xkbDebugFlags&0x10)
ErrorF("Starting software autorepeat...\n"); DebugF("Starting software autorepeat...\n");
#endif
xkbi->repeatKey = key; xkbi->repeatKey = key;
xkbi->repeatKeyTimer= TimerSet(xkbi->repeatKeyTimer, xkbi->repeatKeyTimer= TimerSet(xkbi->repeatKeyTimer,
0, ctrls->repeat_delay, 0, ctrls->repeat_delay,

View File

@ -813,23 +813,21 @@ XkbSrvInfoPtr xkbi;
xkbi= pXDev->key->xkbInfo; xkbi= pXDev->key->xkbInfo;
if ( pClient->xkbClientFlags & _XkbClientInitialized ) { if ( pClient->xkbClientFlags & _XkbClientInitialized ) {
#ifdef DEBUG
if ((xkbDebugFlags&0x10)&& if ((xkbDebugFlags&0x10)&&
((xE[0].u.u.type==KeyPress)||(xE[0].u.u.type==KeyRelease)|| ((xE[0].u.u.type==KeyPress)||(xE[0].u.u.type==KeyRelease)||
(xE[0].u.u.type==DeviceKeyPress)|| (xE[0].u.u.type==DeviceKeyPress)||
(xE[0].u.u.type == DeviceKeyRelease))) { (xE[0].u.u.type == DeviceKeyRelease))) {
ErrorF("XKbFilterWriteEvents:\n"); DebugF("XKbFilterWriteEvents:\n");
ErrorF(" Event state= 0x%04x\n",xE[0].u.keyButtonPointer.state); DebugF(" Event state= 0x%04x\n",xE[0].u.keyButtonPointer.state);
ErrorF(" XkbLastRepeatEvent!=xE (0x%p!=0x%p) %s\n", DebugF(" XkbLastRepeatEvent!=xE (0x%p!=0x%p) %s\n",
XkbLastRepeatEvent,xE, XkbLastRepeatEvent,xE,
((XkbLastRepeatEvent!=(pointer)xE)?"True":"False")); ((XkbLastRepeatEvent!=(pointer)xE)?"True":"False"));
ErrorF(" (xkbClientEventsFlags&XWDA)==0 (0x%x) %s\n", DebugF(" (xkbClientEventsFlags&XWDA)==0 (0x%x) %s\n",
pClient->xkbClientFlags, pClient->xkbClientFlags,
(_XkbWantsDetectableAutoRepeat(pClient)?"True":"False")); (_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"); (!_XkbIsReleaseEvent(xE[0].u.u.type))?"True":"False");
} }
#endif /* DEBUG */
if ( (XkbLastRepeatEvent==(pointer)xE) && if ( (XkbLastRepeatEvent==(pointer)xE) &&
(_XkbWantsDetectableAutoRepeat(pClient)) && (_XkbWantsDetectableAutoRepeat(pClient)) &&
(_XkbIsReleaseEvent(xE[0].u.u.type)) ) { (_XkbIsReleaseEvent(xE[0].u.u.type)) ) {
@ -866,13 +864,11 @@ XkbSrvInfoPtr xkbi;
if (xE[0].u.u.type == ButtonPress && if (xE[0].u.u.type == ButtonPress &&
((xE[0].u.keyButtonPointer.state >> 7) & button_mask) == button_mask && ((xE[0].u.keyButtonPointer.state >> 7) & button_mask) == button_mask &&
(xkbi->lockedPtrButtons & button_mask) == button_mask) { (xkbi->lockedPtrButtons & button_mask) == button_mask) {
#ifdef DEBUG
/* If the MouseKeys is pressed, and the "real" mouse is also pressed /* If the MouseKeys is pressed, and the "real" mouse is also pressed
* when the mouse is released, the server does not behave properly. * when the mouse is released, the server does not behave properly.
* Faking a release of the button here solves the problem. * Faking a release of the button here solves the problem.
*/ */
ErrorF("Faking release of button %d\n", xE[0].u.u.detail); DebugF("Faking release of button %d\n", xE[0].u.u.detail);
#endif
XkbDDXFakePointerButton(ButtonRelease, xE[0].u.u.detail); XkbDDXFakePointerButton(ButtonRelease, xE[0].u.u.detail);
} }
} }
@ -881,21 +877,19 @@ XkbSrvInfoPtr xkbi;
for (i=0;i<nEvents;i++) { for (i=0;i<nEvents;i++) {
type= xE[i].u.u.type; type= xE[i].u.u.type;
#ifdef DEBUG
if ((xkbDebugFlags&0x4)&& if ((xkbDebugFlags&0x4)&&
((xE[i].u.u.type==KeyPress)||(xE[i].u.u.type==KeyRelease)|| ((xE[i].u.u.type==KeyPress)||(xE[i].u.u.type==KeyRelease)||
(xE[i].u.u.type==DeviceKeyPress)|| (xE[i].u.u.type==DeviceKeyPress)||
(xE[i].u.u.type == DeviceKeyRelease))) { (xE[i].u.u.type == DeviceKeyRelease))) {
XkbStatePtr s= &xkbi->state; XkbStatePtr s= &xkbi->state;
ErrorF("XKbFilterWriteEvents (non-XKB):\n"); DebugF("XKbFilterWriteEvents (non-XKB):\n");
ErrorF("event= 0x%04x\n",xE[i].u.keyButtonPointer.state); DebugF("event= 0x%04x\n",xE[i].u.keyButtonPointer.state);
ErrorF("lookup= 0x%02x, grab= 0x%02x\n",s->lookup_mods, DebugF("lookup= 0x%02x, grab= 0x%02x\n",s->lookup_mods,
s->grab_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_lookup_mods,
s->compat_grab_mods); s->compat_grab_mods);
} }
#endif
if ( (type>=KeyPress)&&(type<=MotionNotify) ) { if ( (type>=KeyPress)&&(type<=MotionNotify) ) {
CARD16 old,new; CARD16 old,new;
@ -924,16 +918,12 @@ XkbSrvInfoPtr xkbi;
if (type == ButtonPress && if (type == ButtonPress &&
((xE[i].u.keyButtonPointer.state >> 7) & button_mask) == button_mask && ((xE[i].u.keyButtonPointer.state >> 7) & button_mask) == button_mask &&
(xkbi->lockedPtrButtons & button_mask) == button_mask) { (xkbi->lockedPtrButtons & button_mask) == button_mask) {
#ifdef DEBUG DebugF("Faking release of button %d\n", xE[i].u.u.detail);
ErrorF("Faking release of button %d\n", xE[i].u.u.detail);
#endif
XkbDDXFakePointerButton(ButtonRelease, xE[i].u.u.detail); XkbDDXFakePointerButton(ButtonRelease, xE[i].u.u.detail);
} else if (type == DeviceButtonPress && } else if (type == DeviceButtonPress &&
((((deviceKeyButtonPointer*)&xE[i])->state >> 7) & button_mask) == button_mask && ((((deviceKeyButtonPointer*)&xE[i])->state >> 7) & button_mask) == button_mask &&
(xkbi->lockedPtrButtons & button_mask) == button_mask) { (xkbi->lockedPtrButtons & button_mask) == button_mask) {
#ifdef DEBUG DebugF("Faking release of button %d\n", ((deviceKeyButtonPointer*)&xE[i])->state);
ErrorF("Faking release of button %d\n", ((deviceKeyButtonPointer*)&xE[i])->state);
#endif
XkbDDXFakePointerButton(DeviceButtonRelease, ((deviceKeyButtonPointer*)&xE[i])->state); XkbDDXFakePointerButton(DeviceButtonRelease, ((deviceKeyButtonPointer*)&xE[i])->state);
} }
} }

View File

@ -280,10 +280,6 @@ XkbSetRulesDflts(char *rulesFile,char *model,char *layout,
/***====================================================================***/ /***====================================================================***/
#if defined(luna)
#define XKB_DDX_PERMANENT_LOCK 1
#endif
#include "xkbDflts.h" #include "xkbDflts.h"
static Bool static Bool
@ -390,15 +386,6 @@ Atom unknown;
names->indicators[LED_COMPOSE-1] = CREATE_ATOM("Compose"); names->indicators[LED_COMPOSE-1] = CREATE_ATOM("Compose");
#endif #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) if (xkb->geom!=NULL)
names->geometry= xkb->geom->name; names->geometry= xkb->geom->name;
else names->geometry= unknown; else names->geometry= unknown;
@ -771,9 +758,7 @@ XkbSrvLedInfoPtr sli;
sli= XkbFindSrvLedInfo(pXDev,XkbDfltXIClass,XkbDfltXIId,0); sli= XkbFindSrvLedInfo(pXDev,XkbDfltXIClass,XkbDfltXIId,0);
if (sli && xkbi) if (sli && xkbi)
XkbCheckIndicatorMaps(xkbi->device,sli,XkbAllIndicatorsMask); XkbCheckIndicatorMaps(xkbi->device,sli,XkbAllIndicatorsMask);
#ifdef DEBUG else DebugF("No indicator feedback in XkbFinishInit (shouldn't happen)!\n");
else ErrorF("No indicator feedback in XkbFinishInit (shouldn't happen)!\n");
#endif
return softRepeat; return softRepeat;
} }

View File

@ -56,11 +56,9 @@ int xiEvent;
xkbi= keyc->xkbInfo; xkbi= keyc->xkbInfo;
key= xE->u.u.detail; key= xE->u.u.detail;
xiEvent= (xE->u.u.type & EXTENSION_EVENT_BASE); xiEvent= (xE->u.u.type & EXTENSION_EVENT_BASE);
#ifdef DEBUG
if (xkbDebugFlags&0x8) { 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) && if ( (xkbi->repeatKey==key) && (xE->u.u.type==KeyRelease) &&
((xkbi->desc->ctrls->enabled_ctrls&XkbRepeatKeysMask)==0) ) { ((xkbi->desc->ctrls->enabled_ctrls&XkbRepeatKeysMask)==0) ) {

View File

@ -211,16 +211,6 @@ KeySym tsyms[XkbMaxSymsPerKey],*syms;
XkbMapChangesPtr mc; XkbMapChangesPtr mc;
xkb= pXDev->key->xkbInfo->desc; 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) { if (first+num-1>xkb->max_key_code) {
/* 1/12/95 (ef) -- XXX! should allow XKB structures to grow */ /* 1/12/95 (ef) -- XXX! should allow XKB structures to grow */
num= xkb->max_key_code-first+1; num= xkb->max_key_code-first+1;

View File

@ -40,8 +40,7 @@
#include "misc.h" #include "misc.h"
#include "inputstr.h" #include "inputstr.h"
#include "xkbstr.h" #include "xkbstr.h"
#define XKBSRV_NEED_FILE_FUNCS #include "xkbsrv.h"
#include <xkbsrv.h>
#include "xkbgeom.h" #include "xkbgeom.h"
Atom Atom
@ -52,10 +51,6 @@ XkbInternAtom(Display *dpy,char *str,Bool only_if_exists)
return MakeAtom(str,strlen(str),!only_if_exists); return MakeAtom(str,strlen(str),!only_if_exists);
} }
#ifndef SEEK_SET
#define SEEK_SET 0
#endif
char * char *
_XkbDupString(char *str) _XkbDupString(char *str)
{ {
@ -562,10 +557,8 @@ FindTypeForKey(XkbDescPtr xkb,Atom name,unsigned width,KeySym *syms)
register unsigned i; register unsigned i;
for (i=0;i<xkb->map->num_types;i++) { for (i=0;i<xkb->map->num_types;i++) {
if (xkb->map->types[i].name==name) { if (xkb->map->types[i].name==name) {
#ifdef DEBUG
if (xkb->map->types[i].num_levels!=width) if (xkb->map->types[i].num_levels!=width)
fprintf(stderr,"Group width mismatch between key and type\n"); DebugF("Group width mismatch between key and type\n");
#endif
return &xkb->map->types[i]; return &xkb->map->types[i];
} }
} }
@ -1086,10 +1079,8 @@ unsigned i,size_toc;
fread(file_info,SIZEOF(xkmFileInfo),1,file); fread(file_info,SIZEOF(xkmFileInfo),1,file);
size_toc= file_info->num_toc; size_toc= file_info->num_toc;
if (size_toc>max_toc) { if (size_toc>max_toc) {
#ifdef DEBUG DebugF("Warning! Too many TOC entries; last %d ignored\n",
fprintf(stderr,"Warning! Too many TOC entries; last %d ignored\n",
size_toc-max_toc); size_toc-max_toc);
#endif
size_toc= max_toc; size_toc= max_toc;
} }
for (i=0;i<size_toc;i++) { for (i=0;i<size_toc;i++) {
@ -1227,11 +1218,7 @@ unsigned which= need|want;
if (result->xkb==NULL) if (result->xkb==NULL)
result->xkb= XkbAllocKeyboard(); result->xkb= XkbAllocKeyboard();
for (i=0;i<fileInfo.num_toc;i++) { for (i=0;i<fileInfo.num_toc;i++) {
#ifdef SEEK_SET
fseek(file,toc[i].offset,SEEK_SET); fseek(file,toc[i].offset,SEEK_SET);
#else
fseek(file,toc[i].offset,0);
#endif
tmp= fread(&tmpTOC,SIZEOF(xkmSectionInfo),1,file); tmp= fread(&tmpTOC,SIZEOF(xkmSectionInfo),1,file);
nRead= tmp*SIZEOF(xkmSectionInfo); nRead= tmp*SIZEOF(xkmSectionInfo);
if ((tmpTOC.type!=toc[i].type)||(tmpTOC.format!=toc[i].format)|| if ((tmpTOC.type!=toc[i].type)||(tmpTOC.format!=toc[i].format)||