diff --git a/configure.ac b/configure.ac index 6d056fec4..c8bdf38e2 100644 --- a/configure.ac +++ b/configure.ac @@ -1061,6 +1061,25 @@ dnl has it in libc), or if libdl is needed to get it. *) ;; esac + + # check whether struct kbd_repeat has the 'period' field. + # on kernels < 2.5.42 it's called 'rate' instead. + AC_TRY_COMPILE([ +#include +#ifdef __sparc__ +#include +#include +#endif +],[ +int main () { + struct kbd_repeat k; + k.period = 0; + return 0; +}], + [period_field="period"], + [period_field="rate"]) + AC_DEFINE_UNQUOTED(LNX_KBD_PERIOD_NAME, [$period_field], + [Name of the period field in struct kbd_repeat]) ;; freebsd* | kfreebsd*-gnu) XORG_OS="freebsd" diff --git a/dix/Makefile.am b/dix/Makefile.am index c9a19f77b..414f1258c 100644 --- a/dix/Makefile.am +++ b/dix/Makefile.am @@ -29,7 +29,8 @@ libdix_la_SOURCES = \ swaprep.c \ swapreq.c \ tables.c \ - window.c + window.c \ + strcasecmp.c libxpstubs_la_SOURCES = \ xpstubs.c diff --git a/dix/strcasecmp.c b/dix/strcasecmp.c new file mode 100644 index 000000000..bf3f0088e --- /dev/null +++ b/dix/strcasecmp.c @@ -0,0 +1,50 @@ +/* $Xorg: xkbmisc.c,v 1.4 2000/08/17 19:46:44 cpqbld Exp $ */ +/************************************************************ + 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: xc/lib/xkbfile/xkbmisc.c,v 1.7 2003/07/16 02:31:10 dawes Exp $ */ + +#ifdef HAVE_DIX_CONFIG_H +#include +#endif + +#include +#include "dix.h" + +#ifdef NEED_STRCASECMP +int +xstrcasecmp(char *str1,char *str2) +{ + const u_char *us1 = (const u_char *)str1, *us2 = (const u_char *)str2; + + while (tolower(*us1) == tolower(*us2)) { + if (*us1++ == '\0') + return (0); + us2++; + } + + return (tolower(*us1) - tolower(*us2)); +} +#endif diff --git a/hw/xfree86/dixmods/Makefile.am b/hw/xfree86/dixmods/Makefile.am index d1b806a7e..9023a0cb0 100644 --- a/hw/xfree86/dixmods/Makefile.am +++ b/hw/xfree86/dixmods/Makefile.am @@ -95,6 +95,7 @@ libtype1_la_SOURCES = type1mod.c libdixmods_la_SOURCES = $(top_srcdir)/mi/miinitext.c libxorgxkb_la_SOURCES = xkbVT.c xkbPrivate.c xkbKillSrv.c +libxorgxkb_la_LIBADD = $(top_builddir)/dix/libdix.la libxtrap_la_LDFLAGS = -avoid-version libxtrap_la_LIBADD = $(top_builddir)/XTrap/libxtrap.la diff --git a/hw/xfree86/dixmods/xkbPrivate.c b/hw/xfree86/dixmods/xkbPrivate.c index 0479bcac3..b986432d5 100644 --- a/hw/xfree86/dixmods/xkbPrivate.c +++ b/hw/xfree86/dixmods/xkbPrivate.c @@ -26,13 +26,13 @@ XkbDDXPrivate(DeviceIntPtr dev,KeyCode key,XkbAction *act) if (xf86act->type == XkbSA_XFree86Private) { memcpy(msgbuf, xf86act->data, XkbAnyActionDataSize); msgbuf[XkbAnyActionDataSize]= '\0'; - if (strcmp(msgbuf, "-vmode")==0) + if (strcasecmp(msgbuf, "-vmode")==0) xf86ProcessActionEvent(ACTION_PREV_MODE, NULL); - else if (strcmp(msgbuf, "+vmode")==0) + else if (strcasecmp(msgbuf, "+vmode")==0) xf86ProcessActionEvent(ACTION_NEXT_MODE, NULL); - else if (strcmp(msgbuf, "ungrab")==0) + else if (strcasecmp(msgbuf, "ungrab")==0) xf86ProcessActionEvent(ACTION_DISABLEGRAB, NULL); - else if (strcmp(msgbuf, "clsgrb")==0) + else if (strcasecmp(msgbuf, "clsgrb")==0) xf86ProcessActionEvent(ACTION_CLOSECLIENT, NULL); else xf86ProcessActionEvent(ACTION_MESSAGE, (void *) msgbuf); diff --git a/hw/xfree86/os-support/linux/lnx_io.c b/hw/xfree86/os-support/linux/lnx_io.c index 32f660108..eb8cd537e 100644 --- a/hw/xfree86/os-support/linux/lnx_io.c +++ b/hw/xfree86/os-support/linux/lnx_io.c @@ -67,25 +67,6 @@ xf86GetKbdLeds() return(leds); } -/* kbd rate stuff based on kbdrate.c from Rik Faith et.al. - * from util-linux-2.9t package */ - -#include -#include -#ifdef __sparc__ -#include -#include -#endif - -/* Deal with spurious kernel header change in struct kbd_repeat. - We undo this define after the routine using that struct is over, - so as not to interfere with other 'rate' elements. */ -#if defined(LINUX_VERSION_CODE) && defined(KERNEL_VERSION) -# if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,42) -# define rate period -# endif -#endif - static int KDKBDREP_ioctl_ok(int rate, int delay) { #if defined(KDKBDREP) && !defined(__sparc__) @@ -94,18 +75,18 @@ KDKBDREP_ioctl_ok(int rate, int delay) { struct kbd_repeat kbdrep_s; /* don't change, just test */ - kbdrep_s.rate = -1; + kbdrep_s.LNX_KBD_PERIOD_NAME = -1; kbdrep_s.delay = -1; if (ioctl( xf86Info.consoleFd, KDKBDREP, &kbdrep_s )) { return 0; } /* do the change */ if (rate == 0) /* switch repeat off */ - kbdrep_s.rate = 0; + kbdrep_s.LNX_KBD_PERIOD_NAME = 0; else - kbdrep_s.rate = 10000 / rate; /* convert cps to msec */ - if (kbdrep_s.rate < 1) - kbdrep_s.rate = 1; + kbdrep_s.LNX_KBD_PERIOD_NAME = 10000 / rate; /* convert cps to msec */ + if (kbdrep_s.LNX_KBD_PERIOD_NAME < 1) + kbdrep_s.LNX_KBD_PERIOD_NAME = 1; kbdrep_s.delay = delay; if (kbdrep_s.delay < 1) kbdrep_s.delay = 1; @@ -120,15 +101,6 @@ KDKBDREP_ioctl_ok(int rate, int delay) { #endif /* KDKBDREP */ } -#undef rate - -/* Undo the earlier define for the struct kbd_repeat problem. */ -#if defined(LINUX_VERSION_CODE) && defined(KERNEL_VERSION) -# if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,42) -# undef rate -# endif -#endif - static int KIOCSRATE_ioctl_ok(int rate, int delay) { #ifdef KIOCSRATE diff --git a/hw/xfree86/os-support/linux/lnx_kbd.c b/hw/xfree86/os-support/linux/lnx_kbd.c index 504c52710..2912f1699 100644 --- a/hw/xfree86/os-support/linux/lnx_kbd.c +++ b/hw/xfree86/os-support/linux/lnx_kbd.c @@ -97,25 +97,6 @@ GetKbdLeds(InputInfoPtr pInfo) return(leds); } -/* kbd rate stuff based on kbdrate.c from Rik Faith et.al. - * from util-linux-2.9t package */ - -#include -#include -#ifdef __sparc__ -#include -#include -#endif - -/* Deal with spurious kernel header change in struct kbd_repeat. - We undo this define after the routine using that struct is over, - so as not to interfere with other 'rate' elements. */ -#if defined(LINUX_VERSION_CODE) && defined(KERNEL_VERSION) -# if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,42) -# define rate period -# endif -#endif - static int KDKBDREP_ioctl_ok(int rate, int delay) { #if defined(KDKBDREP) && !defined(__sparc__) @@ -124,7 +105,7 @@ KDKBDREP_ioctl_ok(int rate, int delay) { struct kbd_repeat kbdrep_s; /* don't change, just test */ - kbdrep_s.rate = -1; + kbdrep_s.LNX_KBD_PERIOD_NAME = -1; kbdrep_s.delay = -1; if (ioctl( xf86Info.consoleFd, KDKBDREP, &kbdrep_s )) { return 0; @@ -132,11 +113,11 @@ KDKBDREP_ioctl_ok(int rate, int delay) { /* do the change */ if (rate == 0) /* switch repeat off */ - kbdrep_s.rate = 0; + kbdrep_s.LNX_KBD_PERIOD_NAME = 0; else - kbdrep_s.rate = 10000 / rate; /* convert cps to msec */ - if (kbdrep_s.rate < 1) - kbdrep_s.rate = 1; + kbdrep_s.LNX_KBD_PERIOD_NAME = 10000 / rate; /* convert cps to msec */ + if (kbdrep_s.LNX_KBD_PERIOD_NAME < 1) + kbdrep_s.LNX_KBD_PERIOD_NAME = 1; kbdrep_s.delay = delay; if (kbdrep_s.delay < 1) kbdrep_s.delay = 1; @@ -151,15 +132,6 @@ KDKBDREP_ioctl_ok(int rate, int delay) { #endif /* KDKBDREP */ } -#undef rate - -/* Undo the earlier define for the struct kbd_repeat problem. */ -#if defined(LINUX_VERSION_CODE) && defined(KERNEL_VERSION) -# if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,42) -# undef rate -# endif -#endif - static int KIOCSRATE_ioctl_ok(int rate, int delay) { #ifdef KIOCSRATE diff --git a/include/dix.h b/include/dix.h index 01777213d..84fc84926 100644 --- a/include/dix.h +++ b/include/dix.h @@ -820,4 +820,10 @@ typedef struct { SelectionCallbackKind kind; } SelectionInfoRec; +/* strcasecmp.c */ +#if NEED_STRCASECMP +#define strcasecmp xstrcasecmp +extern int xstrcasecmp(char *s1, char *s2); +#endif + #endif /* DIX_H */ diff --git a/include/xorg-config.h.in b/include/xorg-config.h.in index a5074f6e1..e43d1d13f 100644 --- a/include/xorg-config.h.in +++ b/include/xorg-config.h.in @@ -106,4 +106,7 @@ /* Has backtrace support */ #undef HAVE_BACKTRACE +/* Name of the period field in struct kbd_repeat */ +#undef LNX_KBD_PERIOD_NAME + #endif /* _XORG_CONFIG_H_ */ diff --git a/xkb/maprules.c b/xkb/maprules.c index d4e982920..eff02ad34 100644 --- a/xkb/maprules.c +++ b/xkb/maprules.c @@ -62,12 +62,6 @@ #define PR_DEBUG2(s,a,b) #endif -#ifdef NEED_STRCASECMP -extern int _XkbStrCaseCmp(char *s1, char *s2); -#else -#define _XkbStrCaseCmp strcasecmp -#endif - /***====================================================================***/ #define DFLT_LINE_SIZE 128 @@ -1092,20 +1086,20 @@ int len,headingtype,extra_ndx = 0; for ( ; GetInputLine(file,&line,False); line.num_line= 0) { if (line.line[0]=='!') { tok = strtok(&(line.line[1]), " \t"); - if (_XkbStrCaseCmp(tok,"model") == 0) + if (strcasecmp(tok,"model") == 0) headingtype = HEAD_MODEL; - else if (_XkbStrCaseCmp(tok,"layout") == 0) + else if (strcasecmp(tok,"layout") == 0) headingtype = HEAD_LAYOUT; - else if (_XkbStrCaseCmp(tok,"variant") == 0) + else if (strcasecmp(tok,"variant") == 0) headingtype = HEAD_VARIANT; - else if (_XkbStrCaseCmp(tok,"option") == 0) + else if (strcasecmp(tok,"option") == 0) headingtype = HEAD_OPTION; else { int i; headingtype = HEAD_EXTRA; extra_ndx= -1; for (i=0;(inum_extra)&&(extra_ndx<0);i++) { - if (!_XkbStrCaseCmp(tok,rules->extra_names[i])) + if (!strcasecmp(tok,rules->extra_names[i])) extra_ndx= i; } if (extra_ndx<0) { diff --git a/xkb/xkbfmisc.c b/xkb/xkbfmisc.c index 3389ba88e..3ed68c267 100644 --- a/xkb/xkbfmisc.c +++ b/xkb/xkbfmisc.c @@ -247,19 +247,3 @@ XkbNameMatchesPattern(char *name,char *ptrn) /* if we get here, the pattern is exhausted (-:just like me:-) */ return (name[0]=='\0'); } - -#ifdef NEED_STRCASECMP -_X_HIDDEN int -_XkbStrCaseCmp(char *str1,char *str2) -{ - const u_char *us1 = (const u_char *)str1, *us2 = (const u_char *)str2; - - while (tolower(*us1) == tolower(*us2)) { - if (*us1++ == '\0') - return (0); - us2++; - } - - return (tolower(*us1) - tolower(*us2)); -} -#endif