diff options
Diffstat (limited to 'src/xkb')
-rw-r--r-- | src/xkb/XKB.c | 21 | ||||
-rw-r--r-- | src/xkb/XKBAlloc.c | 1 | ||||
-rw-r--r-- | src/xkb/XKBBind.c | 107 | ||||
-rw-r--r-- | src/xkb/XKBCtrls.c | 11 | ||||
-rw-r--r-- | src/xkb/XKBCvt.c | 327 | ||||
-rw-r--r-- | src/xkb/XKBExtDev.c | 13 | ||||
-rw-r--r-- | src/xkb/XKBGAlloc.c | 1 | ||||
-rw-r--r-- | src/xkb/XKBGeom.c | 3 | ||||
-rw-r--r-- | src/xkb/XKBGetMap.c | 9 | ||||
-rw-r--r-- | src/xkb/XKBMAlloc.c | 1 | ||||
-rw-r--r-- | src/xkb/XKBMisc.c | 18 | ||||
-rw-r--r-- | src/xkb/XKBNames.c | 11 | ||||
-rw-r--r-- | src/xkb/XKBRdBuf.c | 3 | ||||
-rw-r--r-- | src/xkb/XKBSetMap.c | 1 | ||||
-rw-r--r-- | src/xkb/XKBUse.c | 151 | ||||
-rw-r--r-- | src/xkb/XKBleds.c | 4 | ||||
-rw-r--r-- | src/xkb/XKBlibint.h | 1 |
17 files changed, 217 insertions, 466 deletions
diff --git a/src/xkb/XKB.c b/src/xkb/XKB.c index 22a8731..b407bcc 100644 --- a/src/xkb/XKB.c +++ b/src/xkb/XKB.c @@ -24,6 +24,7 @@ OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ +/* $XFree86: xc/lib/X11/XKB.c,v 1.7 2002/12/10 04:30:39 dawes Exp $ */ #include <stdio.h> #define NEED_REPLIES @@ -171,7 +172,7 @@ XkbSelectEventDetails(dpy,deviceSpec,eventType,affect,details) { register xkbSelectEventsReq *req; XkbInfoPtr xkbi; - int size; + int size = 0; char *out; union { CARD8 *c8; @@ -416,9 +417,10 @@ XkbSetXlibControls(dpy,affect,values) unsigned values; #endif { - if ((dpy->flags & XlibDisplayNoXkb) || - (!dpy->xkb_info && !XkbUseExtension(dpy,NULL,NULL))) - return False; + if (!dpy->xkb_info) + XkbUseExtension(dpy,NULL,NULL); + if (!dpy->xkb_info) + return 0; affect&= XkbLC_AllControls; dpy->xkb_info->xlib_ctrls&= ~affect; dpy->xkb_info->xlib_ctrls|= (affect&values); @@ -433,8 +435,9 @@ XkbGetXlibControls(dpy) Display * dpy; #endif { - if ((dpy->flags & XlibDisplayNoXkb) || - (!dpy->xkb_info && !XkbUseExtension(dpy,NULL,NULL))) + if (!dpy->xkb_info) + XkbUseExtension(dpy,NULL,NULL); + if (!dpy->xkb_info) return 0; return dpy->xkb_info->xlib_ctrls; } @@ -528,7 +531,7 @@ XkbComputeEffectiveMap(xkb,type,map_rtrn) { register int i; unsigned tmp; -XkbKTMapEntryPtr entry; +XkbKTMapEntryPtr entry = NULL; if ((!xkb)||(!type)||(!xkb->server)) return False; @@ -853,7 +856,9 @@ XkbInfoPtr xkbi; UnlockDisplay(dpy); SyncHandle(); if (ctrls) - *ctrls= (rep.value&XkbPCF_GrabsUseXKBStateMask|XkbPCF_LookupStateWhenGrabbed|XkbPCF_SendEventUsesXKBState); + *ctrls= (rep.value & (XkbPCF_GrabsUseXKBStateMask | + XkbPCF_LookupStateWhenGrabbed | + XkbPCF_SendEventUsesXKBState)); return (True); } diff --git a/src/xkb/XKBAlloc.c b/src/xkb/XKBAlloc.c index 82e98f4..c6fd855 100644 --- a/src/xkb/XKBAlloc.c +++ b/src/xkb/XKBAlloc.c @@ -24,6 +24,7 @@ OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ +/* $XFree86: xc/lib/X11/XKBAlloc.c,v 3.5 2001/01/17 19:41:48 dawes Exp $ */ #ifndef XKB_IN_SERVER diff --git a/src/xkb/XKBBind.c b/src/xkb/XKBBind.c index 4c6334a..138331d 100644 --- a/src/xkb/XKBBind.c +++ b/src/xkb/XKBBind.c @@ -26,6 +26,8 @@ other dealings in this Software without prior written authorization from The Open Group. */ +/* $XFree86: xc/lib/X11/XKBBind.c,v 3.15 2003/02/15 17:49:01 dawes Exp $ */ + /* the new monsters ate the old ones */ #define NEED_EVENTS @@ -458,8 +460,11 @@ XRefreshKeyboardMapping(event) XkbMapChangesRec changes; XkbInfoPtr xkbi; + /* always do this for input methods, which still use the old keymap */ + (void) _XRefreshKeyboardMapping(event); + if (_XkbUnavailable(dpy)) - return _XRefreshKeyboardMapping(event); + return 1; xkbi = dpy->xkb_info; @@ -582,8 +587,6 @@ _XkbLoadDpy(dpy) LockDisplay(dpy); xkbi->desc = desc; - _XkbGetConverters(_XkbGetCharset(),&xkbi->cvt); - _XkbGetConverters("ISO8859-1",&xkbi->latin1cvt); UnlockDisplay(dpy); oldEvents= xkbi->selected_events; if (!(xkbi->xlib_ctrls&XkbLC_IgnoreNewKeyboards)) { @@ -669,35 +672,26 @@ XkbTranslateKeySym(dpy, sym_rtrn, mods, buffer, nbytes, extra_rtrn) XkbKSToMBFunc cvtr; XPointer priv; char tmp[4]; - register struct _XKeytrans *p; int n; + xkb= dpy->xkb_info; + if (!xkb->cvt.KSToMB) { + _XkbGetConverters(_XkbGetCharset(),&xkb->cvt); + _XkbGetConverters("ISO8859-1",&xkb->latin1cvt); + } + if (extra_rtrn) *extra_rtrn= 0; - if (_XkbUnavailable(dpy)) - return _XTranslateKeySym(dpy, *sym_rtrn, mods, buffer, nbytes); - _XkbCheckPendingRefresh(dpy,dpy->xkb_info); - - xkb= dpy->xkb_info; if ((buffer==NULL)||(nbytes==0)) { buffer= tmp; nbytes= 4; } /* see if symbol rebound, if so, return that string. */ - for (p = dpy->key_bindings; p; p = p->next) { - if (((mods & AllMods) == p->state) && (*sym_rtrn == p->key)) { - int tmp = p->len; - if (tmp > nbytes) { - if (extra_rtrn) - *extra_rtrn= tmp-nbytes; - tmp = nbytes; - } - memcpy (buffer, p->string, tmp); - return tmp; - } - } + n = XkbLookupKeyBinding(dpy,*sym_rtrn,mods,buffer,nbytes,extra_rtrn); + if (n) + return n; if ( nbytes>0 ) buffer[0]= '\0'; @@ -717,35 +711,23 @@ XkbTranslateKeySym(dpy, sym_rtrn, mods, buffer, nbytes, extra_rtrn) if ((!xkb->cvt.KSToUpper)&&( mods&LockMask )) { register int i; - - if (!xkb->cvt.KSToUpper) { - int change; - char ch; - for (i=change=0;i<n;i++) { - ch= toupper(buffer[i]); - change= (change||(buffer[i]!=ch)); - buffer[i] = ch; - } - if (change) { - if (n==1) - *sym_rtrn=(*xkb->cvt.MBToKS)(xkb->cvt.MBToKSPriv, - buffer,n,0); - else *sym_rtrn= NoSymbol; - } + int change; + char ch; + for (i=change=0;i<n;i++) { + ch= toupper(buffer[i]); + change= (change||(buffer[i]!=ch)); + buffer[i] = ch; + } + if (change) { + if (n==1) + *sym_rtrn=(*xkb->cvt.MBToKS)(xkb->cvt.MBToKSPriv,buffer,n,0); + else *sym_rtrn= NoSymbol; } } if ( mods&ControlMask ) { if ( n==1 ) { - register char c = buffer[0]; - - if ((c >= '@' && c < '\177') || c == ' ') c &= 0x1F; - else if (c == '2') c = '\000'; - else if (c >= '3' && c <= '7') c -= ('3' - '\033'); - else if (c == '8') c = '\177'; - else if (c == '/') c = '_' & 0x1F; - - buffer[0]= c; + buffer[0]= XkbToControl(buffer[0]); if ( nbytes>1 ) buffer[1]= '\0'; return 1; @@ -779,14 +761,10 @@ XLookupString (event, buffer, nbytes, keysym, status) Display *dpy = event->display; XkbDescPtr xkb; - if (_XkbUnavailable(dpy)) - return _XLookupString(event, buffer, nbytes, keysym, status); - _XkbCheckPendingRefresh(dpy,dpy->xkb_info); - if (keysym==NULL) keysym= &dummy; xkb= dpy->xkb_info->desc; - if (!XkbTranslateKeyCode(xkb,event->keycode,event->state, &new_mods,keysym)) + if (!XkbLookupKeySym(dpy,event->keycode,event->state, &new_mods,keysym)) return 0; new_mods= (event->state&(~new_mods)); @@ -887,7 +865,8 @@ XLookupString (event, buffer, nbytes, keysym, status) /* We *should* use the new_mods (which does not contain any modifiers */ /* that were used to compute the symbol here, but pre-XKB XLookupString */ /* did not and we have to remain compatible. Sigh. */ - if ((dpy->xkb_info->flags&XkbLC_ConsumeLookupMods)==0) + if (_XkbUnavailable(dpy) || + (dpy->xkb_info->xlib_ctrls&XkbLC_ConsumeLookupMods)==0) new_mods= event->state; rtrnLen= XkbLookupKeyBinding(dpy,*keysym,new_mods,buffer,nbytes,NULL); @@ -895,14 +874,24 @@ XLookupString (event, buffer, nbytes, keysym, status) return rtrnLen; rtrnLen = XkbTranslateKeySym(dpy,keysym,new_mods,buffer,nbytes,NULL); + if ((event->state&ControlMask)&&(nbytes>0)&& - ((rtrnLen==0)||((rtrnLen==1)&&(buffer[0]>=' ')))&& - (XkbGroupForCoreState(event->state)!=XkbGroup1Index)&& + ((rtrnLen==0)|| + ((rtrnLen==1)&&((unsigned char) buffer[0]>=' ')))&& (dpy->xkb_info->xlib_ctrls&XkbLC_ControlFallback)) { XKeyEvent tmp_ev; tmp_ev= *event; - tmp_ev.state= XkbBuildCoreState(event->state,XkbGroup1Index); - return XLookupString (&tmp_ev, buffer, nbytes, keysym, status); + if (_XkbUnavailable(dpy)) { + if (event->state & dpy->mode_switch) { + tmp_ev.state= event->state & ~dpy->mode_switch; + return XLookupString (&tmp_ev, buffer, nbytes, keysym, status); + } + } else { + if (XkbGroupForCoreState(event->state) != XkbGroup1Index) { + tmp_ev.state= XkbBuildCoreState(event->state,XkbGroup1Index); + return XLookupString (&tmp_ev, buffer, nbytes, keysym, status); + } + } } return rtrnLen; } @@ -948,12 +937,14 @@ XkbLookupKeyBinding(dpy, sym, mods, buffer, nbytes, extra_rtrn) char #if NeedFunctionPrototypes -XkbToControl( char c ) +XkbToControl( char ch ) #else -XkbToControl( c ) - char c; +XkbToControl( ch ) + char ch; #endif { + register char c = ch; + if ((c >= '@' && c < '\177') || c == ' ') c &= 0x1F; else if (c == '2') c = '\000'; else if (c >= '3' && c <= '7') c -= ('3' - '\033'); diff --git a/src/xkb/XKBCtrls.c b/src/xkb/XKBCtrls.c index 2e08e50..de5ce36 100644 --- a/src/xkb/XKBCtrls.c +++ b/src/xkb/XKBCtrls.c @@ -24,6 +24,7 @@ OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ +/* $XFree86: xc/lib/X11/XKBCtrls.c,v 1.4 2002/12/10 04:33:48 dawes Exp $ */ #include <stdio.h> #define NEED_REPLIES @@ -303,6 +304,14 @@ XkbGetControls(dpy, which, xkb) } if (which&XkbAccessXKeysMask) ctrls->ax_options= rep.axOptions; + if (which&XkbStickyKeysMask) { + ctrls->ax_options &= ~XkbAX_SKOptionsMask; + ctrls->ax_options |= rep.axOptions & XkbAX_SKOptionsMask; + } + if (which&XkbAccessXFeedbackMask) { + ctrls->ax_options &= ~XkbAX_FBOptionsMask; + ctrls->ax_options |= rep.axOptions & XkbAX_FBOptionsMask; + } if (which&XkbAccessXTimeoutMask) { ctrls->ax_timeout = rep.axTimeout; ctrls->axt_ctrls_mask = rep.axtCtrlsMask; @@ -393,7 +402,7 @@ XkbSetControls(dpy, which, xkb) } UnlockDisplay(dpy); SyncHandle(); - return False; + return True; } /***====================================================================***/ diff --git a/src/xkb/XKBCvt.c b/src/xkb/XKBCvt.c index bd965d2..c1a64dc 100644 --- a/src/xkb/XKBCvt.c +++ b/src/xkb/XKBCvt.c @@ -26,6 +26,7 @@ other dealings in this Software without prior written authorization from The Open Group. */ +/* $XFree86: xc/lib/X11/XKBCvt.c,v 3.34 2002/10/08 23:31:35 dawes Exp $ */ #include <stdio.h> #include <sys/types.h> @@ -37,6 +38,7 @@ from The Open Group. #include "Xlibint.h" #include "Xlcint.h" #include "XlcPubI.h" +#include "Ximint.h" #include <X11/Xutil.h> #include <X11/Xmd.h> #define XK_LATIN1 @@ -52,67 +54,6 @@ from The Open Group. #define XKB_EXTEND_LOOKUP_STRING #endif -#ifdef X_NOT_STDC_ENV -extern char *getenv(); -#endif - -#ifdef __STDC__ -#define Const const -#else -#define Const /**/ -#endif -#if defined(__STDC__) && !defined(NORCONST) -#define RConst const -#else -#define RConst /**/ -#endif - -/* bit (1<<i) means character is in codeset i at the same codepoint */ -extern unsigned int _Xlatin1[]; - -/* bit (1<<i) means character is in codeset i at the same codepoint */ -extern unsigned int _Xlatin2[]; - -/* maps Cyrillic keysyms to KOI8-R */ -extern unsigned char _Xkoi8[]; - -extern unsigned short _Xkoi8_size; - -#define sLatin1 0 -#define sLatin2 1 -#define sLatin3 2 -#define sLatin4 3 -#define sKana 4 -#define sX0201 0x01000004 -#define sArabic 5 -#define sCyrillic 6 -#define sGreek 7 -#define sAPL 11 -#define sHebrew 12 -#define sThai 13 -#define sKorean 14 -#define sLatin5 15 -#define sLatin6 16 -#define sLatin7 17 -#define sLatin8 18 -#define sLatin9 19 -#define sCurrency 32 - - -static unsigned long WantLatin1 = sLatin1; -static unsigned long WantLatin2 = sLatin2; -static unsigned long WantLatin3 = sLatin3; -static unsigned long WantLatin4 = sLatin4; -static unsigned long WantLatin5 = sLatin5; -static unsigned long WantLatin6 = sLatin6; -static unsigned long WantKana = sKana; -static unsigned long WantX0201 = sX0201; -static unsigned long WantArabic = sArabic; -static unsigned long WantCyrillic = sCyrillic; -static unsigned long WantGreek = sGreek; -static unsigned long WantAPL = sAPL; -static unsigned long WantHebrew = sHebrew; - static int #if NeedFunctionPrototypes _XkbHandleSpecialSym(KeySym keysym, char *buffer, int nbytes, int *extra_rtrn) @@ -149,15 +90,8 @@ _XkbHandleSpecialSym(keysym, buffer, nbytes, extra_rtrn) return 1; } -extern int -_XGetCharCode ( -#if NeedFunctionPrototypes - unsigned long, KeySym, char*, int -#endif -); - /*ARGSUSED*/ -int +static int #if NeedFunctionPrototypes _XkbKSToKnownSet ( XPointer priv, KeySym keysym, @@ -173,16 +107,11 @@ _XkbKSToKnownSet (priv, keysym, buffer, nbytes, extra_rtrn) int *extra_rtrn; #endif { - unsigned long kset,keysymSet; - int count,isLatin1; char tbuf[8],*buf; if (extra_rtrn) *extra_rtrn= 0; - keysymSet = *((unsigned long *)priv); - kset = keysymSet&0xffffff; - /* convert "dead" diacriticals for dumb applications */ if ( (keysym&0xffffff00)== 0xfe00 ) { switch ( keysym ) { @@ -207,16 +136,13 @@ _XkbKSToKnownSet (priv, keysym, buffer, nbytes, extra_rtrn) } } - isLatin1 = ((keysym&0xffffff00)==0); - count = 0; - if (nbytes<1) buf= tbuf; else buf= buffer; if ((keysym&0xffffff00)==0xff00) { return _XkbHandleSpecialSym(keysym, buf, nbytes, extra_rtrn); } - return _XGetCharCode (keysymSet, keysym, buf, nbytes); + return _XimGetCharCode (priv, keysym, (unsigned char *)buf, nbytes); } typedef struct _XkbToKS { @@ -251,62 +177,6 @@ _XkbKnownSetToKS(priv,buffer,nbytes,status) return NoSymbol; } -/*ARGSUSED*/ -int -#if NeedFunctionPrototypes -_XkbKSToThai ( XPointer priv, - KeySym keysym, - char * buffer, - int nbytes, - int * extra_rtrn) -#else -_XkbKSToThai (priv, keysym, buffer, nbytes, extra_rtrn) - XPointer priv; - KeySym keysym; - char *buffer; - int nbytes; - int *extra_rtrn; -#endif -{ - - if ((keysym&0xffffff00)==0xff00) { - return _XkbHandleSpecialSym(keysym, buffer, nbytes, extra_rtrn); - } - else if (((keysym&0xffffff80)==0xd80)||((keysym&0xffffff80)==0)) { - if (nbytes>0) { - buffer[0]= (char)(keysym&0xff); - if (nbytes>1) - buffer[1]= '\0'; - return 1; - } - if (extra_rtrn) - *extra_rtrn= 1; - } - return 0; -} - -/*ARGSUSED*/ -static KeySym -#if NeedFunctionPrototypes -_XkbThaiToKS(XPointer priv,char *buffer,int nbytes,Status *status) -#else -_XkbThaiToKS(priv,buffer,nbytes,status) - XPointer priv; - char *buffer; - int nbytes; - Status *status; -#endif -{ - if (nbytes!=1) - return NoSymbol; - if (((buffer[0]&0x80)==0)&&(buffer[0]>=32)) - return buffer[0]; - else if ((buffer[0]&0x7f)>=32) { - return 0xd00|buffer[0]; - } - return NoSymbol; -} - static KeySym #if NeedFunctionPrototypes __XkbDefaultToUpper(KeySym sym) @@ -321,117 +191,7 @@ __XkbDefaultToUpper(sym) return upper; } -int _XkbKSToKoi8 (priv, keysym, buffer, nbytes, status) - XPointer priv; - KeySym keysym; - char *buffer; - int nbytes; - Status *status; -{ - if ((keysym&0xffffff00)==0xff00) { - return _XkbHandleSpecialSym(keysym, buffer, nbytes, status); - } - else if (((keysym&0xffffff80)==0x680)||((keysym&0xffffff80)==0)) { - if (nbytes>0) { - if ( (keysym&0x80)==0 ) - buffer[0] = keysym&0x7f; - else buffer[0] = _Xkoi8[keysym & 0x7f]; - if (nbytes>1) - buffer[1]= '\0'; - return 1; - } - } - return 0; -} - -static KeySym -_XkbKoi8ToKS(priv,buffer,nbytes,status) - XPointer priv; - char *buffer; - int nbytes; - Status *status; -{ - if (nbytes!=1) - return NoSymbol; - if (((buffer[0]&0x80)==0)&&(buffer[0]>=32)) - return buffer[0]; - else if ((buffer[0]&0x7f)>=32) { - register int i; - for (i=0;i<_Xkoi8_size;i++) { - if (_Xkoi8[i]==buffer[0]) - return 0x680|i; - } - } - return NoSymbol; -} - -/***====================================================================***/ - - -static XkbConverters RConst cvt_ascii = { - _XkbKSToKnownSet,(XPointer)&WantLatin1,_XkbKnownSetToKS,NULL,__XkbDefaultToUpper -}; - -static XkbConverters RConst cvt_latin1 = { - _XkbKSToKnownSet,(XPointer)&WantLatin1,_XkbKnownSetToKS,NULL,NULL -}; - -static XkbConverters RConst cvt_latin2 = { - _XkbKSToKnownSet,(XPointer)&WantLatin2,_XkbKnownSetToKS,NULL,NULL -}; - -static XkbConverters RConst cvt_latin3 = { - _XkbKSToKnownSet,(XPointer)&WantLatin3,_XkbKnownSetToKS,NULL,NULL -}; - -static XkbConverters RConst cvt_latin4 = { - _XkbKSToKnownSet,(XPointer)&WantLatin4,_XkbKnownSetToKS,NULL,NULL -}; - -static XkbConverters RConst cvt_latin5 = { - _XkbKSToKnownSet,(XPointer)&WantLatin5,_XkbKnownSetToKS,NULL,NULL -}; - -static XkbConverters RConst cvt_latin6 = { - _XkbKSToKnownSet,(XPointer)&WantLatin6,_XkbKnownSetToKS,NULL,NULL -}; - -static XkbConverters RConst cvt_kana = { - _XkbKSToKnownSet,(XPointer)&WantKana,_XkbKnownSetToKS,NULL,NULL -}; - -static XkbConverters RConst cvt_X0201 = { - _XkbKSToKnownSet,(XPointer)&WantX0201,_XkbKnownSetToKS,NULL,NULL -}; - -static XkbConverters RConst cvt_Arabic = { - _XkbKSToKnownSet,(XPointer)&WantArabic,_XkbKnownSetToKS,NULL,NULL -}; - -static XkbConverters RConst cvt_Cyrillic = { - _XkbKSToKnownSet,(XPointer)&WantCyrillic,_XkbKnownSetToKS,NULL,NULL -}; - -static XkbConverters RConst cvt_Greek = { - _XkbKSToKnownSet,(XPointer)&WantGreek,_XkbKnownSetToKS,NULL,NULL -}; - -static XkbConverters RConst cvt_APL = { - _XkbKSToKnownSet,(XPointer)&WantAPL,_XkbKnownSetToKS,NULL,NULL -}; - -static XkbConverters RConst cvt_Hebrew = { - _XkbKSToKnownSet,(XPointer)&WantHebrew,_XkbKnownSetToKS,NULL,NULL -}; - -static XkbConverters cvt_Thai = { - _XkbKSToThai, NULL, _XkbThaiToKS, NULL, NULL -}; - -static XkbConverters cvt_Koi8 = { - _XkbKSToKoi8, NULL, _XkbKoi8ToKS, NULL, NULL -}; - +#ifdef XKB_EXTEND_LOOKUP_STRING static int #if NeedFunctionPrototypes Strcmp(char *str1, char *str2) @@ -443,7 +203,11 @@ Strcmp(str1, str2) char str[256]; char c, *s; - if (strlen (str1) >= sizeof str) /* almost certain it's a mismatch */ + /* + * unchecked strings from the environment can end up here, so check + * the length before copying. + */ + if (strlen(str1) >= sizeof(str)) /* almost certain it's a mismatch */ return 1; for (s = str; (c = *str1++); ) { @@ -454,6 +218,7 @@ Strcmp(str1, str2) *s = '\0'; return (strcmp(str, str2)); } +#endif int #if NeedFunctionPrototypes @@ -464,55 +229,13 @@ _XkbGetConverters(encoding_name, cvt_rtrn) XkbConverters *cvt_rtrn; #endif { - if ( cvt_rtrn ) { - if ( (encoding_name==NULL) || - (Strcmp(encoding_name,"ascii")==0) || - (Strcmp(encoding_name,"string")==0) ) - *cvt_rtrn = cvt_ascii; - else if (Strcmp(encoding_name,"iso8859-1")==0) - *cvt_rtrn = cvt_latin1; - else if (Strcmp(encoding_name, "iso8859-2")==0) - *cvt_rtrn = cvt_latin2; - else if (Strcmp(encoding_name, "iso8859-3")==0) - *cvt_rtrn = cvt_latin3; - else if (Strcmp(encoding_name, "iso8859-4")==0) - *cvt_rtrn = cvt_latin4; - else if (Strcmp(encoding_name, "iso8859-5")==0) - *cvt_rtrn = cvt_Cyrillic; - else if (Strcmp(encoding_name, "iso8859-6")==0) - *cvt_rtrn = cvt_Arabic; - else if (Strcmp(encoding_name, "iso8859-7")==0) - *cvt_rtrn = cvt_Greek; - else if (Strcmp(encoding_name, "iso8859-8")==0) - *cvt_rtrn = cvt_Hebrew; - else if (Strcmp(encoding_name, "iso8859-9")==0) - *cvt_rtrn = cvt_latin5; - else if (Strcmp(encoding_name, "iso8859-10")==0) - *cvt_rtrn = cvt_latin6; - else if (Strcmp(encoding_name, "apl")==0) - *cvt_rtrn = cvt_APL; -#if 0 - else if (Strcmp(encoding_name, "ja.euc")==0) - *cvt_rtrn = ???; - else if (Strcmp(encoding_name, "ja.jis")==0) - *cvt_rtrn = ???; - else if (Strcmp(encoding_name, "ja.sjis")==0) - *cvt_rtrn = ???; -#endif - else if (Strcmp(encoding_name, "jisx0201")==0) /* ??? */ - *cvt_rtrn = cvt_X0201; - else if (Strcmp(encoding_name, "kana")==0) /* ??? */ - *cvt_rtrn = cvt_kana; - else if ((Strcmp(encoding_name, "tactis")==0) || - (Strcmp(encoding_name, "tis620.2533-1")==0)) - *cvt_rtrn = cvt_Thai; - else if (Strcmp(encoding_name, "koi8-r")==0) - *cvt_rtrn = cvt_Koi8; - /* other codesets go here */ - else *cvt_rtrn = cvt_latin1; - return 1; - } - *cvt_rtrn= cvt_latin1; + if ( !cvt_rtrn ) return 0; + + cvt_rtrn->KSToMB = _XkbKSToKnownSet; + cvt_rtrn->KSToMBPriv = _XimGetLocaleCode(encoding_name); + cvt_rtrn->MBToKS = _XkbKnownSetToKS; + cvt_rtrn->MBToKSPriv = NULL; + cvt_rtrn->KSToUpper = __XkbDefaultToUpper; return 1; } @@ -532,7 +255,7 @@ _XkbGetConverters(encoding_name, cvt_rtrn) */ #define CHARSET_FILE "/usr/lib/X11/input/charsets" -static char *_XkbKnownLanguages = "c=ascii:da,de,en,es,fi,fr,is,it,nl,no,pt,sv=iso8859-1:hu,pl,cs=iso8859-2:bg,ru=iso8859-5:ar,ara=iso8859-6:el=iso8859-7:th,th_TH,th_TH.TACTIS=tactis"; +static char *_XkbKnownLanguages = "c=ascii:da,de,en,es,fr,is,it,nl,no,pt,sv=iso8859-1:hu,pl,cs=iso8859-2:eo=iso8859-3:sp=iso8859-5:ar,ara=iso8859-6:el=iso8859-7:he=iso8859-8:tr=iso8859-9:lt,lv=iso8859-13:et,fi=iso8859-15:ru=koi8-r:uk=koi8-u:th,th_TH,th_TH.iso8859-11=iso8859-11:th_TH.TIS620=tis620:hy=armscii-8:vi=tcvn-5712:ka=georgian-academy:be,bg=microsoft-cp1251"; char * _XkbGetCharset() @@ -555,6 +278,9 @@ _XkbGetCharset() if ( locale == NULL ) return NULL; + if (strlen(locale) >= sizeof(lang)) + return NULL; + for (tmp = lang; *tmp = *locale++; tmp++) { if (isupper(*tmp)) *tmp = tolower(*tmp); @@ -581,8 +307,13 @@ _XkbGetCharset() } else { struct stat sbuf; FILE *file; - if ( (stat(CHARSET_FILE,&sbuf)==0) && (sbuf.st_mode&S_IFREG) && - (file = fopen(CHARSET_FILE,"r")) ) { +#ifndef __UNIXOS2__ + char *cf = CHARSET_FILE; +#else + char *cf = __XOS2RedirRoot(CHARSET_FILE); +#endif + if ( (stat(cf,&sbuf)==0) && (sbuf.st_mode&S_IFREG) && + (file = fopen(cf,"r")) ) { tmp = _XkbAlloc(sbuf.st_size+1); if (tmp!=NULL) { sbuf.st_size = (long)fread(tmp,1,sbuf.st_size,file); diff --git a/src/xkb/XKBExtDev.c b/src/xkb/XKBExtDev.c index c4d9968..b208199 100644 --- a/src/xkb/XKBExtDev.c +++ b/src/xkb/XKBExtDev.c @@ -24,6 +24,7 @@ OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ +/* $XFree86: xc/lib/X11/XKBExtDev.c,v 3.4 2001/10/28 03:32:33 tsi Exp $ */ #include <stdio.h> #define NEED_REPLIES @@ -589,8 +590,10 @@ Bool match; match= ((class==devli->led_class)||(class==XkbAllXIClasses)); if (devli->led_class==KbdFeedbackClass) dflt= stuff->dflt_kbd_fb; else dflt= stuff->dflt_led_fb; - match= match && (id==devli->led_id) || (id==XkbAllXIIds) || - ((id==XkbDfltXIId)&&(linfo==dflt)); + match = (match && (id == devli->led_id)) || + (id == XkbAllXIIds) || + ((id == XkbDfltXIId) && + (linfo == dflt)); if (match) { if (!linfo->used) { *sz_rtrn+= _XkbSizeLedInfo(stuff->wanted,devli); @@ -768,7 +771,7 @@ XkbSetDeviceInfo(dpy,which,devi) #endif { register xkbSetDeviceInfoReq *req; - Status ok; + Status ok = 0; int size,nLeds; XkbInfoPtr xkbi; XkbDeviceChangesRec changes; @@ -830,7 +833,7 @@ XkbChangeDeviceInfo(dpy,devi,changes) #endif { register xkbSetDeviceInfoReq *req; - Status ok; + Status ok = 0; int size,nLeds; XkbInfoPtr xkbi; SetLedStuff lstuff; @@ -906,7 +909,7 @@ XkbSetDeviceButtonActions(dpy,devi,first,nBtns) #endif { register xkbSetDeviceInfoReq *req; - Status ok; + Status ok = 0; int size,nLeds; XkbInfoPtr xkbi; XkbDeviceChangesRec changes; diff --git a/src/xkb/XKBGAlloc.c b/src/xkb/XKBGAlloc.c index c89e119..44a74c6 100644 --- a/src/xkb/XKBGAlloc.c +++ b/src/xkb/XKBGAlloc.c @@ -24,6 +24,7 @@ OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ +/* $XFree86: xc/lib/X11/XKBGAlloc.c,v 3.4 2001/01/17 19:41:48 dawes Exp $ */ #define NEED_EVENTS #define NEED_REPLIES diff --git a/src/xkb/XKBGeom.c b/src/xkb/XKBGeom.c index 5cdd6b9..9afc0c0 100644 --- a/src/xkb/XKBGeom.c +++ b/src/xkb/XKBGeom.c @@ -24,6 +24,7 @@ OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ +/* $XFree86: xc/lib/X11/XKBGeom.c,v 1.4 2001/10/28 03:32:33 tsi Exp $ */ #ifdef DEBUG #include <stdio.h> @@ -173,7 +174,7 @@ register int i; XkbShapePtr shape; XkbRowPtr row; XkbDoodadPtr doodad; -XkbBoundsPtr bounds,rbounds; +XkbBoundsPtr bounds,rbounds=NULL; if ((!geom)||(!section)) return False; diff --git a/src/xkb/XKBGetMap.c b/src/xkb/XKBGetMap.c index 8975ba3..e0fe10e 100644 --- a/src/xkb/XKBGetMap.c +++ b/src/xkb/XKBGetMap.c @@ -25,6 +25,8 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ +/* $XFree86: xc/lib/X11/XKBGetMap.c,v 1.7 2003/02/04 03:49:33 dawes Exp $ */ + #define NEED_REPLIES #define NEED_EVENTS #define NEED_MAP_READERS @@ -467,8 +469,10 @@ XkbServerMapPtr srv; } else { srv= xkb->server; - bzero((char *)&srv->vmodmap[rep->firstVModMapKey], - rep->nVModMapKeys*sizeof(unsigned short)); + if (rep->nVModMapKeys > rep->firstVModMapKey) + bzero((char *)&srv->vmodmap[rep->firstVModMapKey], + (rep->nVModMapKeys - rep->firstVModMapKey) * + sizeof(unsigned short)); } srv= xkb->server; i= rep->totalVModMapKeys*SIZEOF(xkbVModMapWireDesc); @@ -970,6 +974,7 @@ XkbGetMapChanges(dpy,xkb,changes) UnlockDisplay(dpy); return status; } + UnlockDisplay(dpy); return Success; } diff --git a/src/xkb/XKBMAlloc.c b/src/xkb/XKBMAlloc.c index ba2a707..29cdc3c 100644 --- a/src/xkb/XKBMAlloc.c +++ b/src/xkb/XKBMAlloc.c @@ -24,6 +24,7 @@ OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ +/* $XFree86: xc/lib/X11/XKBMAlloc.c,v 3.11 2001/01/17 19:41:48 dawes Exp $ */ #ifndef XKB_IN_SERVER diff --git a/src/xkb/XKBMisc.c b/src/xkb/XKBMisc.c index 45c0069..f3de929 100644 --- a/src/xkb/XKBMisc.c +++ b/src/xkb/XKBMisc.c @@ -24,6 +24,7 @@ OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ +/* $XFree86: xc/lib/X11/XKBMisc.c,v 3.5 2001/10/28 03:32:33 tsi Exp $ */ #ifndef XKB_IN_SERVER @@ -54,12 +55,12 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #define mapSize(m) (sizeof(m)/sizeof(XkbKTMapEntryRec)) static XkbKTMapEntryRec map2Level[]= { - { True, ShiftMask, 1, ShiftMask, 0 } + { True, ShiftMask, {1, ShiftMask, 0} } }; static XkbKTMapEntryRec mapAlpha[]= { - { True, ShiftMask, 1, ShiftMask, 0 }, - { True, LockMask, 0, LockMask, 0 } + { True, ShiftMask, { 1, ShiftMask, 0 } }, + { True, LockMask, { 0, LockMask, 0 } } }; static XkbModsRec preAlpha[]= { @@ -69,8 +70,8 @@ static XkbModsRec preAlpha[]= { #define NL_VMOD_MASK 0 static XkbKTMapEntryRec mapKeypad[]= { - { True, ShiftMask, 1, ShiftMask, 0 }, - { False, 0, 1, 0, NL_VMOD_MASK } + { True, ShiftMask, { 1, ShiftMask, 0 } }, + { False, 0, { 1, 0, NL_VMOD_MASK } } }; static XkbKeyTypeRec canonicalTypes[XkbNumRequiredTypes] = { @@ -564,7 +565,7 @@ unsigned changed,tmp; if (((explicit&XkbExplicitAutoRepeatMask)==0)&&(xkb->ctrls)) { CARD8 old; old= xkb->ctrls->per_key_repeat[key/8]; -#if RETURN_SHOULD_REPEAT +#ifdef RETURN_SHOULD_REPEAT if (*XkbKeySymsPtr(xkb,key) != XK_Return) #endif xkb->ctrls->per_key_repeat[key/8]|= (1<<(key%8)); @@ -968,7 +969,7 @@ XkbApplyVirtualModChanges(xkb,changed,changes) #endif { register int i; -unsigned checkState; +unsigned int checkState = 0; if ((!xkb) || (!xkb->map) || (changed==0)) return False; @@ -1035,8 +1036,7 @@ unsigned checkState; } } if (xkb->map && xkb->server) { - int highChange,lowChange; - lowChange= -1; + int highChange = 0, lowChange = -1; for (i=xkb->min_key_code;i<=xkb->max_key_code;i++) { if (XkbKeyHasActions(xkb,i)) { register XkbAction *pAct; diff --git a/src/xkb/XKBNames.c b/src/xkb/XKBNames.c index 22439d2..a072bf8 100644 --- a/src/xkb/XKBNames.c +++ b/src/xkb/XKBNames.c @@ -24,6 +24,7 @@ OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ +/* $XFree86: xc/lib/X11/XKBNames.c,v 1.4 2001/10/28 03:32:33 tsi Exp $ */ #define NEED_REPLIES #define NEED_EVENTS @@ -369,12 +370,12 @@ XkbSetNames(dpy,which,firstType,nTypes,xkb) #endif { register xkbSetNamesReq *req; - int nLvlNames; + int nLvlNames = 0; XkbInfoPtr xkbi; XkbNamesPtr names; unsigned firstLvlType,nLvlTypes; int nVMods,nLEDs,nRG,nKA,nGroups; - int nKeys,firstKey,nAtoms; + int nKeys=0,firstKey=0,nAtoms; CARD32 leds,vmods,groups; if ((dpy->flags & XlibDisplayNoXkb) || @@ -598,14 +599,14 @@ XkbChangeNames(dpy,xkb,changes) #endif { register xkbSetNamesReq *req; - int nLvlNames; + int nLvlNames = 0; XkbInfoPtr xkbi; XkbNamesPtr names; unsigned which,firstType,nTypes; unsigned firstLvlType,nLvlTypes; int nVMods,nLEDs,nRG,nKA,nGroups; - int nKeys,firstKey,nAtoms; - CARD32 leds,vmods,groups; + int nKeys=0,firstKey=0,nAtoms; + CARD32 leds=0,vmods=0,groups=0; if ((dpy->flags & XlibDisplayNoXkb) || (!dpy->xkb_info && !XkbUseExtension(dpy,NULL,NULL))) diff --git a/src/xkb/XKBRdBuf.c b/src/xkb/XKBRdBuf.c index 11a9ba7..5e962b1 100644 --- a/src/xkb/XKBRdBuf.c +++ b/src/xkb/XKBRdBuf.c @@ -24,6 +24,7 @@ OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ +/* $XFree86: xc/lib/X11/XKBRdBuf.c,v 1.2 2001/10/28 03:32:33 tsi Exp $ */ #include <stdio.h> #define NEED_REPLIES @@ -301,7 +302,7 @@ _XkbGetReadBufferCountedString(buf,rtrn) { CARD16 len,*pLen; int left; -char * str; +char * str = NULL; if ((buf==NULL)||(buf->error)||((left=(int)_XkbReadBufferDataLeft(buf))<4)) return False; diff --git a/src/xkb/XKBSetMap.c b/src/xkb/XKBSetMap.c index f7b99bd..331ad40 100644 --- a/src/xkb/XKBSetMap.c +++ b/src/xkb/XKBSetMap.c @@ -24,6 +24,7 @@ OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ +/* $XFree86: xc/lib/X11/XKBSetMap.c,v 3.2 2001/01/17 19:41:49 dawes Exp $ */ #include <stdio.h> #define NEED_REPLIES diff --git a/src/xkb/XKBUse.c b/src/xkb/XKBUse.c index 1b564cc..9e7966b 100644 --- a/src/xkb/XKBUse.c +++ b/src/xkb/XKBUse.c @@ -24,6 +24,7 @@ OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ +/* $XFree86: xc/lib/X11/XKBUse.c,v 3.6 2001/08/13 17:46:02 dawes Exp $ */ #include <stdio.h> #include <ctype.h> @@ -33,10 +34,6 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include <X11/extensions/XKBproto.h> #include "XKBlibint.h" -#ifdef X_NOT_STDC_ENV -extern char *getenv(); -#endif - static Bool _XkbIgnoreExtension = False; void @@ -672,7 +669,7 @@ XkbUseExtension(dpy,major_rtrn,minor_rtrn) static int debugMsg; static int been_here= 0; - if ( dpy->xkb_info ) { + if ( dpy->xkb_info && (!dpy->flags&XlibDisplayNoXkb)) { if (major_rtrn) *major_rtrn= dpy->xkb_info->srv_major; if (minor_rtrn) *minor_rtrn= dpy->xkb_info->srv_minor; return True; @@ -685,8 +682,78 @@ XkbUseExtension(dpy,major_rtrn,minor_rtrn) if (major_rtrn) *major_rtrn= 0; if (minor_rtrn) *minor_rtrn= 0; + if (!dpy->xkb_info) { + xkbi = _XkbTypedCalloc(1, XkbInfoRec); + if ( !xkbi ) + return False; + dpy->xkb_info = xkbi; + dpy->free_funcs->xkb = _XkbFreeInfo; + + xkbi->xlib_ctrls|= (XkbLC_ControlFallback|XkbLC_ConsumeLookupMods); + if ((str=getenv("_XKB_OPTIONS_ENABLE"))!=NULL) { + if ((str=getenv("_XKB_LATIN1_LOOKUP"))!=NULL) { + if ((strcmp(str,"off")==0)||(strcmp(str,"0")==0)) + xkbi->xlib_ctrls&= ~XkbLC_ForceLatin1Lookup; + else xkbi->xlib_ctrls|= XkbLC_ForceLatin1Lookup; + } + if ((str=getenv("_XKB_CONSUME_LOOKUP_MODS"))!=NULL) { + if ((strcmp(str,"off")==0)||(strcmp(str,"0")==0)) + xkbi->xlib_ctrls&= ~XkbLC_ConsumeLookupMods; + else xkbi->xlib_ctrls|= XkbLC_ConsumeLookupMods; + } + if ((str=getenv("_XKB_CONSUME_SHIFT_AND_LOCK"))!=NULL) { + if ((strcmp(str,"off")==0)||(strcmp(str,"0")==0)) + xkbi->xlib_ctrls&= ~XkbLC_AlwaysConsumeShiftAndLock; + else xkbi->xlib_ctrls|= XkbLC_AlwaysConsumeShiftAndLock; + } + if ((str=getenv("_XKB_IGNORE_NEW_KEYBOARDS"))!=NULL) { + if ((strcmp(str,"off")==0)||(strcmp(str,"0")==0)) + xkbi->xlib_ctrls&= ~XkbLC_IgnoreNewKeyboards; + else xkbi->xlib_ctrls|= XkbLC_IgnoreNewKeyboards; + } + if ((str=getenv("_XKB_CONTROL_FALLBACK"))!=NULL) { + if ((strcmp(str,"off")==0)||(strcmp(str,"0")==0)) + xkbi->xlib_ctrls&= ~XkbLC_ControlFallback; + else xkbi->xlib_ctrls|= XkbLC_ControlFallback; + } + if ((str=getenv("_XKB_COMP_LED"))!=NULL) { + if ((strcmp(str,"off")==0)||(strcmp(str,"0")==0)) + xkbi->xlib_ctrls&= ~XkbLC_ComposeLED; + else { + xkbi->xlib_ctrls|= XkbLC_ComposeLED; + if (strlen(str)>0) + xkbi->composeLED= XInternAtom(dpy,str,False); + } + } + if ((str=getenv("_XKB_COMP_FAIL_BEEP"))!=NULL) { + if ((strcmp(str,"off")==0)||(strcmp(str,"0")==0)) + xkbi->xlib_ctrls&= ~XkbLC_BeepOnComposeFail; + else xkbi->xlib_ctrls|= XkbLC_BeepOnComposeFail; + } + } + if ((xkbi->composeLED==None)&&((xkbi->xlib_ctrls&XkbLC_ComposeLED)!=0)) + xkbi->composeLED= XInternAtom(dpy,"Compose",False); +#ifdef DEBUG + if (debugMsg) { + register unsigned c= xkbi->xlib_ctrls; + fprintf(stderr,"XKEYBOARD compose: beep on failure is %s, LED is %s\n", + ((c&XkbLC_BeepOnComposeFail)?"on":"off"), + ((c&XkbLC_ComposeLED)?"on":"off")); + fprintf(stderr,"XKEYBOARD XLookupString: %slatin-1, %s lookup modifiers\n", + ((c&XkbLC_ForceLatin1Lookup)?"allow non-":"force "), + ((c&XkbLC_ConsumeLookupMods)?"consume":"re-use")); + fprintf(stderr, + "XKEYBOARD XLookupString: %sconsume shift and lock, %scontrol fallback\n", + ((c&XkbLC_AlwaysConsumeShiftAndLock)?"always ":"don't "), + ((c&XkbLC_ControlFallback)?"":"no ")); + + } +#endif + } else + xkbi = dpy->xkb_info; + forceIgnore= (dpy->flags&XlibDisplayNoXkb)||dpy->keysyms; - forceIgnore= forceIgnore&(major_rtrn==NULL)&&(minor_rtrn==NULL); + forceIgnore= forceIgnore&&(major_rtrn==NULL)&&(minor_rtrn==NULL); if ( forceIgnore || _XkbIgnoreExtension || getenv("XKB_DISABLE")) { LockDisplay(dpy); dpy->flags |= XlibDisplayNoXkb; @@ -696,15 +763,10 @@ XkbUseExtension(dpy,major_rtrn,minor_rtrn) return False; } - xkbi = _XkbTypedCalloc(1, XkbInfoRec); - if ( !xkbi ) - return False; - if ( (codes=XInitExtension(dpy,XkbName))==NULL ) { LockDisplay(dpy); dpy->flags |= XlibDisplayNoXkb; UnlockDisplay(dpy); - Xfree(xkbi); if (debugMsg) fprintf(stderr,"XKEYBOARD extension not present\n"); return False; @@ -746,8 +808,7 @@ XkbUseExtension(dpy,major_rtrn,minor_rtrn) dpy->flags |= XlibDisplayNoXkb; UnlockDisplay(dpy); SyncHandle(); - Xfree(xkbi); - if (major_rtrn) *major_rtrn= rep.serverMajor; + if (major_rtrn) *major_rtrn= rep.serverMajor; if (minor_rtrn) *minor_rtrn= rep.serverMinor; return False; } @@ -766,70 +827,8 @@ XkbUseExtension(dpy,major_rtrn,minor_rtrn) fprintf(stderr,"XKEYBOARD (version %d.%02d/%d.%02d) OK!\n", XkbMajorVersion,XkbMinorVersion, rep.serverMajor,rep.serverMinor); - dpy->xkb_info = xkbi; - dpy->free_funcs->xkb = _XkbFreeInfo; - ev_base = codes->first_event; - xkbi->xlib_ctrls|= - (XkbLC_BeepOnComposeFail|XkbLC_ComposeLED|XkbLC_ControlFallback); - if ((str=getenv("_XKB_OPTIONS_ENABLE"))!=NULL) { - if ((str=getenv("_XKB_LATIN1_LOOKUP"))!=NULL) { - if ((strcmp(str,"off")==0)||(strcmp(str,"0")==0)) - xkbi->xlib_ctrls&= ~XkbLC_ForceLatin1Lookup; - else xkbi->xlib_ctrls|= XkbLC_ForceLatin1Lookup; - } - if ((str=getenv("_XKB_CONSUME_LOOKUP_MODS"))!=NULL) { - if ((strcmp(str,"off")==0)||(strcmp(str,"0")==0)) - xkbi->xlib_ctrls&= ~XkbLC_ConsumeLookupMods; - else xkbi->xlib_ctrls|= XkbLC_ConsumeLookupMods; - } - if ((str=getenv("_XKB_CONSUME_SHIFT_AND_LOCK"))!=NULL) { - if ((strcmp(str,"off")==0)||(strcmp(str,"0")==0)) - xkbi->xlib_ctrls&= ~XkbLC_AlwaysConsumeShiftAndLock; - else xkbi->xlib_ctrls|= XkbLC_AlwaysConsumeShiftAndLock; - } - if ((str=getenv("_XKB_IGNORE_NEW_KEYBOARDS"))!=NULL) { - if ((strcmp(str,"off")==0)||(strcmp(str,"0")==0)) - xkbi->xlib_ctrls&= ~XkbLC_IgnoreNewKeyboards; - else xkbi->xlib_ctrls|= XkbLC_IgnoreNewKeyboards; - } - if ((str=getenv("_XKB_CONTROL_FALLBACK"))!=NULL) { - if ((strcmp(str,"off")==0)||(strcmp(str,"0")==0)) - xkbi->xlib_ctrls&= ~XkbLC_ControlFallback; - else xkbi->xlib_ctrls|= XkbLC_ControlFallback; - } - if ((str=getenv("_XKB_COMP_LED"))!=NULL) { - if ((strcmp(str,"off")==0)||(strcmp(str,"0")==0)) - xkbi->xlib_ctrls&= ~XkbLC_ComposeLED; - else { - xkbi->xlib_ctrls|= XkbLC_ComposeLED; - if (strlen(str)>0) - xkbi->composeLED= XInternAtom(dpy,str,False); - } - } - if ((str=getenv("_XKB_COMP_FAIL_BEEP"))!=NULL) { - if ((strcmp(str,"off")==0)||(strcmp(str,"0")==0)) - xkbi->xlib_ctrls&= ~XkbLC_BeepOnComposeFail; - else xkbi->xlib_ctrls|= XkbLC_BeepOnComposeFail; - } - } - if ((xkbi->composeLED==None)&&((xkbi->xlib_ctrls&XkbLC_ComposeLED)!=0)) - xkbi->composeLED= XInternAtom(dpy,"Compose",False); -#ifdef DEBUG - if (debugMsg) { - register unsigned c= xkbi->xlib_ctrls; - fprintf(stderr,"XKEYBOARD compose: beep on failure is %s, LED is %s\n", - ((c&XkbLC_BeepOnComposeFail)?"on":"off"), - ((c&XkbLC_ComposeLED)?"on":"off")); - fprintf(stderr,"XKEYBOARD XLookupString: %slatin-1, %s lookup modifiers\n", - ((c&XkbLC_ForceLatin1Lookup)?"allow non-":"force "), - ((c&XkbLC_ConsumeLookupMods)?"consume":"re-use")); - fprintf(stderr, - "XKEYBOARD XLookupString: %sconsume shift and lock, %scontrol fallback\n", - ((c&XkbLC_AlwaysConsumeShiftAndLock)?"always ":"don't "), - ((c&XkbLC_ControlFallback)?"":"no ")); - } -#endif + ev_base = codes->first_event; XESetWireToEvent(dpy,ev_base+XkbEventCode,wire_to_event); SyncHandle(); return True; diff --git a/src/xkb/XKBleds.c b/src/xkb/XKBleds.c index a463615..aa6ba3d 100644 --- a/src/xkb/XKBleds.c +++ b/src/xkb/XKBleds.c @@ -24,6 +24,7 @@ OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ +/* $XFree86: xc/lib/X11/XKBleds.c,v 1.3 2001/02/21 15:18:03 tsi Exp $ */ #define NEED_REPLIES #define NEED_EVENTS @@ -340,8 +341,7 @@ XkbSetNamedDeviceIndicator(dpy,device,class,id,name,changeState, XkbInfoPtr xkbi; if ((dpy->flags & XlibDisplayNoXkb) || (name==None) || - (!dpy->xkb_info && !XkbUseExtension(dpy,NULL,NULL)) || - (pMap==NULL)) + (!dpy->xkb_info && !XkbUseExtension(dpy,NULL,NULL))) return False; LockDisplay(dpy); xkbi = dpy->xkb_info; diff --git a/src/xkb/XKBlibint.h b/src/xkb/XKBlibint.h index 5247cb7..b287cf6 100644 --- a/src/xkb/XKBlibint.h +++ b/src/xkb/XKBlibint.h @@ -24,6 +24,7 @@ OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ +/* $XFree86: xc/lib/X11/XKBlibint.h,v 3.4 2001/01/17 19:41:49 dawes Exp $ */ #ifndef _XKBLIBINT_H_ #define _XKBLIBINT_H_ |