diff options
57 files changed, 1269 insertions, 1378 deletions
diff --git a/Xext/xevie.c b/Xext/xevie.c index e979e7e4d..2fd68f8ce 100644 --- a/Xext/xevie.c +++ b/Xext/xevie.c @@ -52,7 +52,7 @@ of the copyright holder. #include "inputstr.h" #include "windowstr.h" #include "cursorstr.h" -#include <X11/extensions/XKBsrv.h> +#include <xkbsrv.h> #include "../os/osdep.h" diff --git a/dix/devices.c b/dix/devices.c index 8eb54f770..f73841932 100644 --- a/dix/devices.c +++ b/dix/devices.c @@ -67,7 +67,7 @@ SOFTWARE. #define XKB_IN_SERVER #endif #ifdef XKB -#include <X11/extensions/XKBsrv.h> +#include <xkbsrv.h> #endif #include "xace.h" diff --git a/dix/dispatch.c b/dix/dispatch.c index b258aa6f4..32f67886e 100644 --- a/dix/dispatch.c +++ b/dix/dispatch.c @@ -143,7 +143,7 @@ int ProcInitialConnection(); #define XKB_IN_SERVER #endif #include "inputstr.h" -#include <X11/extensions/XKBsrv.h> +#include <xkbsrv.h> #endif #ifdef XSERVER_DTRACE diff --git a/dix/events.c b/dix/events.c index c0b62b826..02598a394 100644 --- a/dix/events.c +++ b/dix/events.c @@ -133,7 +133,7 @@ of the copyright holder. #ifdef XKB #include <X11/extensions/XKBproto.h> -#include <X11/extensions/XKBsrv.h> +#include <xkbsrv.h> extern Bool XkbFilterEvents(ClientPtr, int, xEvent *); #endif diff --git a/dix/getevents.c b/dix/getevents.c index 935112d85..3f636bc80 100644 --- a/dix/getevents.c +++ b/dix/getevents.c @@ -44,7 +44,7 @@ #ifdef XKB #include <X11/extensions/XKBproto.h> -#include <X11/extensions/XKBsrv.h> +#include <xkbsrv.h> extern Bool XkbCopyKeymap(XkbDescPtr src, XkbDescPtr dst, Bool sendNotifies); #endif diff --git a/hw/dmx/dmxclient.h b/hw/dmx/dmxclient.h index 586b82990..657a1275f 100644 --- a/hw/dmx/dmxclient.h +++ b/hw/dmx/dmxclient.h @@ -126,7 +126,7 @@ typedef XID KeySym64; #undef KeySym #endif -/* These are in exglobals.h, but that conflicts with X11/extensions/XKBsrv.h */ +/* These are in exglobals.h, but that conflicts with xkbsrv.h */ extern int ProximityIn; extern int ProximityOut; extern int DeviceValuator; @@ -144,7 +144,7 @@ extern int ChangeDeviceNotify; #ifndef XKB_IN_SERVER #define XKB_IN_SERVER #endif -#include <X11/extensions/XKBsrv.h> +#include <xkbsrv.h> #undef XPointer #endif #include <X11/extensions/XIproto.h> diff --git a/hw/kdrive/src/kinput.c b/hw/kdrive/src/kinput.c index 3bf6bad2b..857f04f6d 100644 --- a/hw/kdrive/src/kinput.c +++ b/hw/kdrive/src/kinput.c @@ -42,7 +42,7 @@ #endif #ifdef XKB -#include <X11/extensions/XKBsrv.h> +#include <xkbsrv.h> #endif #include <X11/extensions/XI.h> diff --git a/hw/xfree86/common/xf86Config.c b/hw/xfree86/common/xf86Config.c index c0e21dd5e..1bd3c62f1 100644 --- a/hw/xfree86/common/xf86Config.c +++ b/hw/xfree86/common/xf86Config.c @@ -75,7 +75,7 @@ extern DeviceAssocRec mouse_assoc; #ifdef XKB #undef XKB_IN_SERVER #define XKB_IN_SERVER -#include <X11/extensions/XKBsrv.h> +#include <xkbsrv.h> #endif #ifdef RENDER diff --git a/hw/xfree86/common/xf86DGA.c b/hw/xfree86/common/xf86DGA.c index 28058b5ea..43db1ee1a 100644 --- a/hw/xfree86/common/xf86DGA.c +++ b/hw/xfree86/common/xf86DGA.c @@ -43,7 +43,7 @@ #include "servermd.h" #include "micmap.h" #ifdef XKB -#include <X11/extensions/XKBsrv.h> +#include <xkbsrv.h> #endif #include "xf86Xinput.h" diff --git a/hw/xfree86/common/xf86XKB.c b/hw/xfree86/common/xf86XKB.c index 399eb02d9..b805885bd 100644 --- a/hw/xfree86/common/xf86XKB.c +++ b/hw/xfree86/common/xf86XKB.c @@ -73,7 +73,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #define XF86_OS_PRIVS #include "xf86_OSlib.h" -#include <X11/extensions/XKBsrv.h> +#include <xkbsrv.h> void xf86InitXkb(void) diff --git a/hw/xfree86/dixmods/xkbKillSrv.c b/hw/xfree86/dixmods/xkbKillSrv.c index 415873ad0..b3399db4a 100644 --- a/hw/xfree86/dixmods/xkbKillSrv.c +++ b/hw/xfree86/dixmods/xkbKillSrv.c @@ -40,7 +40,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include "inputstr.h" #include "scrnintstr.h" #include "windowstr.h" -#include <X11/extensions/XKBsrv.h> +#include <xkbsrv.h> #include <X11/extensions/XI.h> #include "xf86.h" diff --git a/hw/xfree86/dixmods/xkbPrivate.c b/hw/xfree86/dixmods/xkbPrivate.c index e6d4f0fc0..e0cd21739 100644 --- a/hw/xfree86/dixmods/xkbPrivate.c +++ b/hw/xfree86/dixmods/xkbPrivate.c @@ -12,7 +12,7 @@ #include <X11/X.h> #include "windowstr.h" #define XKBSRV_NEED_FILE_FUNCS -#include <X11/extensions/XKBsrv.h> +#include <xkbsrv.h> #include "xf86.h" diff --git a/hw/xfree86/dixmods/xkbVT.c b/hw/xfree86/dixmods/xkbVT.c index a1cdc7016..e6d69e2eb 100644 --- a/hw/xfree86/dixmods/xkbVT.c +++ b/hw/xfree86/dixmods/xkbVT.c @@ -40,7 +40,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include "inputstr.h" #include "scrnintstr.h" #include "windowstr.h" -#include <X11/extensions/XKBsrv.h> +#include <xkbsrv.h> #include <X11/extensions/XI.h> #include "xf86.h" diff --git a/hw/xfree86/loader/dixsym.c b/hw/xfree86/loader/dixsym.c index 594bf4377..5d06b05c7 100644 --- a/hw/xfree86/loader/dixsym.c +++ b/hw/xfree86/loader/dixsym.c @@ -86,7 +86,7 @@ #endif #include "selection.h" #ifdef XKB -#include <X11/extensions/XKBsrv.h> +#include <xkbsrv.h> extern int XkbDfltRepeatDelay, XkbDfltRepeatInterval; #endif diff --git a/hw/xgl/egl/kinput.c b/hw/xgl/egl/kinput.c index b374bf580..5fd23f568 100644 --- a/hw/xgl/egl/kinput.c +++ b/hw/xgl/egl/kinput.c @@ -41,7 +41,7 @@ #ifdef XKB #define XKB_IN_SERVER -#include <X11/extensions/XKBsrv.h> +#include <xkbsrv.h> #endif static DeviceIntPtr pKdKeyboard, pKdPointer; diff --git a/hw/xgl/glx/xglx.c b/hw/xgl/glx/xglx.c index 57cb84702..92974f0d4 100644 --- a/hw/xgl/glx/xglx.c +++ b/hw/xgl/glx/xglx.c @@ -50,7 +50,7 @@ #ifdef XKB #include <X11/extensions/XKB.h> -#include <X11/extensions/XKBsrv.h> +#include <xkbsrv.h> #include <X11/extensions/XKBconfig.h> extern Bool diff --git a/hw/xnest/Keyboard.c b/hw/xnest/Keyboard.c index 0dacae70b..bb3cb1376 100644 --- a/hw/xnest/Keyboard.c +++ b/hw/xnest/Keyboard.c @@ -36,7 +36,7 @@ is" without express or implied warranty. #ifdef XKB #include <X11/extensions/XKB.h> -#include <X11/extensions/XKBsrv.h> +#include <xkbsrv.h> #include <X11/extensions/XKBconfig.h> extern Bool diff --git a/hw/xwin/InitOutput.c b/hw/xwin/InitOutput.c index 39a5eda7f..9457c9cc7 100644 --- a/hw/xwin/InitOutput.c +++ b/hw/xwin/InitOutput.c @@ -44,7 +44,7 @@ from The Open Group. #include <mntent.h> #endif #if defined(XKB) && defined(WIN32) -#include <X11/extensions/XKBsrv.h> +#include <xkbsrv.h> #endif #ifdef RELOCATE_PROJECTROOT #include <shlobj.h> diff --git a/hw/xwin/winconfig.c b/hw/xwin/winconfig.c index e3d18083e..2c1877172 100644 --- a/hw/xwin/winconfig.c +++ b/hw/xwin/winconfig.c @@ -40,7 +40,7 @@ #ifndef XKB_IN_SERVER #define XKB_IN_SERVER #endif -#include <X11/extensions/XKBsrv.h> +#include <xkbsrv.h> #endif #ifdef XWIN_XF86CONFIG diff --git a/hw/xwin/winkeybd.c b/hw/xwin/winkeybd.c index 164e39160..d574f2053 100644 --- a/hw/xwin/winkeybd.c +++ b/hw/xwin/winkeybd.c @@ -44,7 +44,7 @@ #ifndef XKB_IN_SERVER #define XKB_IN_SERVER #endif -#include <X11/extensions/XKBsrv.h> +#include <xkbsrv.h> #endif static Bool g_winKeyState[NUM_KEYCODES]; diff --git a/include/xkbsrv.h b/include/xkbsrv.h new file mode 100644 index 000000000..5edee539b --- /dev/null +++ b/include/xkbsrv.h @@ -0,0 +1,1022 @@ +/************************************************************ +Copyright (c) 1993 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. + +********************************************************/ + +#ifndef _XKBSRV_H_ +#define _XKBSRV_H_ + +#ifdef XKB_IN_SERVER +#define XkbAllocClientMap SrvXkbAllocClientMap +#define XkbAllocServerMap SrvXkbAllocServerMap +#define XkbChangeTypesOfKey SrvXkbChangeTypesOfKey +#define XkbCopyKeyTypes SrvXkbCopyKeyTypes +#define XkbFreeClientMap SrvXkbFreeClientMap +#define XkbFreeServerMap SrvXkbFreeServerMap +#define XkbKeyTypesForCoreSymbols SrvXkbKeyTypesForCoreSymbols +#define XkbApplyCompatMapToKey SrvXkbApplyCompatMapToKey +#define XkbResizeKeyActions SrvXkbResizeKeyActions +#define XkbResizeKeySyms SrvXkbResizeKeySyms +#define XkbResizeKeyType SrvXkbResizeKeyType +#define XkbAllocCompatMap SrvXkbAllocCompatMap +#define XkbAllocControls SrvXkbAllocControls +#define XkbAllocIndicatorMaps SrvXkbAllocIndicatorMaps +#define XkbAllocKeyboard SrvXkbAllocKeyboard +#define XkbAllocNames SrvXkbAllocNames +#define XkbFreeCompatMap SrvXkbFreeCompatMap +#define XkbFreeKeyboard SrvXkbFreeKeyboard +#define XkbFreeNames SrvXkbFreeNames +#define XkbLatchModifiers SrvXkbLatchModifiers +#define XkbLatchGroup SrvXkbLatchGroup +#define XkbVirtualModsToReal SrvXkbVirtualModsToReal +#define XkbChangeKeycodeRange SrvXkbChangeKeycodeRange +#define XkbApplyVirtualModChanges SrvXkbApplyVirtualModChanges +#endif + +#include <X11/extensions/XKBstr.h> +#include <X11/extensions/XKBproto.h> +#include "inputstr.h" + +typedef struct _XkbInterest { + DeviceIntPtr dev; + ClientPtr client; + XID resource; + struct _XkbInterest * next; + CARD16 extDevNotifyMask; + CARD16 stateNotifyMask; + CARD16 namesNotifyMask; + CARD32 ctrlsNotifyMask; + CARD8 compatNotifyMask; + BOOL bellNotifyMask; + BOOL actionMessageMask; + CARD16 accessXNotifyMask; + CARD32 iStateNotifyMask; + CARD32 iMapNotifyMask; + CARD16 altSymsNotifyMask; + CARD32 autoCtrls; + CARD32 autoCtrlValues; +} XkbInterestRec,*XkbInterestPtr; + +typedef struct _XkbRadioGroup { + CARD8 flags; + CARD8 nMembers; + CARD8 dfltDown; + CARD8 currentDown; + CARD8 members[XkbRGMaxMembers]; +} XkbRadioGroupRec, *XkbRadioGroupPtr; + +typedef struct _XkbEventCause { + CARD8 kc; + CARD8 event; + CARD8 mjr; + CARD8 mnr; + ClientPtr client; +} XkbEventCauseRec,*XkbEventCausePtr; +#define XkbSetCauseKey(c,k,e) { (c)->kc= (k),(c)->event= (e),\ + (c)->mjr= (c)->mnr= 0; \ + (c)->client= NULL; } +#define XkbSetCauseReq(c,j,n,cl) { (c)->kc= (c)->event= 0,\ + (c)->mjr= (j),(c)->mnr= (n);\ + (c)->client= (cl); } +#define XkbSetCauseCoreReq(c,e,cl) XkbSetCauseReq(c,e,0,cl) +#define XkbSetCauseXkbReq(c,e,cl) XkbSetCauseReq(c,XkbReqCode,e,cl) +#define XkbSetCauseUnknown(c) XkbSetCauseKey(c,0,0) + +#define _OFF_TIMER 0 +#define _KRG_WARN_TIMER 1 +#define _KRG_TIMER 2 +#define _SK_TIMEOUT_TIMER 3 +#define _ALL_TIMEOUT_TIMER 4 + +#define _BEEP_NONE 0 +#define _BEEP_FEATURE_ON 1 +#define _BEEP_FEATURE_OFF 2 +#define _BEEP_FEATURE_CHANGE 3 +#define _BEEP_SLOW_WARN 4 +#define _BEEP_SLOW_PRESS 5 +#define _BEEP_SLOW_ACCEPT 6 +#define _BEEP_SLOW_REJECT 7 +#define _BEEP_SLOW_RELEASE 8 +#define _BEEP_STICKY_LATCH 9 +#define _BEEP_STICKY_LOCK 10 +#define _BEEP_STICKY_UNLOCK 11 +#define _BEEP_LED_ON 12 +#define _BEEP_LED_OFF 13 +#define _BEEP_LED_CHANGE 14 +#define _BEEP_BOUNCE_REJECT 15 + +typedef struct _XkbSrvInfo { + XkbStateRec prev_state; + XkbStateRec state; + XkbDescPtr desc; + + DeviceIntPtr device; + KbdCtrlProcPtr kbdProc; + + XkbRadioGroupPtr radioGroups; + CARD8 nRadioGroups; + CARD8 clearMods; + CARD8 setMods; + INT16 groupChange; + + CARD16 dfltPtrDelta; + + double mouseKeysCurve; + double mouseKeysCurveFactor; + INT16 mouseKeysDX; + INT16 mouseKeysDY; + CARD8 mouseKeysFlags; + Bool mouseKeysAccel; + CARD8 mouseKeysCounter; + + CARD8 lockedPtrButtons; + CARD8 shiftKeyCount; + KeyCode mouseKey; + KeyCode inactiveKey; + KeyCode slowKey; + KeyCode repeatKey; + CARD8 krgTimerActive; + CARD8 beepType; + CARD8 beepCount; + + CARD32 flags; + CARD32 lastPtrEventTime; + CARD32 lastShiftEventTime; + OsTimerPtr beepTimer; + OsTimerPtr mouseKeyTimer; + OsTimerPtr slowKeysTimer; + OsTimerPtr bounceKeysTimer; + OsTimerPtr repeatKeyTimer; + OsTimerPtr krgTimer; +} XkbSrvInfoRec, *XkbSrvInfoPtr; + +#define XkbSLI_IsDefault (1L<<0) +#define XkbSLI_HasOwnState (1L<<1) + +typedef struct _XkbSrvLedInfo { + CARD16 flags; + CARD16 class; + CARD16 id; + union { + KbdFeedbackPtr kf; + LedFeedbackPtr lf; + } fb; + + CARD32 physIndicators; + CARD32 autoState; + CARD32 explicitState; + CARD32 effectiveState; + + CARD32 mapsPresent; + CARD32 namesPresent; + XkbIndicatorMapPtr maps; + Atom * names; + + CARD32 usesBase; + CARD32 usesLatched; + CARD32 usesLocked; + CARD32 usesEffective; + CARD32 usesCompat; + CARD32 usesControls; + + CARD32 usedComponents; +} XkbSrvLedInfoRec, *XkbSrvLedInfoPtr; + +/* + * Settings for xkbClientFlags field (used by DIX) + * These flags _must_ not overlap with XkbPCF_* + */ +#define _XkbClientInitialized (1<<15) + +#define _XkbWantsDetectableAutoRepeat(c)\ + ((c)->xkbClientFlags&XkbPCF_DetectableAutoRepeatMask) + +/* + * Settings for flags field + */ +#define _XkbStateNotifyInProgress (1<<0) + +typedef struct +{ + ProcessInputProc processInputProc; + ProcessInputProc realInputProc; + DeviceUnwrapProc unwrapProc; +} xkbDeviceInfoRec, *xkbDeviceInfoPtr; + +#define WRAP_PROCESS_INPUT_PROC(device, oldprocs, proc, unwrapproc) \ + device->public.processInputProc = proc; \ + oldprocs->processInputProc = \ + oldprocs->realInputProc = device->public.realInputProc; \ + device->public.realInputProc = proc; \ + oldprocs->unwrapProc = device->unwrapProc; \ + device->unwrapProc = unwrapproc; + +#define COND_WRAP_PROCESS_INPUT_PROC(device, oldprocs, proc, unwrapproc) \ + if (device->public.processInputProc == device->public.realInputProc)\ + device->public.processInputProc = proc; \ + oldprocs->processInputProc = \ + oldprocs->realInputProc = device->public.realInputProc; \ + device->public.realInputProc = proc; \ + oldprocs->unwrapProc = device->unwrapProc; \ + device->unwrapProc = unwrapproc; + +#define UNWRAP_PROCESS_INPUT_PROC(device, oldprocs) \ + device->public.processInputProc = oldprocs->processInputProc; \ + device->public.realInputProc = oldprocs->realInputProc; \ + device->unwrapProc = oldprocs->unwrapProc; + +#define XKBDEVICEINFO(dev) ((xkbDeviceInfoPtr) (dev)->devPrivates[xkbDevicePrivateIndex].ptr) + +/***====================================================================***/ + + +/***====================================================================***/ + +#define XkbAX_KRGMask (XkbSlowKeysMask|XkbBounceKeysMask) +#define XkbAllFilteredEventsMask \ + (XkbAccessXKeysMask|XkbRepeatKeysMask|XkbMouseKeysAccelMask|XkbAX_KRGMask) + +/***====================================================================***/ + +extern int XkbReqCode; +extern int XkbEventBase; +extern int XkbDisableLockActions; +extern char * XkbBaseDirectory; +extern char * XkbBinDirectory; +extern char * XkbInitialMap; +extern unsigned int XkbXIUnsupported; + +extern Bool noXkbExtension; + +extern pointer XkbLastRepeatEvent; + +extern CARD32 xkbDebugFlags; + +#define _XkbAlloc(s) xalloc((s)) +#define _XkbCalloc(n,s) Xcalloc((n)*(s)) +#define _XkbRealloc(o,s) Xrealloc((o),(s)) +#define _XkbTypedAlloc(t) ((t *)xalloc(sizeof(t))) +#define _XkbTypedCalloc(n,t) ((t *)Xcalloc((n)*sizeof(t))) +#define _XkbTypedRealloc(o,n,t) \ + ((o)?(t *)Xrealloc((o),(n)*sizeof(t)):_XkbTypedCalloc(n,t)) +#define _XkbClearElems(a,f,l,t) bzero(&(a)[f],((l)-(f)+1)*sizeof(t)) +#define _XkbFree(p) Xfree(p) + +#define _XkbLibError(c,l,d) \ + { _XkbErrCode= (c); _XkbErrLocation= (l); _XkbErrData= (d); } +#define _XkbErrCode2(a,b) ((XID)((((unsigned int)(a))<<24)|((b)&0xffffff))) +#define _XkbErrCode3(a,b,c) _XkbErrCode2(a,(((unsigned int)(b))<<16)|(c)) +#define _XkbErrCode4(a,b,c,d) _XkbErrCode3(a,b,((((unsigned int)(c))<<8)|(d))) + +extern int DeviceKeyPress,DeviceKeyRelease; +extern int DeviceButtonPress,DeviceButtonRelease; + +#ifdef XINPUT +#define _XkbIsPressEvent(t) (((t)==KeyPress)||((t)==DeviceKeyPress)) +#define _XkbIsReleaseEvent(t) (((t)==KeyRelease)||((t)==DeviceKeyRelease)) +#else +#define _XkbIsPressEvent(t) ((t)==KeyPress) +#define _XkbIsReleaseEvent(t) ((t)==KeyRelease) +#endif + +#define _XkbCoreKeycodeInRange(c,k) (((k)>=(c)->curKeySyms.minKeyCode)&&\ + ((k)<=(c)->curKeySyms.maxKeyCode)) +#define _XkbCoreNumKeys(c) ((c)->curKeySyms.maxKeyCode-\ + (c)->curKeySyms.minKeyCode+1) + +#define XConvertCase(s,l,u) XkbConvertCase(s,l,u) +#undef IsKeypadKey +#define IsKeypadKey(s) XkbKSIsKeypad(s) + +#define Status int +#define XPointer pointer +#define Display struct _XDisplay + +#ifndef True +#define True 1 +#define False 0 +#endif + +#ifndef PATH_MAX +#ifdef MAXPATHLEN +#define PATH_MAX MAXPATHLEN +#else +#define PATH_MAX 1024 +#endif +#endif + +_XFUNCPROTOBEGIN + +extern void XkbUseMsg( + void +); + +extern int XkbProcessArguments( + int /* argc */, + char ** /* argv */, + int /* i */ +); + +extern void XkbSetExtension(DeviceIntPtr device, ProcessInputProc proc); + +extern void XkbFreeCompatMap( + XkbDescPtr /* xkb */, + unsigned int /* which */, + Bool /* freeMap */ +); + +extern void XkbFreeNames( + XkbDescPtr /* xkb */, + unsigned int /* which */, + Bool /* freeMap */ +); + +extern DeviceIntPtr _XkbLookupAnyDevice( + int /* id */, + int * /* why_rtrn */ +); + +extern DeviceIntPtr _XkbLookupKeyboard( + int /* id */, + int * /* why_rtrn */ +); + +extern DeviceIntPtr _XkbLookupBellDevice( + int /* id */, + int * /* why_rtrn */ +); + +extern DeviceIntPtr _XkbLookupLedDevice( + int /* id */, + int * /* why_rtrn */ +); + +extern DeviceIntPtr _XkbLookupButtonDevice( + int /* id */, + int * /* why_rtrn */ +); + +extern XkbDescPtr XkbAllocKeyboard( + void +); + +extern Status XkbAllocClientMap( + XkbDescPtr /* xkb */, + unsigned int /* which */, + unsigned int /* nTypes */ +); + +extern Status XkbAllocServerMap( + XkbDescPtr /* xkb */, + unsigned int /* which */, + unsigned int /* nNewActions */ +); + +extern void XkbFreeClientMap( + XkbDescPtr /* xkb */, + unsigned int /* what */, + Bool /* freeMap */ +); + +extern void XkbFreeServerMap( + XkbDescPtr /* xkb */, + unsigned int /* what */, + Bool /* freeMap */ +); + +extern Status XkbAllocIndicatorMaps( + XkbDescPtr /* xkb */ +); + +extern Status XkbAllocCompatMap( + XkbDescPtr /* xkb */, + unsigned int /* which */, + unsigned int /* nInterpret */ +); + +extern Status XkbAllocNames( + XkbDescPtr /* xkb */, + unsigned int /* which */, + int /* nTotalRG */, + int /* nTotalAliases */ +); + +extern Status XkbAllocControls( + XkbDescPtr /* xkb */, + unsigned int /* which*/ +); + +extern Status XkbCopyKeyTypes( + XkbKeyTypePtr /* from */, + XkbKeyTypePtr /* into */, + int /* num_types */ +); + +extern Status XkbResizeKeyType( + XkbDescPtr /* xkb */, + int /* type_ndx */, + int /* map_count */, + Bool /* want_preserve */, + int /* new_num_lvls */ +); + +extern void XkbFreeKeyboard( + XkbDescPtr /* xkb */, + unsigned int /* which */, + Bool /* freeDesc */ +); + +extern void XkbSetActionKeyMods( + XkbDescPtr /* xkb */, + XkbAction * /* act */, + unsigned int /* mods */ +); + +extern Bool XkbCheckActionVMods( + XkbDescPtr /* xkb */, + XkbAction * /* act */, + unsigned int /* changed */ +); + +extern unsigned int XkbMaskForVMask( + XkbDescPtr /* xkb */, + unsigned int /* vmask */ +); + +extern Bool XkbVirtualModsToReal( + XkbDescPtr /* xkb */, + unsigned int /* virtua_mask */, + unsigned int * /* mask_rtrn */ +); + +extern unsigned int XkbAdjustGroup( + int /* group */, + XkbControlsPtr /* ctrls */ +); + +extern KeySym *XkbResizeKeySyms( + XkbDescPtr /* xkb */, + int /* key */, + int /* needed */ +); + +extern XkbAction *XkbResizeKeyActions( + XkbDescPtr /* xkb */, + int /* key */, + int /* needed */ +); + +extern void XkbUpdateKeyTypesFromCore( + DeviceIntPtr /* pXDev */, + KeyCode /* first */, + CARD8 /* num */, + XkbChangesPtr /* pChanges */ +); + +extern void XkbUpdateDescActions( + XkbDescPtr /* xkb */, + KeyCode /* first */, + CARD8 /* num */, + XkbChangesPtr /* changes */ +); + +extern void XkbUpdateActions( + DeviceIntPtr /* pXDev */, + KeyCode /* first */, + CARD8 /* num */, + XkbChangesPtr /* pChanges */, + unsigned int * /* needChecksRtrn */, + XkbEventCausePtr /* cause */ +); + +extern void XkbUpdateCoreDescription( + DeviceIntPtr /* keybd */, + Bool /* resize */ +); + +extern void XkbApplyMappingChange( + DeviceIntPtr /* pXDev */, + CARD8 /* request */, + KeyCode /* firstKey */, + CARD8 /* num */, + ClientPtr /* client */ +); + +extern void XkbSetIndicators( + DeviceIntPtr /* pXDev */, + CARD32 /* affect */, + CARD32 /* values */, + XkbEventCausePtr /* cause */ +); + +extern void XkbUpdateIndicators( + DeviceIntPtr /* keybd */, + CARD32 /* changed */, + Bool /* check_edevs */, + XkbChangesPtr /* pChanges */, + XkbEventCausePtr /* cause */ +); + +extern XkbSrvLedInfoPtr XkbAllocSrvLedInfo( + DeviceIntPtr /* dev */, + KbdFeedbackPtr /* kf */, + LedFeedbackPtr /* lf */, + unsigned int /* needed_parts */ +); + +extern XkbSrvLedInfoPtr XkbFindSrvLedInfo( + DeviceIntPtr /* dev */, + unsigned int /* class */, + unsigned int /* id */, + unsigned int /* needed_parts */ +); + +extern void XkbApplyLedNameChanges( + DeviceIntPtr /* dev */, + XkbSrvLedInfoPtr /* sli */, + unsigned int /* changed_names */, + xkbExtensionDeviceNotify * /* ed */, + XkbChangesPtr /* changes */, + XkbEventCausePtr /* cause */ +); + +extern void XkbApplyLedMapChanges( + DeviceIntPtr /* dev */, + XkbSrvLedInfoPtr /* sli */, + unsigned int /* changed_maps */, + xkbExtensionDeviceNotify * /* ed */, + XkbChangesPtr /* changes */, + XkbEventCausePtr /* cause */ +); + +extern void XkbApplyLedStateChanges( + DeviceIntPtr /* dev */, + XkbSrvLedInfoPtr /* sli */, + unsigned int /* changed_leds */, + xkbExtensionDeviceNotify * /* ed */, + XkbChangesPtr /* changes */, + XkbEventCausePtr /* cause */ +); + +extern void XkbFlushLedEvents( + DeviceIntPtr /* dev */, + DeviceIntPtr /* kbd */, + XkbSrvLedInfoPtr /* sli */, + xkbExtensionDeviceNotify * /* ed */, + XkbChangesPtr /* changes */, + XkbEventCausePtr /* cause */ +); + +extern unsigned int XkbIndicatorsToUpdate( + DeviceIntPtr /* dev */, + unsigned long /* state_changes */, + Bool /* enabled_ctrl_changes */ +); + +extern void XkbComputeDerivedState( + XkbSrvInfoPtr /* xkbi */ +); + +extern void XkbCheckSecondaryEffects( + XkbSrvInfoPtr /* xkbi */, + unsigned int /* which */, + XkbChangesPtr /* changes */, + XkbEventCausePtr /* cause */ +); + +extern void XkbCheckIndicatorMaps( + DeviceIntPtr /* dev */, + XkbSrvLedInfoPtr /* sli */, + unsigned int /* which */ +); + +extern unsigned int XkbStateChangedFlags( + XkbStatePtr /* old */, + XkbStatePtr /* new */ +); + +extern void XkbSendStateNotify( + DeviceIntPtr /* kbd */, + xkbStateNotify * /* pSN */ +); + +extern void XkbSendMapNotify( + DeviceIntPtr /* kbd */, + xkbMapNotify * /* ev */ +); + +extern int XkbComputeControlsNotify( + DeviceIntPtr /* kbd */, + XkbControlsPtr /* old */, + XkbControlsPtr /* new */, + xkbControlsNotify * /* pCN */, + Bool /* forceCtrlProc */ +); + +extern void XkbSendControlsNotify( + DeviceIntPtr /* kbd */, + xkbControlsNotify * /* ev */ +); + +extern void XkbSendCompatMapNotify( + DeviceIntPtr /* kbd */, + xkbCompatMapNotify * /* ev */ +); + +extern void XkbHandleBell( + BOOL /* force */, + BOOL /* eventOnly */, + DeviceIntPtr /* kbd */, + CARD8 /* percent */, + pointer /* ctrl */, + CARD8 /* class */, + Atom /* name */, + WindowPtr /* pWin */, + ClientPtr /* pClient */ +); + +extern void XkbSendAccessXNotify( + DeviceIntPtr /* kbd */, + xkbAccessXNotify * /* pEv */ +); + +extern void XkbSendNamesNotify( + DeviceIntPtr /* kbd */, + xkbNamesNotify * /* ev */ +); + +extern void XkbSendCompatNotify( + DeviceIntPtr /* kbd */, + xkbCompatMapNotify * /* ev */ +); + +extern void XkbSendActionMessage( + DeviceIntPtr /* kbd */, + xkbActionMessage * /* ev */ +); + +extern void XkbSendExtensionDeviceNotify( + DeviceIntPtr /* kbd */, + ClientPtr /* client */, + xkbExtensionDeviceNotify * /* ev */ +); + +extern void XkbSendNotification( + DeviceIntPtr /* kbd */, + XkbChangesPtr /* pChanges */, + XkbEventCausePtr /* cause */ +); + +extern void XkbProcessKeyboardEvent( + struct _xEvent * /* xE */, + DeviceIntPtr /* keybd */, + int /* count */ +); + +extern void XkbHandleActions( + DeviceIntPtr /* dev */, + DeviceIntPtr /* kbd */, + struct _xEvent * /* xE */, + int /* count */ +); + +extern Bool XkbEnableDisableControls( + XkbSrvInfoPtr /* xkbi */, + unsigned long /* change */, + unsigned long /* newValues */, + XkbChangesPtr /* changes */, + XkbEventCausePtr /* cause */ +); + +extern void AccessXInit( + DeviceIntPtr /* dev */ +); + +extern Bool AccessXFilterPressEvent( + register struct _xEvent * /* xE */, + register DeviceIntPtr /* keybd */, + int /* count */ +); + +extern Bool AccessXFilterReleaseEvent( + register struct _xEvent * /* xE */, + register DeviceIntPtr /* keybd */, + int /* count */ +); + +extern void AccessXCancelRepeatKey( + XkbSrvInfoPtr /* xkbi */, + KeyCode /* key */ +); + +extern void AccessXComputeCurveFactor( + XkbSrvInfoPtr /* xkbi */, + XkbControlsPtr /* ctrls */ +); + +extern XkbInterestPtr XkbFindClientResource( + DevicePtr /* inDev */, + ClientPtr /* client */ +); + +extern XkbInterestPtr XkbAddClientResource( + DevicePtr /* inDev */, + ClientPtr /* client */, + XID /* id */ +); + +extern int XkbRemoveResourceClient( + DevicePtr /* inDev */, + XID /* id */ +); + +extern int XkbDDXInitDevice( + DeviceIntPtr /* dev */ +); + +extern int XkbDDXAccessXBeep( + DeviceIntPtr /* dev */, + unsigned int /* what */, + unsigned int /* which */ +); + +extern void XkbDDXKeyClick( + DeviceIntPtr /* dev */, + int /* keycode */, + int /* synthetic */ +); + +extern int XkbDDXUsesSoftRepeat( + DeviceIntPtr /* dev */ +); + +extern void XkbDDXKeybdCtrlProc( + DeviceIntPtr /* dev */, + KeybdCtrl * /* ctrl */ +); + +extern void XkbDDXChangeControls( + DeviceIntPtr /* dev */, + XkbControlsPtr /* old */, + XkbControlsPtr /* new */ +); + +extern void XkbDDXUpdateDeviceIndicators( + DeviceIntPtr /* dev */, + XkbSrvLedInfoPtr /* sli */, + CARD32 /* newState */ +); + +extern void XkbDDXFakePointerButton( + int /* event */, + int /* button */ +); + +extern void XkbDDXFakePointerMotion( + unsigned int /* flags */, + int /* x */, + int /* y */ +); + +extern void XkbDDXFakeDeviceButton( + DeviceIntPtr /* dev */, + Bool /* press */, + int /* button */ +); + +extern int XkbDDXTerminateServer( + DeviceIntPtr /* dev */, + KeyCode /* key */, + XkbAction * /* act */ +); + +extern int XkbDDXSwitchScreen( + DeviceIntPtr /* dev */, + KeyCode /* key */, + XkbAction * /* act */ +); + +extern int XkbDDXPrivate( + DeviceIntPtr /* dev */, + KeyCode /* key */, + XkbAction * /* act */ +); + +extern void XkbDisableComputedAutoRepeats( + DeviceIntPtr /* pXDev */, + unsigned int /* key */ +); + +extern void XkbSetRepeatKeys( + DeviceIntPtr /* pXDev */, + int /* key */, + int /* onoff */ +); + +extern int XkbLatchModifiers( + DeviceIntPtr /* pXDev */, + CARD8 /* mask */, + CARD8 /* latches */ +); + +extern int XkbLatchGroup( + DeviceIntPtr /* pXDev */, + int /* group */ +); + +extern void XkbClearAllLatchesAndLocks( + DeviceIntPtr /* dev */, + XkbSrvInfoPtr /* xkbi */, + Bool /* genEv */, + XkbEventCausePtr /* cause */ +); + +extern void XkbSetRulesDflts( + char * /* rulesFile */, + char * /* model */, + char * /* layout */, + char * /* variant */, + char * /* options */ +); + +extern void XkbInitDevice( + DeviceIntPtr /* pXDev */ +); + +extern Bool XkbInitKeyboardDeviceStruct( + DeviceIntPtr /* pXDev */, + XkbComponentNamesPtr /* pNames */, + KeySymsPtr /* pSyms */, + CARD8 /* pMods */[], + BellProcPtr /* bellProc */, + KbdCtrlProcPtr /* ctrlProc */ +); + +extern int SProcXkbDispatch( + ClientPtr /* client */ +); + +extern XkbGeometryPtr XkbLookupNamedGeometry( + DeviceIntPtr /* dev */, + Atom /* name */, + Bool * /* shouldFree */ +); + +extern char * _XkbDupString( + char * /* str */ +); + +extern void XkbConvertCase( + KeySym /* sym */, + KeySym * /* lower */, + KeySym * /* upper */ +); + +extern Status XkbChangeKeycodeRange( + XkbDescPtr /* xkb */, + int /* minKC */, + int /* maxKC */, + XkbChangesPtr /* changes */ +); + +extern int XkbFinishDeviceInit( + DeviceIntPtr /* pXDev */ +); + +extern void XkbFreeSrvLedInfo( + XkbSrvLedInfoPtr /* sli */ +); + +extern void XkbFreeInfo( + XkbSrvInfoPtr /* xkbi */ +); + +extern Status XkbChangeTypesOfKey( + XkbDescPtr /* xkb */, + int /* key */, + int /* nGroups */, + unsigned int /* groups */, + int * /* newTypesIn */, + XkbMapChangesPtr /* changes */ +); + +extern int XkbKeyTypesForCoreSymbols( + XkbDescPtr /* xkb */, + int /* map_width */, + KeySym * /* core_syms */, + unsigned int /* protected */, + int * /* types_inout */, + KeySym * /* xkb_syms_rtrn */ +); + +extern Bool XkbApplyCompatMapToKey( + XkbDescPtr /* xkb */, + KeyCode /* key */, + XkbChangesPtr /* changes */ +); + +extern Bool XkbApplyVirtualModChanges( + XkbDescPtr /* xkb */, + unsigned int /* changed */, + XkbChangesPtr /* changes */ +); + +extern void XkbSendNewKeyboardNotify( + DeviceIntPtr /* kbd */, + xkbNewKeyboardNotify * /* pNKN */ +); + +#ifdef XKBSRV_NEED_FILE_FUNCS + +#include <X11/extensions/XKMformat.h> +#include <X11/extensions/XKBfile.h> +#include <X11/extensions/XKBrules.h> + +#define _XkbListKeymaps 0 +#define _XkbListKeycodes 1 +#define _XkbListTypes 2 +#define _XkbListCompat 3 +#define _XkbListSymbols 4 +#define _XkbListGeometry 5 +#define _XkbListNumComponents 6 + +typedef struct _XkbSrvListInfo { + int szPool; + int nPool; + char * pool; + + int maxRtrn; + int nTotal; + + char * pattern[_XkbListNumComponents]; + int nFound[_XkbListNumComponents]; +} XkbSrvListInfoRec,*XkbSrvListInfoPtr; + +extern Status XkbDDXList( + DeviceIntPtr /* dev */, + XkbSrvListInfoPtr /* listing */, + ClientPtr /* client */ +); + +extern unsigned int XkbDDXLoadKeymapByNames( + DeviceIntPtr /* keybd */, + XkbComponentNamesPtr /* names */, + unsigned int /* want */, + unsigned int /* need */, + XkbFileInfoPtr /* finfoRtrn */, + char * /* keymapNameRtrn */, + int /* keymapNameRtrnLen */ +); + +extern Bool XkbDDXNamesFromRules( + DeviceIntPtr /* keybd */, + char * /* rules */, + XkbRF_VarDefsPtr /* defs */, + XkbComponentNamesPtr /* names */ +); + +extern Bool XkbDDXApplyConfig( + XPointer /* cfg_in */, + XkbSrvInfoPtr /* xkbi */ +); + +extern XPointer XkbDDXPreloadConfig( + char ** /* rulesFileRtrn */, + XkbRF_VarDefsPtr /* defs */, + XkbComponentNamesPtr /* names */, + DeviceIntPtr /* dev */ +); + +extern int _XkbStrCaseCmp( + char * /* str1 */, + char * /* str2 */ +); + +#endif /* XKBSRV_NEED_FILE_FUNCS */ + +_XFUNCPROTOEND + +#define XkbAtomGetString(d,s) NameForAtom(s) + +#endif /* _XKBSRV_H_ */ diff --git a/os/utils.c b/os/utils.c index 612c2644a..06c9b8807 100644 --- a/os/utils.c +++ b/os/utils.c @@ -117,7 +117,7 @@ OR PERFORMANCE OF THIS SOFTWARE. #endif #ifdef XKB -#include <X11/extensions/XKBsrv.h> +#include <xkbsrv.h> #endif #ifdef XCSECURITY #include "securitysrv.h" diff --git a/xkb/Makefile.am b/xkb/Makefile.am index 996d52761..78cdf7196 100644 --- a/xkb/Makefile.am +++ b/xkb/Makefile.am @@ -41,7 +41,8 @@ X11_SRCS = \ XKBGAlloc.c \ XKBMAlloc.c -XI_SRCS = xkbPrOtherEv.c +# ends up unused... +# XI_SRCS = xkbPrOtherEv.c libxkb_la_SOURCES = $(DDX_SRCS) $(DIX_SRCS) $(XI_SRCS) $(XKBFILE_SRCS) \ $(X11_SRCS) diff --git a/xkb/XKBAlloc.c b/xkb/XKBAlloc.c index c474733d0..f0a1f890e 100644 --- a/xkb/XKBAlloc.c +++ b/xkb/XKBAlloc.c @@ -35,7 +35,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include <X11/Xproto.h> #include "misc.h" #include "inputstr.h" -#include <X11/extensions/XKBsrv.h> +#include <xkbsrv.h> #include <X11/extensions/XKBgeom.h> /***===================================================================***/ @@ -259,7 +259,7 @@ XkbAllocControls(XkbDescPtr xkb,unsigned which) } /*ARGSUSED*/ -void +static void XkbFreeControls(XkbDescPtr xkb,unsigned which,Bool freeMap) { if (freeMap && (xkb!=NULL) && (xkb->ctrls!=NULL)) { @@ -284,7 +284,7 @@ XkbAllocIndicatorMaps(XkbDescPtr xkb) return Success; } -void +static void XkbFreeIndicatorMaps(XkbDescPtr xkb) { if ((xkb!=NULL)&&(xkb->indicators!=NULL)) { @@ -335,154 +335,3 @@ XkbFreeKeyboard(XkbDescPtr xkb,unsigned which,Bool freeAll) _XkbFree(xkb); return; } - -/***====================================================================***/ - -XkbDeviceLedInfoPtr -XkbAddDeviceLedInfo(XkbDeviceInfoPtr devi,unsigned ledClass,unsigned ledId) -{ -XkbDeviceLedInfoPtr devli; -register int i; - - if ((!devi)||(!XkbSingleXIClass(ledClass))||(!XkbSingleXIId(ledId))) - return NULL; - for (i=0,devli=devi->leds;i<devi->num_leds;i++,devli++) { - if ((devli->led_class==ledClass)&&(devli->led_id==ledId)) - return devli; - } - if (devi->num_leds>=devi->sz_leds) { - XkbDeviceLedInfoRec *prev_leds = devi->leds; - - if (devi->sz_leds>0) devi->sz_leds*= 2; - else devi->sz_leds= 1; - devi->leds= _XkbTypedRealloc(devi->leds,devi->sz_leds, - XkbDeviceLedInfoRec); - if (!devi->leds) { - _XkbFree(prev_leds); - devi->sz_leds= devi->num_leds= 0; - return NULL; - } - i= devi->num_leds; - for (devli=&devi->leds[i];i<devi->sz_leds;i++,devli++) { - bzero(devli,sizeof(XkbDeviceLedInfoRec)); - devli->led_class= XkbXINone; - devli->led_id= XkbXINone; - } - } - devli= &devi->leds[devi->num_leds++]; - bzero(devli,sizeof(XkbDeviceLedInfoRec)); - devli->led_class= ledClass; - devli->led_id= ledId; - return devli; -} - -Status -XkbResizeDeviceButtonActions(XkbDeviceInfoPtr devi,unsigned newTotal) -{ - XkbAction *prev_btn_acts; - - if ((!devi)||(newTotal>255)) - return BadValue; - if ((devi->btn_acts!=NULL)&&(newTotal==devi->num_btns)) - return Success; - if (newTotal==0) { - if (devi->btn_acts!=NULL) { - _XkbFree(devi->btn_acts); - devi->btn_acts= NULL; - } - devi->num_btns= 0; - return Success; - } - prev_btn_acts = devi->btn_acts; - devi->btn_acts= _XkbTypedRealloc(devi->btn_acts,newTotal,XkbAction); - if (devi->btn_acts==NULL) { - _XkbFree(prev_btn_acts); - devi->num_btns= 0; - return BadAlloc; - } - if (newTotal>devi->num_btns) { - XkbAction *act; - act= &devi->btn_acts[devi->num_btns]; - bzero((char *)act,(newTotal-devi->num_btns)*sizeof(XkbAction)); - } - devi->num_btns= newTotal; - return Success; -} - -/*ARGSUSED*/ -XkbDeviceInfoPtr -XkbAllocDeviceInfo(unsigned deviceSpec,unsigned nButtons,unsigned szLeds) -{ -XkbDeviceInfoPtr devi; - - devi= _XkbTypedCalloc(1,XkbDeviceInfoRec); - if (devi!=NULL) { - devi->device_spec= deviceSpec; - devi->has_own_state= False; - devi->num_btns= 0; - devi->btn_acts= NULL; - if (nButtons>0) { - devi->num_btns= nButtons; - devi->btn_acts= _XkbTypedCalloc(nButtons,XkbAction); - if (!devi->btn_acts) { - _XkbFree(devi); - return NULL; - } - } - devi->dflt_kbd_fb= XkbXINone; - devi->dflt_led_fb= XkbXINone; - devi->num_leds= 0; - devi->sz_leds= 0; - devi->leds= NULL; - if (szLeds>0) { - devi->sz_leds= szLeds; - devi->leds= _XkbTypedCalloc(szLeds,XkbDeviceLedInfoRec); - if (!devi->leds) { - if (devi->btn_acts) - _XkbFree(devi->btn_acts); - _XkbFree(devi); - return NULL; - } - } - } - return devi; -} - - -void -XkbFreeDeviceInfo(XkbDeviceInfoPtr devi,unsigned which,Bool freeDevI) -{ - if (devi) { - if (freeDevI) { - which= XkbXI_AllDeviceFeaturesMask; - if (devi->name) { - _XkbFree(devi->name); - devi->name= NULL; - } - } - if ((which&XkbXI_ButtonActionsMask)&&(devi->btn_acts)) { - _XkbFree(devi->btn_acts); - devi->num_btns= 0; - devi->btn_acts= NULL; - } - if ((which&XkbXI_IndicatorsMask)&&(devi->leds)) { - register int i; - if ((which&XkbXI_IndicatorsMask)==XkbXI_IndicatorsMask) { - _XkbFree(devi->leds); - devi->sz_leds= devi->num_leds= 0; - devi->leds= NULL; - } - else { - XkbDeviceLedInfoPtr devli; - for (i=0,devli=devi->leds;i<devi->num_leds;i++,devli++) { - if (which&XkbXI_IndicatorMapsMask) - bzero((char *)&devli->maps[0],sizeof(devli->maps)); - else bzero((char *)&devli->names[0],sizeof(devli->names)); - } - } - } - if (freeDevI) - _XkbFree(devi); - } - return; -} diff --git a/xkb/XKBGAlloc.c b/xkb/XKBGAlloc.c index edaed10f3..815cc95f5 100644 --- a/xkb/XKBGAlloc.c +++ b/xkb/XKBGAlloc.c @@ -36,7 +36,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include <X11/Xproto.h> #include "misc.h" #include "inputstr.h" -#include <X11/extensions/XKBsrv.h> +#include <xkbsrv.h> #include <X11/extensions/XKBgeom.h> #ifdef X_NOT_POSIX diff --git a/xkb/XKBMAlloc.c b/xkb/XKBMAlloc.c index ef4097dad..4b7428b2e 100644 --- a/xkb/XKBMAlloc.c +++ b/xkb/XKBMAlloc.c @@ -39,7 +39,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include "inputstr.h" #include <X11/keysym.h> #define XKBSRV_NEED_FILE_FUNCS -#include <X11/extensions/XKBsrv.h> +#include <xkbsrv.h> /***====================================================================***/ @@ -220,7 +220,7 @@ XkbServerMapPtr map; /***====================================================================***/ -Status +static Status XkbCopyKeyType(XkbKeyTypePtr from,XkbKeyTypePtr into) { if ((!from)||(!into)) @@ -275,82 +275,6 @@ register int i,rtrn; return Success; } -XkbKeyTypePtr -XkbAddKeyType( XkbDescPtr xkb, - Atom name, - int map_count, - Bool want_preserve, - int num_lvls) -{ -register int i; -unsigned tmp; -XkbKeyTypePtr type; -XkbClientMapPtr map; - - if ((!xkb)||(num_lvls<1)) - return NULL; - map= xkb->map; - if ((map)&&(map->types)) { - for (i=0;i<map->num_types;i++) { - if (map->types[i].name==name) { - Status status; - status=XkbResizeKeyType(xkb,i,map_count,want_preserve,num_lvls); - return (status==Success?&map->types[i]:NULL); - } - } - } - if ((!map)||(!map->types)||(!map->num_types<XkbNumRequiredTypes)) { - tmp= XkbNumRequiredTypes+1; - if (XkbAllocClientMap(xkb,XkbKeyTypesMask,tmp)!=Success) - return NULL; - map = xkb->map; - tmp= 0; - if (map->num_types<=XkbKeypadIndex) - tmp|= XkbKeypadMask; - if (map->num_types<=XkbAlphabeticIndex) - tmp|= XkbAlphabeticMask; - if (map->num_types<=XkbTwoLevelIndex) - tmp|= XkbTwoLevelMask; - if (map->num_types<=XkbOneLevelIndex) - tmp|= XkbOneLevelMask; - if (XkbInitCanonicalKeyTypes(xkb,tmp,XkbNoModifier)==Success) { - for (i=0;i<map->num_types;i++) { - Status status; - if (map->types[i].name!=name) - continue; - status=XkbResizeKeyType(xkb,i,map_count,want_preserve,num_lvls); - return (status==Success?&map->types[i]:NULL); - } - } - } - if ((map->num_types<=map->size_types)&& - (XkbAllocClientMap(xkb,XkbKeyTypesMask,map->num_types+1)!=Success)) { - return NULL; - } - type= &map->types[map->num_types]; - map->num_types++; - bzero((char *)type,sizeof(XkbKeyTypeRec)); - type->num_levels= num_lvls; - type->map_count= map_count; - type->name= name; - if (map_count>0) { - type->map= _XkbTypedCalloc(map_count,XkbKTMapEntryRec); - if (!type->map) { - map->num_types--; - return NULL; - } - if (want_preserve) { - type->preserve= _XkbTypedCalloc(map_count,XkbModsRec); - if (!type->preserve) { - _XkbFree(type->map); - map->num_types--; - return NULL; - } - } - } - return type; -} - Status XkbResizeKeyType( XkbDescPtr xkb, int type_ndx, diff --git a/xkb/XKBMisc.c b/xkb/XKBMisc.c index 7ed47697e..0404108a2 100644 --- a/xkb/XKBMisc.c +++ b/xkb/XKBMisc.c @@ -39,102 +39,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include "inputstr.h" #include <X11/keysym.h> #define XKBSRV_NEED_FILE_FUNCS -#include <X11/extensions/XKBsrv.h> - -/***====================================================================***/ - -#define mapSize(m) (sizeof(m)/sizeof(XkbKTMapEntryRec)) -static XkbKTMapEntryRec map2Level[]= { - { True, ShiftMask, {1, ShiftMask, 0} } -}; - -static XkbKTMapEntryRec mapAlpha[]= { - { True, ShiftMask, { 1, ShiftMask, 0 } }, - { True, LockMask, { 0, LockMask, 0 } } -}; - -static XkbModsRec preAlpha[]= { - { 0, 0, 0 }, - { LockMask, LockMask, 0 } -}; - -#define NL_VMOD_MASK 0 -static XkbKTMapEntryRec mapKeypad[]= { - { True, ShiftMask, { 1, ShiftMask, 0 } }, - { False, 0, { 1, 0, NL_VMOD_MASK } } -}; - -static XkbKeyTypeRec canonicalTypes[XkbNumRequiredTypes] = { - { { 0, 0, 0 }, - 1, /* num_levels */ - 0, /* map_count */ - NULL, NULL, - None, NULL - }, - { { ShiftMask, ShiftMask, 0 }, - 2, /* num_levels */ - mapSize(map2Level), /* map_count */ - map2Level, NULL, - None, NULL - }, - { { ShiftMask|LockMask, ShiftMask|LockMask, 0 }, - 2, /* num_levels */ - mapSize(mapAlpha), /* map_count */ - mapAlpha, preAlpha, - None, NULL - }, - { { ShiftMask, ShiftMask, NL_VMOD_MASK }, - 2, /* num_levels */ - mapSize(mapKeypad), /* map_count */ - mapKeypad, NULL, - None, NULL - } -}; - -Status -XkbInitCanonicalKeyTypes(XkbDescPtr xkb,unsigned which,int keypadVMod) -{ -XkbClientMapPtr map; -XkbKeyTypePtr from,to; -Status rtrn; - - if (!xkb) - return BadMatch; - rtrn= XkbAllocClientMap(xkb,XkbKeyTypesMask,XkbNumRequiredTypes); - if (rtrn!=Success) - return rtrn; - map= xkb->map; - if ((which&XkbAllRequiredTypes)==0) - return Success; - rtrn= Success; - from= canonicalTypes; - to= map->types; - if (which&XkbOneLevelMask) - rtrn= XkbCopyKeyType(&from[XkbOneLevelIndex],&to[XkbOneLevelIndex]); - if ((which&XkbTwoLevelMask)&&(rtrn==Success)) - rtrn= XkbCopyKeyType(&from[XkbTwoLevelIndex],&to[XkbTwoLevelIndex]); - if ((which&XkbAlphabeticMask)&&(rtrn==Success)) - rtrn= XkbCopyKeyType(&from[XkbAlphabeticIndex],&to[XkbAlphabeticIndex]); - if ((which&XkbKeypadMask)&&(rtrn==Success)) { - XkbKeyTypePtr type; - rtrn= XkbCopyKeyType(&from[XkbKeypadIndex],&to[XkbKeypadIndex]); - type= &to[XkbKeypadIndex]; - if ((keypadVMod>=0)&&(keypadVMod<XkbNumVirtualMods)&&(rtrn==Success)) { - type->mods.vmods= (1<<keypadVMod); - type->map[0].active= True; - type->map[0].mods.mask= ShiftMask; - type->map[0].mods.real_mods= ShiftMask; - type->map[0].mods.vmods= 0; - type->map[0].level= 1; - type->map[1].active= False; - type->map[1].mods.mask= 0; - type->map[1].mods.real_mods= 0; - type->map[1].mods.vmods= (1<<keypadVMod); - type->map[1].level= 1; - } - } - return Success; -} +#include <xkbsrv.h> /***====================================================================***/ @@ -558,88 +463,6 @@ unsigned changed,tmp; return True; } -Bool -XkbUpdateMapFromCore( XkbDescPtr xkb, - KeyCode first_key, - int num_keys, - int map_width, - KeySym * core_keysyms, - XkbChangesPtr changes) -{ -register int key,last_key; -KeySym * syms; - - syms= &core_keysyms[(first_key-xkb->min_key_code)*map_width]; - if (changes) { - if (changes->map.changed&XkbKeySymsMask) { - _XkbAddKeyChange(&changes->map.first_key_sym, - &changes->map.num_key_syms,first_key); - if (num_keys>1) { - _XkbAddKeyChange(&changes->map.first_key_sym, - &changes->map.num_key_syms, - first_key+num_keys-1); - } - } - else { - changes->map.changed|= XkbKeySymsMask; - changes->map.first_key_sym= first_key; - changes->map.num_key_syms= num_keys; - } - } - last_key= first_key+num_keys-1; - for (key=first_key;key<=last_key;key++,syms+= map_width) { - XkbMapChangesPtr mc; - unsigned explicit; - KeySym tsyms[XkbMaxSymsPerKey]; - int types[XkbNumKbdGroups]; - int nG; - - explicit= xkb->server->explicit[key]&XkbExplicitKeyTypesMask; - types[XkbGroup1Index]= XkbKeyKeyTypeIndex(xkb,key,XkbGroup1Index); - types[XkbGroup2Index]= XkbKeyKeyTypeIndex(xkb,key,XkbGroup2Index); - types[XkbGroup3Index]= XkbKeyKeyTypeIndex(xkb,key,XkbGroup3Index); - types[XkbGroup4Index]= XkbKeyKeyTypeIndex(xkb,key,XkbGroup4Index); - nG= XkbKeyTypesForCoreSymbols(xkb,map_width,syms,explicit,types,tsyms); - if (changes) - mc= &changes->map; - else mc= NULL; - XkbChangeTypesOfKey(xkb,key,nG,XkbAllGroupsMask,types,mc); - memcpy((char *)XkbKeySymsPtr(xkb,key),(char *)tsyms, - XkbKeyNumSyms(xkb,key)*sizeof(KeySym)); - XkbApplyCompatMapToKey(xkb,key,changes); - } - - if ((xkb->server->vmods!=NULL)&&(xkb->map->modmap!=NULL)&&(changes)&& - (changes->map.changed&(XkbVirtualModMapMask|XkbModifierMapMask))) { - unsigned char newVMods[XkbNumVirtualMods]; - register unsigned bit,i; - unsigned present; - - bzero(newVMods,XkbNumVirtualMods); - present= 0; - for (key=xkb->min_key_code;key<=xkb->max_key_code;key++) { - if (xkb->server->vmodmap[key]==0) - continue; - for (i=0,bit=1;i<XkbNumVirtualMods;i++,bit<<=1) { - if (bit&xkb->server->vmodmap[key]) { - present|= bit; - newVMods[i]|= xkb->map->modmap[key]; - } - } - } - for (i=0,bit=1;i<XkbNumVirtualMods;i++,bit<<=1) { - if ((bit&present)&&(newVMods[i]!=xkb->server->vmods[i])) { - changes->map.changed|= XkbVirtualModsMask; - changes->map.vmods|= bit; - xkb->server->vmods[i]= newVMods[i]; - } - } - } - if (changes && (changes->map.changed&XkbVirtualModsMask)) - XkbApplyVirtualModChanges(xkb,changes->map.vmods,changes); - return True; -} - Status XkbChangeTypesOfKey( XkbDescPtr xkb, int key, @@ -788,7 +611,7 @@ register unsigned mask; /***====================================================================***/ -Bool +static Bool XkbUpdateActionVirtualMods(XkbDescPtr xkb,XkbAction *act,unsigned changed) { unsigned int tmp; @@ -814,7 +637,7 @@ unsigned int tmp; return False; } -void +static void XkbUpdateKeyTypeVirtualMods( XkbDescPtr xkb, XkbKeyTypePtr type, unsigned int changed, diff --git a/xkb/ddxBeep.c b/xkb/ddxBeep.c index 53f3a6f9c..331357ded 100644 --- a/xkb/ddxBeep.c +++ b/xkb/ddxBeep.c @@ -36,7 +36,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include "inputstr.h" #include "scrnintstr.h" #include "windowstr.h" -#include <X11/extensions/XKBsrv.h> +#include <xkbsrv.h> #include <X11/extensions/XI.h> /*#define FALLING_TONE 1*/ diff --git a/xkb/ddxCtrls.c b/xkb/ddxCtrls.c index 5a9ad4018..0f7f9187f 100644 --- a/xkb/ddxCtrls.c +++ b/xkb/ddxCtrls.c @@ -36,7 +36,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include "inputstr.h" #include "scrnintstr.h" #include "windowstr.h" -#include <X11/extensions/XKBsrv.h> +#include <xkbsrv.h> #include <X11/extensions/XI.h> void diff --git a/xkb/ddxDevBtn.c b/xkb/ddxDevBtn.c index 3de8f8721..7e27c5189 100644 --- a/xkb/ddxDevBtn.c +++ b/xkb/ddxDevBtn.c @@ -36,7 +36,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include "inputstr.h" #include "scrnintstr.h" #include "windowstr.h" -#include <X11/extensions/XKBsrv.h> +#include <xkbsrv.h> #include <X11/extensions/XI.h> #include <X11/extensions/XIproto.h> diff --git a/xkb/ddxFakeBtn.c b/xkb/ddxFakeBtn.c index f7b746b05..77222236f 100644 --- a/xkb/ddxFakeBtn.c +++ b/xkb/ddxFakeBtn.c @@ -37,7 +37,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include "inputstr.h" #include "scrnintstr.h" #include "windowstr.h" -#include <X11/extensions/XKBsrv.h> +#include <xkbsrv.h> #include <X11/extensions/XI.h> void diff --git a/xkb/ddxFakeMtn.c b/xkb/ddxFakeMtn.c index a19819fd7..1060afe99 100644 --- a/xkb/ddxFakeMtn.c +++ b/xkb/ddxFakeMtn.c @@ -36,7 +36,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include "inputstr.h" #include "scrnintstr.h" #include "windowstr.h" -#include <X11/extensions/XKBsrv.h> +#include <xkbsrv.h> #include <X11/extensions/XI.h> #ifdef PANORAMIX diff --git a/xkb/ddxInit.c b/xkb/ddxInit.c index 88c488c22..3bcf9d604 100644 --- a/xkb/ddxInit.c +++ b/xkb/ddxInit.c @@ -37,7 +37,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include "inputstr.h" #include "scrnintstr.h" #include "windowstr.h" -#include <X11/extensions/XKBsrv.h> +#include <xkbsrv.h> #include <X11/extensions/XI.h> int diff --git a/xkb/ddxKeyClick.c b/xkb/ddxKeyClick.c index 528b20207..685ae1b42 100644 --- a/xkb/ddxKeyClick.c +++ b/xkb/ddxKeyClick.c @@ -37,7 +37,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include "inputstr.h" #include "scrnintstr.h" #include "windowstr.h" -#include <X11/extensions/XKBsrv.h> +#include <xkbsrv.h> #include <X11/extensions/XI.h> void diff --git a/xkb/ddxKillSrv.c b/xkb/ddxKillSrv.c index 95d75897b..a573ecbd8 100644 --- a/xkb/ddxKillSrv.c +++ b/xkb/ddxKillSrv.c @@ -36,7 +36,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include "inputstr.h" #include "scrnintstr.h" #include "windowstr.h" -#include <X11/extensions/XKBsrv.h> +#include <xkbsrv.h> int XkbDDXTerminateServer(DeviceIntPtr dev,KeyCode key,XkbAction *act) diff --git a/xkb/ddxLEDs.c b/xkb/ddxLEDs.c index fd0195882..22899d766 100644 --- a/xkb/ddxLEDs.c +++ b/xkb/ddxLEDs.c @@ -37,10 +37,10 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include "inputstr.h" #include "scrnintstr.h" #include "windowstr.h" -#include <X11/extensions/XKBsrv.h> +#include <xkbsrv.h> #include <X11/extensions/XI.h> -void +static void XkbDDXUpdateIndicators(DeviceIntPtr dev,CARD32 new) { dev->kbdfeed->ctrl.leds= new; diff --git a/xkb/ddxList.c b/xkb/ddxList.c index 034f694ed..a91a9badf 100644 --- a/xkb/ddxList.c +++ b/xkb/ddxList.c @@ -40,7 +40,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include "scrnintstr.h" #include "windowstr.h" #define XKBSRV_NEED_FILE_FUNCS -#include <X11/extensions/XKBsrv.h> +#include <xkbsrv.h> #include <X11/extensions/XI.h> #ifndef PATH_MAX diff --git a/xkb/ddxLoad.c b/xkb/ddxLoad.c index 6e8f8921c..c24c56c1c 100644 --- a/xkb/ddxLoad.c +++ b/xkb/ddxLoad.c @@ -44,7 +44,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include "scrnintstr.h" #include "windowstr.h" #define XKBSRV_NEED_FILE_FUNCS -#include <X11/extensions/XKBsrv.h> +#include <xkbsrv.h> #include <X11/extensions/XI.h> #include "xkb.h" @@ -211,7 +211,7 @@ OutputDirectory( } } -Bool +static Bool XkbDDXCompileNamedKeymap( XkbDescPtr xkb, XkbComponentNamesPtr names, char * nameRtrn, @@ -298,7 +298,7 @@ char *cmd = NULL,file[PATH_MAX],xkm_output_dir[PATH_MAX],*map,*outFile; return False; } -Bool +static Bool XkbDDXCompileKeymapByNames( XkbDescPtr xkb, XkbComponentNamesPtr names, unsigned want, @@ -432,7 +432,7 @@ char tmpname[PATH_MAX]; return False; } -FILE * +static FILE * XkbDDXOpenConfigFile(char *mapName,char *fileNameRtrn,int fileNameRtrnLen) { char buf[PATH_MAX],xkm_output_dir[PATH_MAX]; diff --git a/xkb/ddxPrivate.c b/xkb/ddxPrivate.c index 7450b47ba..f67e20c27 100644 --- a/xkb/ddxPrivate.c +++ b/xkb/ddxPrivate.c @@ -6,7 +6,7 @@ #define NEED_EVENTS #include <X11/X.h> #include "windowstr.h" -#include <X11/extensions/XKBsrv.h> +#include <xkbsrv.h> int XkbDDXPrivate(DeviceIntPtr dev,KeyCode key,XkbAction *act) diff --git a/xkb/ddxVT.c b/xkb/ddxVT.c index f56f0796d..55c82a865 100644 --- a/xkb/ddxVT.c +++ b/xkb/ddxVT.c @@ -36,7 +36,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include "inputstr.h" #include "scrnintstr.h" #include "windowstr.h" -#include <X11/extensions/XKBsrv.h> +#include <xkbsrv.h> int XkbDDXSwitchScreen(DeviceIntPtr dev,KeyCode key,XkbAction *act) diff --git a/xkb/maprules.c b/xkb/maprules.c index b0a2225e2..0fa356ee5 100644 --- a/xkb/maprules.c +++ b/xkb/maprules.c @@ -48,7 +48,7 @@ #include "dix.h" #include <X11/extensions/XKBstr.h> #define XKBSRV_NEED_FILE_FUNCS -#include <X11/extensions/XKBsrv.h> +#include <xkbsrv.h> #ifdef DEBUG #define PR_DEBUG(s) fprintf(stderr,s) @@ -36,23 +36,20 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include "misc.h" #include "inputstr.h" #define XKBSRV_NEED_FILE_FUNCS -#include <X11/extensions/XKBsrv.h> +#include <xkbsrv.h> #include "extnsionst.h" #include "xkb.h" #include <X11/extensions/XI.h> int XkbEventBase; - int XkbErrorBase; +static int XkbErrorBase; int XkbReqCode; - int XkbKeyboardErrorCode; -Atom xkbONE_LEVEL; -Atom xkbTWO_LEVEL; -Atom xkbKEYPAD; +static int XkbKeyboardErrorCode; CARD32 xkbDebugFlags = 0; -CARD32 xkbDebugCtrls = 0; +static CARD32 xkbDebugCtrls = 0; -RESTYPE RT_XKBCLIENT; +static RESTYPE RT_XKBCLIENT; /***====================================================================***/ @@ -895,52 +892,6 @@ ProcXkbSetControls(ClientPtr client) return client->noClientException; } -/* FIXME: Needs to set rate on all core-sending devices. */ -int -XkbSetRepeatRate(DeviceIntPtr dev,int timeout,int interval,int major,int minor) -{ -int changed= 0; -XkbControlsRec old,*xkb; - - if ((!dev)||(!dev->key)||(!dev->key->xkbInfo)) - return 0; - xkb= dev->key->xkbInfo->desc->ctrls; - old= *xkb; - if ((timeout!=0) && (xkb->repeat_delay!=timeout)) { - xkb->repeat_delay= timeout; - changed++; - } - if ((interval!=0) && (xkb->repeat_interval!=interval)) { - xkb->repeat_interval= interval; - changed++; - } - if (changed) { - xkbControlsNotify cn; - XkbDDXChangeControls(dev,&old,xkb); - if (XkbComputeControlsNotify(dev,&old,xkb,&cn,False)) { - cn.keycode= 0; - cn.eventType = 0; - cn.requestMajor = major; - cn.requestMinor = minor; - XkbSendControlsNotify(dev,&cn); - } - } - return 1; -} - -int -XkbGetRepeatRate(DeviceIntPtr dev,int *timeout,int *interval) -{ -XkbControlsPtr xkb; - - if ((!dev)||(!dev->key)||(!dev->key->xkbInfo)) - return 0; - xkb= dev->key->xkbInfo->desc->ctrls; - if (timeout) *timeout= xkb->repeat_delay; - if (interval) *interval= xkb->repeat_interval; - return 1; -} - /***====================================================================***/ static int @@ -2820,7 +2771,7 @@ ProcXkbGetIndicatorState(ClientPtr client) /***====================================================================***/ -Status +static Status XkbComputeGetIndicatorMapReplySize( XkbIndicatorPtr indicators, xkbGetIndicatorMapReply *rep) @@ -2837,7 +2788,7 @@ int nIndicators; return Success; } -int +static int XkbSendIndicatorMap( ClientPtr client, XkbIndicatorPtr indicators, xkbGetIndicatorMapReply * rep) @@ -1,5 +1,3 @@ -/* $XFree86$ */ - /* #include "XKBfile.h" */ extern int ProcXkbUseExtension(ClientPtr client); @@ -29,50 +27,10 @@ extern int ProcXkbGetDeviceInfo(ClientPtr client); extern int ProcXkbSetDeviceInfo(ClientPtr client); extern int ProcXkbSetDebuggingFlags(ClientPtr client); -extern int XkbSetRepeatRate(DeviceIntPtr dev, int timeout, int interval, int major, int minor); -extern int XkbGetRepeatRate(DeviceIntPtr dev, int *timeout, int *interval); - extern void XkbExtensionInit(void); -extern Status XkbComputeGetIndicatorMapReplySize( - XkbIndicatorPtr indicators, - xkbGetIndicatorMapReply *rep); -extern int XkbSendIndicatorMap( - ClientPtr client, - XkbIndicatorPtr indicators, - xkbGetIndicatorMapReply *rep); - -extern void XkbComputeCompatState(XkbSrvInfoPtr xkbi); -extern void XkbSetPhysicalLockingKey(DeviceIntPtr dev, unsigned key); - extern Bool XkbFilterEvents(ClientPtr pClient, int nEvents, xEvent *xE); -extern Bool XkbApplyLEDChangeToKeyboard( - XkbSrvInfoPtr xkbi, - XkbIndicatorMapPtr map, - Bool on, - XkbChangesPtr change); - -extern Bool XkbWriteRulesProp(ClientPtr client, pointer closure); - -extern XkbAction XkbGetButtonAction(DeviceIntPtr kbd, DeviceIntPtr dev, int button); - -/* extern Status XkbMergeFile(XkbDescPtr xkb, XkbFileInfo finfo); */ - -extern Bool XkbDDXCompileNamedKeymap( - XkbDescPtr xkb, - XkbComponentNamesPtr names, - char * nameRtrn, - int nameRtrnLen); - -extern Bool XkbDDXCompileKeymapByNames( - XkbDescPtr xkb, - XkbComponentNamesPtr names, - unsigned want, - unsigned need, - char * nameRtrn, - int nameRtrnLen); - extern Bool XkbCopyKeymap( XkbDescPtr src, XkbDescPtr dst, diff --git a/xkb/xkbAccessX.c b/xkb/xkbAccessX.c index 0ab3dadf6..2954a0c0e 100644 --- a/xkb/xkbAccessX.c +++ b/xkb/xkbAccessX.c @@ -38,7 +38,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include <X11/Xproto.h> #include <X11/keysym.h> #include "inputstr.h" -#include <X11/extensions/XKBsrv.h> +#include <xkbsrv.h> #if !defined(WIN32) && !defined(Lynx) #include <sys/time.h> #endif @@ -52,9 +52,9 @@ pointer XkbLastRepeatEvent= NULL; unsigned short XkbDfltAccessXTimeout= 120; unsigned int XkbDfltAccessXTimeoutMask= DFLT_TIMEOUT_CTRLS; -unsigned int XkbDfltAccessXTimeoutValues= 0; -unsigned int XkbDfltAccessXTimeoutOptionsMask= DFLT_TIMEOUT_OPTS; -unsigned int XkbDfltAccessXTimeoutOptionsValues= 0; +static unsigned int XkbDfltAccessXTimeoutValues= 0; +static unsigned int XkbDfltAccessXTimeoutOptionsMask= DFLT_TIMEOUT_OPTS; +static unsigned int XkbDfltAccessXTimeoutOptionsValues= 0; unsigned int XkbDfltAccessXFeedback= XkbAccessXFeedbackMask; unsigned short XkbDfltAccessXOptions= XkbAX_AllOptionsMask & ~(XkbAX_IndicatorFBMask|XkbAX_SKReleaseFBMask|XkbAX_SKRejectFBMask); diff --git a/xkb/xkbActions.c b/xkb/xkbActions.c index e0bf89c7b..2e0c89fc2 100644 --- a/xkb/xkbActions.c +++ b/xkb/xkbActions.c @@ -36,14 +36,14 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include <X11/keysym.h> #include "misc.h" #include "inputstr.h" -#include <X11/extensions/XKBsrv.h> +#include <xkbsrv.h> #include "xkb.h" #include <ctype.h> static unsigned int _xkbServerGeneration; -int xkbDevicePrivateIndex = -1; +static int xkbDevicePrivateIndex = -1; -void +static void xkbUnwrapProc(DeviceIntPtr device, DeviceHandleProc proc, pointer data) { @@ -216,7 +216,7 @@ static XkbAction fake; return fake; } -XkbAction +static XkbAction XkbGetButtonAction(DeviceIntPtr kbd,DeviceIntPtr dev,int button) { XkbAction fake; diff --git a/xkb/xkbDflts.h b/xkb/xkbDflts.h index e31568abb..5d8690650 100644 --- a/xkb/xkbDflts.h +++ b/xkb/xkbDflts.h @@ -456,43 +456,6 @@ static XkbCompatMapRec compatMap= { num_dfltSI, num_dfltSI }; -static XkbIndicatorRec indicators= { - 0x0, - { - { 0x80, 0, 0x00, XkbIM_UseEffective, { LockMask, LockMask, 0 }, 0 }, - { 0x80, 0, 0x00, XkbIM_UseEffective, { 0, 0, vmod_NumLockMask }, 0 }, - { 0x80, 0, 0x00, XkbIM_UseLocked, { ShiftMask, ShiftMask, 0 }, 0 }, - { 0x80, 0, 0x00, 0, { 0, 0, 0 }, XkbMouseKeysMask }, - { 0x80, 0, 0x00, XkbIM_UseLocked, { 0, 0, vmod_ScrollLockMask }, 0 }, - { 0x80, XkbIM_UseEffective, 0xfe, 0, { 0, 0, 0 }, 0 }, - { 0x00, 0, 0x00, 0, { 0, 0, 0 }, 0 }, - { 0x00, 0, 0x00, 0, { 0, 0, 0 }, 0 }, - { 0x00, 0, 0x00, 0, { 0, 0, 0 }, 0 }, - { 0x00, 0, 0x00, 0, { 0, 0, 0 }, 0 }, - { 0x00, 0, 0x00, 0, { 0, 0, 0 }, 0 }, - { 0x00, 0, 0x00, 0, { 0, 0, 0 }, 0 }, - { 0x00, 0, 0x00, 0, { 0, 0, 0 }, 0 }, - { 0x00, 0, 0x00, 0, { 0, 0, 0 }, 0 }, - { 0x00, 0, 0x00, 0, { 0, 0, 0 }, 0 }, - { 0x00, 0, 0x00, 0, { 0, 0, 0 }, 0 }, - { 0x00, 0, 0x00, 0, { 0, 0, 0 }, 0 }, - { 0x00, 0, 0x00, 0, { 0, 0, 0 }, 0 }, - { 0x00, 0, 0x00, 0, { 0, 0, 0 }, 0 }, - { 0x00, 0, 0x00, 0, { 0, 0, 0 }, 0 }, - { 0x00, 0, 0x00, 0, { 0, 0, 0 }, 0 }, - { 0x00, 0, 0x00, 0, { 0, 0, 0 }, 0 }, - { 0x00, 0, 0x00, 0, { 0, 0, 0 }, 0 }, - { 0x00, 0, 0x00, 0, { 0, 0, 0 }, 0 }, - { 0x00, 0, 0x00, 0, { 0, 0, 0 }, 0 }, - { 0x00, 0, 0x00, 0, { 0, 0, 0 }, 0 }, - { 0x00, 0, 0x00, 0, { 0, 0, 0 }, 0 }, - { 0x00, 0, 0x00, 0, { 0, 0, 0 }, 0 }, - { 0x00, 0, 0x00, 0, { 0, 0, 0 }, 0 }, - { 0x00, 0, 0x00, 0, { 0, 0, 0 }, 0 }, - { 0x00, 0, 0x00, 0, { 0, 0, 0 }, 0 }, - { 0x00, 0, 0x00, 0, { 0, 0, 0 }, 0 } - } -}; static void initIndicatorNames(DPYTYPE dpy,XkbDescPtr xkb) { diff --git a/xkb/xkbEvents.c b/xkb/xkbEvents.c index 139221f3f..11dc17ad3 100644 --- a/xkb/xkbEvents.c +++ b/xkb/xkbEvents.c @@ -36,7 +36,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include <X11/extensions/XI.h> #include "inputstr.h" #include "windowstr.h" -#include <X11/extensions/XKBsrv.h> +#include <xkbsrv.h> #include "xkb.h" /***====================================================================***/ @@ -331,7 +331,7 @@ Time time = 0; return; } -void +static void XkbSendIndicatorNotify(DeviceIntPtr kbd,int xkbType,xkbIndicatorNotify *pEv) { int initialized; @@ -972,48 +972,6 @@ XkbInterestPtr interest; } int -XkbRemoveClient(DevicePtr inDev,ClientPtr client) -{ -XkbSrvInfoPtr xkbi; -DeviceIntPtr dev = (DeviceIntPtr)inDev; -XkbInterestPtr interest; -unsigned long autoCtrls,autoValues; -Bool found; - - found= False; - autoCtrls= autoValues= 0; - if ( dev->xkb_interest ) { - interest = dev->xkb_interest; - if (interest && (interest->client==client)){ - dev->xkb_interest = interest->next; - autoCtrls= interest->autoCtrls; - autoValues= interest->autoCtrlValues; - _XkbFree(interest); - found= True; - } - while ((!found)&&(interest->next)) { - if (interest->next->client==client) { - XkbInterestPtr victim = interest->next; - interest->next = victim->next; - autoCtrls= victim->autoCtrls; - autoValues= victim->autoCtrlValues; - _XkbFree(victim); - found= True; - } - interest = interest->next; - } - } - if (found && autoCtrls && dev->key && dev->key->xkbInfo ) { - XkbEventCauseRec cause; - - xkbi= dev->key->xkbInfo; - XkbSetCauseXkbReq(&cause,X_kbPerClientFlags,client); - XkbEnableDisableControls(xkbi,autoCtrls,autoValues,NULL,&cause); - } - return found; -} - -int XkbRemoveResourceClient(DevicePtr inDev,XID id) { XkbSrvInfoPtr xkbi; diff --git a/xkb/xkbInit.c b/xkb/xkbInit.c index 5aa121da2..716bc26a5 100644 --- a/xkb/xkbInit.c +++ b/xkb/xkbInit.c @@ -47,7 +47,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include "opaque.h" #include "property.h" #define XKBSRV_NEED_FILE_FUNCS -#include <X11/extensions/XKBsrv.h> +#include <xkbsrv.h> #include <X11/extensions/XKBgeom.h> #include <X11/extensions/XKMformat.h> #include <X11/extensions/XKBfile.h> @@ -124,7 +124,7 @@ typedef struct _SrvXkmInfo { char * XkbBaseDirectory= XKB_BASE_DIRECTORY; char * XkbBinDirectory= XKB_BIN_DIRECTORY; -int XkbWantAccessX= 0; +static int XkbWantAccessX= 0; static XkbFileInfo * _XkbInitFileInfo= NULL; static Bool rulesDefined= False; @@ -134,20 +134,17 @@ static char * XkbLayoutDflt= NULL; static char * XkbVariantDflt= NULL; static char * XkbOptionsDflt= NULL; -char * XkbModelUsed= NULL; -char * XkbLayoutUsed= NULL; -char * XkbVariantUsed= NULL; -char * XkbOptionsUsed= NULL; - -int _XkbClientMajor= XkbMajorVersion; -int _XkbClientMinor= XkbMinorVersion; +static char * XkbModelUsed= NULL; +static char * XkbLayoutUsed= NULL; +static char * XkbVariantUsed= NULL; +static char * XkbOptionsUsed= NULL; _X_EXPORT Bool noXkbExtension= XKB_DFLT_DISABLED; -Bool XkbWantRulesProp= XKB_DFLT_RULES_PROP; +static Bool XkbWantRulesProp= XKB_DFLT_RULES_PROP; /***====================================================================***/ -char * +static char * XkbGetRulesDflts(XkbRF_VarDefsPtr defs) { if (XkbModelDflt) defs->model= XkbModelDflt; @@ -161,7 +158,7 @@ XkbGetRulesDflts(XkbRF_VarDefsPtr defs) return (rulesDefined?XkbRulesFile:XKB_DFLT_RULES_FILE); } -Bool +static Bool XkbWriteRulesProp(ClientPtr client, pointer closure) { int len,out; @@ -230,7 +227,7 @@ char * pval; return True; } -void +static void XkbSetRulesUsed(XkbRF_VarDefsPtr defs) { if (XkbModelUsed) @@ -289,9 +286,6 @@ XkbSetRulesDflts(char *rulesFile,char *model,char *layout, #include "xkbDflts.h" -/* A dummy to keep the compiler quiet */ -pointer xkbBogus = &indicators; - static Bool XkbInitKeyTypes(XkbDescPtr xkb,SrvXkmInfo *file) { diff --git a/xkb/xkbLEDs.c b/xkb/xkbLEDs.c index e94e0bff4..d607d9066 100644 --- a/xkb/xkbLEDs.c +++ b/xkb/xkbLEDs.c @@ -38,7 +38,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include "inputstr.h" #include <X11/extensions/XI.h> -#include <X11/extensions/XKBsrv.h> +#include <xkbsrv.h> #include "xkb.h" /***====================================================================***/ @@ -82,7 +82,7 @@ XkbSrvLedInfoPtr sli; /* * Bool - * XkbApplyLEDChangeToKeyboard(xkbi,map,on,change) + *XkbApplyLEDChangeToKeyboard(xkbi,map,on,change) * * Some indicators "drive" the keyboard when their state is explicitly * changed, as described in section 9.2.1 of the XKB protocol spec. @@ -91,7 +91,7 @@ XkbSrvLedInfoPtr sli; * when the indicator described by 'map' is turned on or off. The * extent of the changes is reported in change, which must be defined. */ -Bool +static Bool XkbApplyLEDChangeToKeyboard( XkbSrvInfoPtr xkbi, XkbIndicatorMapPtr map, Bool on, @@ -166,6 +166,164 @@ XkbStatePtr state; } return (stateChange || ctrlChange); } + + /* + * Bool + * ComputeAutoState(map,state,ctrls) + * + * This function reports the effect of applying the specified + * indicator map given the specified state and controls, as + * described in section 9.2 of the XKB protocol specification. + */ + +static Bool +ComputeAutoState( XkbIndicatorMapPtr map, + XkbStatePtr state, + XkbControlsPtr ctrls) +{ +Bool on; +CARD8 mods,group; + + on= False; + mods= group= 0; + if (map->which_mods&XkbIM_UseAnyMods) { + if (map->which_mods&XkbIM_UseBase) + mods|= state->base_mods; + if (map->which_mods&XkbIM_UseLatched) + mods|= state->latched_mods; + if (map->which_mods&XkbIM_UseLocked) + mods|= state->locked_mods; + if (map->which_mods&XkbIM_UseEffective) + mods|= state->mods; + if (map->which_mods&XkbIM_UseCompat) + mods|= state->compat_state; + on = ((map->mods.mask&mods)!=0); + on = on||((mods==0)&&(map->mods.mask==0)&&(map->mods.vmods==0)); + } + if (map->which_groups&XkbIM_UseAnyGroup) { + if (map->which_groups&XkbIM_UseBase) + group|= (1L << state->base_group); + if (map->which_groups&XkbIM_UseLatched) + group|= (1L << state->latched_group); + if (map->which_groups&XkbIM_UseLocked) + group|= (1L << state->locked_group); + if (map->which_groups&XkbIM_UseEffective) + group|= (1L << state->group); + on = on||(((map->groups&group)!=0)||(map->groups==0)); + } + if (map->ctrls) + on = on||(ctrls->enabled_ctrls&map->ctrls); + return on; +} + + +static void +XkbUpdateLedAutoState( DeviceIntPtr dev, + XkbSrvLedInfoPtr sli, + unsigned maps_to_check, + xkbExtensionDeviceNotify * ed, + XkbChangesPtr changes, + XkbEventCausePtr cause) +{ +DeviceIntPtr kbd; +XkbStatePtr state; +XkbControlsPtr ctrls; +XkbChangesRec my_changes; +xkbExtensionDeviceNotify my_ed; +register unsigned i,bit,affected; +register XkbIndicatorMapPtr map; +unsigned oldState; + + if ((maps_to_check==0)||(sli->maps==NULL)||(sli->mapsPresent==0)) + return; + + if (dev->key && dev->key->xkbInfo) + kbd= dev; + else kbd= (DeviceIntPtr)LookupKeyboardDevice(); + + state= &kbd->key->xkbInfo->state; + ctrls= kbd->key->xkbInfo->desc->ctrls; + affected= maps_to_check; + oldState= sli->effectiveState; + sli->autoState&= ~affected; + for (i=0,bit=1;(i<XkbNumIndicators)&&(affected);i++,bit<<=1) { + if ((affected&bit)==0) + continue; + affected&= ~bit; + map= &sli->maps[i]; + if((!(map->flags&XkbIM_NoAutomatic))&&ComputeAutoState(map,state,ctrls)) + sli->autoState|= bit; + } + sli->effectiveState= (sli->autoState|sli->explicitState); + affected= sli->effectiveState^oldState; + if (affected==0) + return; + + if (ed==NULL) { + ed= &my_ed; + bzero((char *)ed,sizeof(xkbExtensionDeviceNotify)); + } + else if ((ed->reason&XkbXI_IndicatorsMask)&& + ((ed->ledClass!=sli->class)||(ed->ledID!=sli->id))) { + XkbFlushLedEvents(dev,kbd,sli,ed,changes,cause); + } + + if ((kbd==dev)&&(sli->flags&XkbSLI_IsDefault)) { + if (changes==NULL) { + changes= &my_changes; + bzero((char *)changes,sizeof(XkbChangesRec)); + } + changes->indicators.state_changes|= affected; + } + + ed->reason|= XkbXI_IndicatorStateMask; + ed->ledClass= sli->class; + ed->ledID= sli->id; + ed->ledsDefined= sli->namesPresent|sli->mapsPresent; + ed->ledState= sli->effectiveState; + ed->unsupported|= XkbXI_IndicatorStateMask; + ed->supported= XkbXI_AllFeaturesMask; + + if (changes!=&my_changes) changes= NULL; + if (ed!=&my_ed) ed= NULL; + if (changes || ed) + XkbFlushLedEvents(dev,kbd,sli,ed,changes,cause); + return; +} + +static void +XkbUpdateAllDeviceIndicators(XkbChangesPtr changes,XkbEventCausePtr cause) +{ +DeviceIntPtr edev; +XkbSrvLedInfoPtr sli; + + for (edev=inputInfo.devices;edev!=NULL;edev=edev->next) { + if (edev->kbdfeed) { + KbdFeedbackPtr kf; + for (kf=edev->kbdfeed;kf!=NULL;kf=kf->next) { + if ((kf->xkb_sli==NULL)||(kf->xkb_sli->maps==NULL)) + continue; + sli= kf->xkb_sli; + XkbUpdateLedAutoState(edev,sli,sli->mapsPresent,NULL, + changes,cause); + + } + } + if (edev->leds) { + LedFeedbackPtr lf; + for (lf=edev->leds;lf!=NULL;lf=lf->next) { + if ((lf->xkb_sli==NULL)||(lf->xkb_sli->maps==NULL)) + continue; + sli= lf->xkb_sli; + XkbUpdateLedAutoState(edev,sli,sli->mapsPresent,NULL, + changes,cause); + + } + } + } + return; +} + /***====================================================================***/ @@ -228,55 +386,6 @@ unsigned side_affected; /***====================================================================***/ - /* - * Bool - * ComputeAutoState(map,state,ctrls) - * - * This function reports the effect of applying the specified - * indicator map given the specified state and controls, as - * described in section 9.2 of the XKB protocol specification. - */ - -static Bool -ComputeAutoState( XkbIndicatorMapPtr map, - XkbStatePtr state, - XkbControlsPtr ctrls) -{ -Bool on; -CARD8 mods,group; - - on= False; - mods= group= 0; - if (map->which_mods&XkbIM_UseAnyMods) { - if (map->which_mods&XkbIM_UseBase) - mods|= state->base_mods; - if (map->which_mods&XkbIM_UseLatched) - mods|= state->latched_mods; - if (map->which_mods&XkbIM_UseLocked) - mods|= state->locked_mods; - if (map->which_mods&XkbIM_UseEffective) - mods|= state->mods; - if (map->which_mods&XkbIM_UseCompat) - mods|= state->compat_state; - on = ((map->mods.mask&mods)!=0); - on = on||((mods==0)&&(map->mods.mask==0)&&(map->mods.vmods==0)); - } - if (map->which_groups&XkbIM_UseAnyGroup) { - if (map->which_groups&XkbIM_UseBase) - group|= (1L << state->base_group); - if (map->which_groups&XkbIM_UseLatched) - group|= (1L << state->latched_group); - if (map->which_groups&XkbIM_UseLocked) - group|= (1L << state->locked_group); - if (map->which_groups&XkbIM_UseEffective) - group|= (1L << state->group); - on = on||(((map->groups&group)!=0)||(map->groups==0)); - } - if (map->ctrls) - on = on||(ctrls->enabled_ctrls&map->ctrls); - return on; -} - /***====================================================================***/ /* @@ -314,39 +423,6 @@ XkbSrvLedInfoPtr sli; /***====================================================================***/ -void -XkbUpdateAllDeviceIndicators(XkbChangesPtr changes,XkbEventCausePtr cause) -{ -DeviceIntPtr edev; -XkbSrvLedInfoPtr sli; - - for (edev=inputInfo.devices;edev!=NULL;edev=edev->next) { - if (edev->kbdfeed) { - KbdFeedbackPtr kf; - for (kf=edev->kbdfeed;kf!=NULL;kf=kf->next) { - if ((kf->xkb_sli==NULL)||(kf->xkb_sli->maps==NULL)) - continue; - sli= kf->xkb_sli; - XkbUpdateLedAutoState(edev,sli,sli->mapsPresent,NULL, - changes,cause); - - } - } - if (edev->leds) { - LedFeedbackPtr lf; - for (lf=edev->leds;lf!=NULL;lf=lf->next) { - if ((lf->xkb_sli==NULL)||(lf->xkb_sli->maps==NULL)) - continue; - sli= lf->xkb_sli; - XkbUpdateLedAutoState(edev,sli,sli->mapsPresent,NULL, - changes,cause); - - } - } - } - return; -} - /***====================================================================***/ /* @@ -856,210 +932,3 @@ Bool kb_changed; XkbUpdateAllDeviceIndicators(NULL,cause); return; } - -/***====================================================================***/ - -void -XkbUpdateLedAutoState( DeviceIntPtr dev, - XkbSrvLedInfoPtr sli, - unsigned maps_to_check, - xkbExtensionDeviceNotify * ed, - XkbChangesPtr changes, - XkbEventCausePtr cause) -{ -DeviceIntPtr kbd; -XkbStatePtr state; -XkbControlsPtr ctrls; -XkbChangesRec my_changes; -xkbExtensionDeviceNotify my_ed; -register unsigned i,bit,affected; -register XkbIndicatorMapPtr map; -unsigned oldState; - - if ((maps_to_check==0)||(sli->maps==NULL)||(sli->mapsPresent==0)) - return; - - if (dev->key && dev->key->xkbInfo) - kbd= dev; - else kbd= (DeviceIntPtr)LookupKeyboardDevice(); - - state= &kbd->key->xkbInfo->state; - ctrls= kbd->key->xkbInfo->desc->ctrls; - affected= maps_to_check; - oldState= sli->effectiveState; - sli->autoState&= ~affected; - for (i=0,bit=1;(i<XkbNumIndicators)&&(affected);i++,bit<<=1) { - if ((affected&bit)==0) - continue; - affected&= ~bit; - map= &sli->maps[i]; - if((!(map->flags&XkbIM_NoAutomatic))&&ComputeAutoState(map,state,ctrls)) - sli->autoState|= bit; - } - sli->effectiveState= (sli->autoState|sli->explicitState); - affected= sli->effectiveState^oldState; - if (affected==0) - return; - - if (ed==NULL) { - ed= &my_ed; - bzero((char *)ed,sizeof(xkbExtensionDeviceNotify)); - } - else if ((ed->reason&XkbXI_IndicatorsMask)&& - ((ed->ledClass!=sli->class)||(ed->ledID!=sli->id))) { - XkbFlushLedEvents(dev,kbd,sli,ed,changes,cause); - } - - if ((kbd==dev)&&(sli->flags&XkbSLI_IsDefault)) { - if (changes==NULL) { - changes= &my_changes; - bzero((char *)changes,sizeof(XkbChangesRec)); - } - changes->indicators.state_changes|= affected; - } - - ed->reason|= XkbXI_IndicatorStateMask; - ed->ledClass= sli->class; - ed->ledID= sli->id; - ed->ledsDefined= sli->namesPresent|sli->mapsPresent; - ed->ledState= sli->effectiveState; - ed->unsupported|= XkbXI_IndicatorStateMask; - ed->supported= XkbXI_AllFeaturesMask; - - if (changes!=&my_changes) changes= NULL; - if (ed!=&my_ed) ed= NULL; - if (changes || ed) - XkbFlushLedEvents(dev,kbd,sli,ed,changes,cause); - return; -} - -/***====================================================================***/ - -static void -_UpdateButtonVMods( XkbDescPtr xkb, - unsigned num_btns, - XkbAction * acts, - unsigned changed, - xkbExtensionDeviceNotify * ed_inout) -{ -register int i; - - for (i=0;i<num_btns;i++,acts++) { - if ((acts->any.type!=XkbSA_NoAction)&& - XkbUpdateActionVirtualMods(xkb,acts,changed)) { - if ((ed_inout->reason&XkbXI_ButtonActionsMask)==0) { - ed_inout->reason|= XkbXI_ButtonActionsMask; - ed_inout->firstBtn= i; - ed_inout->nBtns= 1; - } - else { - ed_inout->nBtns= (i-ed_inout->firstBtn)+1; - } - } - } - return; -} - -static void -_UpdateMapVMods( XkbDescPtr xkb, - register XkbIndicatorMapPtr map, - unsigned changed_vmods, - unsigned * changed_maps_rtrn) -{ -register int i; - - *changed_maps_rtrn= 0; - for (i=0;i<XkbNumIndicators;i++,map++) { - if (map->mods.vmods&changed_vmods) { - map->mods.mask= map->mods.real_mods; - map->mods.mask|= XkbMaskForVMask(xkb,map->mods.vmods); - *changed_maps_rtrn|= (1L<<i); - } - } - return; -} - -static void -_UpdateDeviceVMods( DeviceIntPtr dev, - XkbDescPtr xkb, - unsigned changed, - XkbEventCausePtr cause) -{ -xkbExtensionDeviceNotify ed; -XkbSrvLedInfoPtr sli; -unsigned changed_maps; - - bzero((char *)&ed,sizeof(xkbExtensionDeviceNotify)); - ed.deviceID= dev->id; - if ((dev->button)&&(dev->button->xkb_acts)) { - _UpdateButtonVMods(xkb,dev->button->numButtons, - dev->button->xkb_acts,changed,&ed); - } - if (dev->kbdfeed) { - KbdFeedbackPtr kf; - for (kf=dev->kbdfeed;kf!=NULL;kf=kf->next) { - if ((kf->xkb_sli==NULL)||(kf->xkb_sli->maps==NULL)) - continue; - sli= kf->xkb_sli; - _UpdateMapVMods(xkb,sli->maps,changed,&changed_maps); - if (changed_maps) { - if (ed.reason&XkbXI_IndicatorsMask) { - XkbSendExtensionDeviceNotify(dev,NULL,&ed); - ed.reason= 0; - ed.firstBtn= ed.nBtns; - } - ed.ledClass= sli->class; - ed.ledID= sli->id; - ed.ledsDefined= sli->namesPresent|sli->mapsPresent; - ed.reason|= XkbXI_IndicatorMapsMask; - XkbUpdateLedAutoState(dev,sli,changed_maps,&ed,NULL,cause); - } - } - } - if (dev->leds) { - LedFeedbackPtr lf; - for (lf=dev->leds;lf!=NULL;lf=lf->next) { - if ((lf->xkb_sli==NULL)||(lf->xkb_sli->maps==NULL)) - continue; - sli= lf->xkb_sli; - _UpdateMapVMods(xkb,sli->maps,changed,&changed_maps); - if (changed_maps) { - if (ed.reason&XkbXI_IndicatorsMask) { - XkbSendExtensionDeviceNotify(dev,NULL,&ed); - ed.reason= 0; - ed.firstBtn= ed.nBtns; - } - ed.ledClass= sli->class; - ed.ledID= sli->id; - ed.ledsDefined= sli->namesPresent|sli->mapsPresent; - ed.reason|= XkbXI_IndicatorMapsMask; - XkbUpdateLedAutoState(dev,sli,changed_maps,&ed,NULL,cause); - } - } - } - if (ed.reason!=0) - XkbSendExtensionDeviceNotify(dev,NULL,&ed); - return; -} - -void -XkbApplyVModChangesToAllDevices( DeviceIntPtr dev, - XkbDescPtr xkb, - unsigned changed, - XkbEventCausePtr cause) -{ -DeviceIntPtr edev; - if (dev!=(DeviceIntPtr)LookupKeyboardDevice()) - return; - for (edev=inputInfo.devices;edev!=NULL;edev=edev->next) { - if (edev->key) - continue; - _UpdateDeviceVMods(edev,xkb,changed,cause); - } - for (edev=inputInfo.off_devices;edev!=NULL;edev=edev->next) { - if (edev->key) - continue; - _UpdateDeviceVMods(edev,xkb,changed,cause); - } - return; -} diff --git a/xkb/xkbPrKeyEv.c b/xkb/xkbPrKeyEv.c index 9944c8886..81124bcfb 100644 --- a/xkb/xkbPrKeyEv.c +++ b/xkb/xkbPrKeyEv.c @@ -36,7 +36,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include <X11/keysym.h> #include "misc.h" #include "inputstr.h" -#include <X11/extensions/XKBsrv.h> +#include <xkbsrv.h> #include <ctype.h> diff --git a/xkb/xkbSwap.c b/xkb/xkbSwap.c index 9a04b77d5..da4c9053b 100644 --- a/xkb/xkbSwap.c +++ b/xkb/xkbSwap.c @@ -35,7 +35,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include <X11/Xproto.h> #include "misc.h" #include "inputstr.h" -#include <X11/extensions/XKBsrv.h> +#include <xkbsrv.h> #include <X11/extensions/XKBstr.h> #include "extnsionst.h" #include "xkb.h" diff --git a/xkb/xkbUtils.c b/xkb/xkbUtils.c index 062159ec6..1d2366756 100644 --- a/xkb/xkbUtils.c +++ b/xkb/xkbUtils.c @@ -41,7 +41,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include "inputstr.h" #define XKBSRV_NEED_FILE_FUNCS -#include <X11/extensions/XKBsrv.h> +#include <xkbsrv.h> #include <X11/extensions/XKBgeom.h> #include "xkb.h" @@ -172,44 +172,6 @@ register unsigned mask; return mask; } - -Bool -XkbApplyVModChanges( XkbSrvInfoPtr xkbi, - unsigned changed, - XkbChangesPtr changes, - unsigned * needChecksRtrn, - XkbEventCausePtr cause) -{ -XkbDescPtr xkb; -Bool check; - - xkb= xkbi->desc; -#ifdef DEBUG -{ -register unsigned i,bit; - for (i=0,bit=1;i<XkbNumVirtualMods;i++,bit<<=1) { - if ((changed&bit)==0) - continue; - if (xkbDebugFlags) - ErrorF("Should be applying: change vmod %d to 0x%x\n",i, - xkb->server->vmods[i]); - } -} -#endif - check= XkbApplyVirtualModChanges(xkb,changed,changes); - XkbApplyVModChangesToAllDevices(xkbi->device,xkb,changed,cause); - - if (needChecksRtrn!=NULL) { - if (check) - *needChecksRtrn= XkbStateNotifyMask|XkbIndicatorStateNotifyMask; - else *needChecksRtrn= 0; - } - else if (check) { - /* 7/12/95 (ef) -- XXX check compatibility and/or indicator state */ - } - return 1; -} - /***====================================================================***/ void @@ -658,7 +620,7 @@ int changed; return changed; } -void +static void XkbComputeCompatState(XkbSrvInfoPtr xkbi) { CARD16 grp_mask; @@ -772,21 +734,6 @@ XkbCheckSecondaryEffects( XkbSrvInfoPtr xkbi, /***====================================================================***/ -void -XkbSetPhysicalLockingKey(DeviceIntPtr dev,unsigned key) -{ -XkbDescPtr xkb; - - xkb= dev->key->xkbInfo->desc; - if ((key>=xkb->min_key_code) && (key<=xkb->max_key_code)) { - xkb->server->behaviors[key].type= XkbKB_Lock|XkbKB_Permanent; - } - else ErrorF("Internal Error! Bad XKB info in SetPhysicalLockingKey\n"); - return; -} - -/***====================================================================***/ - Bool XkbEnableDisableControls( XkbSrvInfoPtr xkbi, unsigned long change, diff --git a/xkb/xkberrs.c b/xkb/xkberrs.c index 095d573ea..3534356c6 100644 --- a/xkb/xkberrs.c +++ b/xkb/xkberrs.c @@ -32,37 +32,6 @@ #include <ctype.h> #include <stdlib.h> -char * _XkbErrMessages[] = { - "success", /* _XkbSuccess */ - "key names not defined", /* _XkbErrMissingNames */ - "key types not defined", /* _XkbErrMissingTypes */ - "required key types not present", /* _XkbErrMissingReqTypes */ - "symbols not defined", /* _XkbErrMissingSymbols */ - "virtual modifier bindings not defined",/* _XkbErrMissingVMods */ - "indicators not defined", /* _XkbErrMissingIndicators */ - "compatibility map not defined", /* _XkbErrMissingCompatMap */ - "symbol interpretations not defined", /* _XkbErrMissingSymInterps */ - "geometry not defined", /* _XkbErrMissingGeometry */ - "illegal doodad type", /* _XkbErrIllegalDoodad */ - "illegal TOC type", /* _XkbErrIllegalTOCType */ - "illegal contents", /* _XkbErrIllegalContents */ - "empty file", /* _XkbErrEmptyFile */ - "file not found", /* _XkbErrFileNotFound */ - "cannot open", /* _XkbErrFileCannotOpen */ - "bad value", /* _XkbErrBadValue */ - "bad match", /* _XkbErrBadMatch */ - "illegal name for type", /* _XkbErrBadTypeName */ - "illegal width for type", /* _XkbErrBadTypeWidth */ - "bad file type", /* _XkbErrBadFileType */ - "bad file version", /* _XkbErrBadFileVersion */ - "error in Xkm file", /* _XkbErrBadFileFormat */ - "allocation failed", /* _XkbErrBadAlloc */ - "bad length", /* _XkbErrBadLength */ - "X request failed", /* _XkbErrXReqFailure */ - "not implemented" /* _XkbErrBadImplementation */ -}; - unsigned _XkbErrCode; char * _XkbErrLocation= NULL; unsigned _XkbErrData; - diff --git a/xkb/xkbfmisc.c b/xkb/xkbfmisc.c index 4130bd998..05344b475 100644 --- a/xkb/xkbfmisc.c +++ b/xkb/xkbfmisc.c @@ -44,7 +44,7 @@ #include "dix.h" #include <X11/extensions/XKBstr.h> #define XKBSRV_NEED_FILE_FUNCS 1 -#include <X11/extensions/XKBsrv.h> +#include <xkbsrv.h> #include <X11/extensions/XKBgeom.h> #include "xkb.h" @@ -133,76 +133,6 @@ unsigned set,rtrn; /***===================================================================***/ -Bool -XkbLookupGroupAndLevel( XkbDescPtr xkb, - int key, - int * mods_inout, - int * grp_inout, - int * lvl_rtrn) -{ -int nG,eG; - - if ((!xkb)||(!XkbKeycodeInRange(xkb,key))||(!grp_inout)) - return False; - - nG= XkbKeyNumGroups(xkb,key); - eG= *grp_inout; - - if ( nG==0 ) { - *grp_inout= 0; - if (lvl_rtrn!=NULL) - *lvl_rtrn= 0; - return False; - } - else if ( nG==1 ) { - eG= 0; - } - else if ( eG>=nG ) { - unsigned gI= XkbKeyGroupInfo(xkb,key); - switch (XkbOutOfRangeGroupAction(gI)) { - default: - eG %= nG; - break; - case XkbClampIntoRange: - eG = nG-1; - break; - case XkbRedirectIntoRange: - eG = XkbOutOfRangeGroupNumber(gI); - if (eG>=nG) - eG= 0; - break; - } - } - *grp_inout= eG; - if (mods_inout!=NULL) { - XkbKeyTypePtr type; - int preserve; - - type = XkbKeyKeyType(xkb,key,eG); - if (lvl_rtrn!=NULL) - *lvl_rtrn= 0; - preserve= 0; - if (type->map) { /* find the shift level */ - register int i; - register XkbKTMapEntryPtr entry; - for (i=0,entry=type->map;i<type->map_count;i++,entry++) { - if ((entry->active)&& - (((*mods_inout)&type->mods.mask)==entry->mods.mask)){ - if (lvl_rtrn!=NULL) - *lvl_rtrn= entry->level; - if (type->preserve) - preserve= type->preserve[i].mask; - break; - } - } - } - (*mods_inout)&= ~(type->mods.mask&(~preserve)); - } - return True; -} - -/***===================================================================***/ - static Bool XkbWriteSectionFromName(FILE *file,char *sectionName,char *name) { @@ -416,15 +346,6 @@ XkbFileInfo finfo; /***====================================================================***/ -/*ARGSUSED*/ -Status -XkbMergeFile(XkbDescPtr xkb,XkbFileInfo finfo) -{ - return BadImplementation; -} - -/***====================================================================***/ - int XkbFindKeycodeByName(XkbDescPtr xkb,char *name,Bool use_aliases) { @@ -484,34 +405,6 @@ unsigned rtrn; return rtrn; } -unsigned -XkbConvertXkbComponents(Bool toXkm,unsigned orig) -{ -unsigned rtrn; - - rtrn= 0; - if (toXkm) { - if (orig&XkbClientMapMask) rtrn|= XkmTypesMask|XkmSymbolsMask; - if (orig&XkbServerMapMask) rtrn|= XkmTypesMask|XkmSymbolsMask; - if (orig&XkbCompatMapMask) rtrn|= XkmCompatMapMask; - if (orig&XkbIndicatorMapMask) rtrn|= XkmIndicatorsMask; - if (orig&XkbNamesMask) rtrn|= XkmKeyNamesMask; - if (orig&XkbGeometryMask) rtrn|= XkmGeometryMask; - } - else { - if (orig!=0) rtrn|= XkbNamesMask; - if (orig&XkmTypesMask) rtrn|= XkbClientMapMask; - if (orig&XkmCompatMapMask) - rtrn|= XkbCompatMapMask|XkbIndicatorMapMask; - if (orig&XkmSymbolsMask) rtrn|=XkbClientMapMask|XkbServerMapMask; - if (orig&XkmIndicatorsMask) rtrn|= XkbIndicatorMapMask; - if (orig&XkmKeyNamesMask) - rtrn|= XkbNamesMask|XkbIndicatorMapMask; - if (orig&XkmGeometryMask) rtrn|= XkbGeometryMask; - } - return rtrn; -} - Bool XkbDetermineFileType(XkbFileInfoPtr finfo,int format,int *opts_missing) { diff --git a/xkb/xkbout.c b/xkb/xkbout.c index 31cd4fae4..bdec8e7d3 100644 --- a/xkb/xkbout.c +++ b/xkb/xkbout.c @@ -44,7 +44,7 @@ #include "dix.h" #include <X11/extensions/XKBstr.h> #define XKBSRV_NEED_FILE_FUNCS 1 -#include <X11/extensions/XKBsrv.h> +#include <xkbsrv.h> #include <X11/extensions/XKBgeom.h> #include <X11/extensions/XKBfile.h> @@ -925,127 +925,3 @@ XkbGeometryPtr geom; fprintf(file,"};\n\n"); return True; } - -/*ARGSUSED*/ -Bool -XkbWriteXKBSemantics( FILE * file, - XkbFileInfo * result, - Bool topLevel, - Bool showImplicit, - XkbFileAddOnFunc addOn, - void * priv) -{ -Bool ok; - - fprintf(file,"xkb_semantics {\n"); - ok= XkbWriteXKBKeyTypes(file,result,False,False,addOn,priv); - ok= ok&&XkbWriteXKBCompatMap(file,result,False,False,addOn,priv); - fprintf(file,"};\n"); - return ok; -} - -/*ARGSUSED*/ -Bool -XkbWriteXKBLayout( FILE * file, - XkbFileInfo * result, - Bool topLevel, - Bool showImplicit, - XkbFileAddOnFunc addOn, - void * priv) -{ -Bool ok; -XkbDescPtr xkb; - - xkb= result->xkb; - fprintf(file,"xkb_layout {\n"); - ok= XkbWriteXKBKeycodes(file,result,False,showImplicit,addOn,priv); - ok= ok&&XkbWriteXKBKeyTypes(file,result,False,showImplicit,addOn,priv); - ok= ok&&XkbWriteXKBSymbols(file,result,False,showImplicit,addOn,priv); - if (xkb->geom) - ok= ok&&XkbWriteXKBGeometry(file,result,False,showImplicit,addOn,priv); - fprintf(file,"};\n"); - return ok; -} - -/*ARGSUSED*/ -Bool -XkbWriteXKBKeymap( FILE * file, - XkbFileInfo * result, - Bool topLevel, - Bool showImplicit, - XkbFileAddOnFunc addOn, - void * priv) -{ -Bool ok; -XkbDescPtr xkb; - - xkb= result->xkb; - fprintf(file,"xkb_keymap {\n"); - ok= XkbWriteXKBKeycodes(file,result,False,showImplicit,addOn,priv); - ok= ok&&XkbWriteXKBKeyTypes(file,result,False,showImplicit,addOn,priv); - ok= ok&&XkbWriteXKBCompatMap(file,result,False,showImplicit,addOn,priv); - ok= ok&&XkbWriteXKBSymbols(file,result,False,showImplicit,addOn,priv); - if (xkb->geom) - ok= ok&&XkbWriteXKBGeometry(file,result,False,showImplicit,addOn,priv); - fprintf(file,"};\n"); - return ok; -} - -Bool -XkbWriteXKBFile( FILE * out, - XkbFileInfo * result, - Bool showImplicit, - XkbFileAddOnFunc addOn, - void * priv) -{ -Bool ok = False; -Bool (*func)( - FILE * /* file */, - XkbFileInfo * /* result */, - Bool /* topLevel */, - Bool /* showImplicit */, - XkbFileAddOnFunc /* addOn */, - void * /* priv */ -) = NULL; - - switch (result->type) { - case XkmSemanticsFile: - func= XkbWriteXKBSemantics; - break; - case XkmLayoutFile: - func= XkbWriteXKBLayout; - break; - case XkmKeymapFile: - func= XkbWriteXKBKeymap; - break; - case XkmTypesIndex: - func= XkbWriteXKBKeyTypes; - break; - case XkmCompatMapIndex: - func= XkbWriteXKBCompatMap; - break; - case XkmSymbolsIndex: - func= XkbWriteXKBSymbols; - break; - case XkmKeyNamesIndex: - func= XkbWriteXKBKeycodes; - break; - case XkmGeometryFile: - case XkmGeometryIndex: - func= XkbWriteXKBGeometry; - break; - case XkmVirtualModsIndex: - case XkmIndicatorsIndex: - _XkbLibError(_XkbErrBadImplementation, - XkbConfigText(result->type,XkbMessage),0); - return False; - } - if (out==NULL) { - _XkbLibError(_XkbErrFileCannotOpen,"XkbWriteXkbFile",0); - ok= False; - } - else if (func) { - ok= (*func)(out,result,True,showImplicit,addOn,priv); - } - return ok; -} diff --git a/xkb/xkbtext.c b/xkb/xkbtext.c index defd45a64..3a5037150 100644 --- a/xkb/xkbtext.c +++ b/xkb/xkbtext.c @@ -44,7 +44,7 @@ #include "dix.h" #include <X11/extensions/XKBstr.h> #define XKBSRV_NEED_FILE_FUNCS 1 -#include <X11/extensions/XKBsrv.h> +#include <xkbsrv.h> #include <X11/extensions/XKBgeom.h> /***====================================================================***/ @@ -448,100 +448,6 @@ char * buf; return buf; } -char * -XkbAccessXDetailText(unsigned state,unsigned format) -{ -char *buf,*prefix; - - buf= tbGetBuffer(32); - if (format==XkbMessage) prefix= ""; - else prefix= "XkbAXN_"; - switch (state){ - case XkbAXN_SKPress: sprintf(buf,"%sSKPress",prefix); break; - case XkbAXN_SKAccept: sprintf(buf,"%sSKAccept",prefix); break; - case XkbAXN_SKRelease: sprintf(buf,"%sSKRelease",prefix); break; - case XkbAXN_SKReject: sprintf(buf,"%sSKReject",prefix); break; - case XkbAXN_BKAccept: sprintf(buf,"%sBKAccept",prefix); break; - case XkbAXN_BKReject: sprintf(buf,"%sBKReject",prefix); break; - case XkbAXN_AXKWarning: sprintf(buf,"%sAXKWarning",prefix); break; - default: sprintf(buf,"ILLEGAL"); break; - } - return buf; -} - -static char *nknNames[] = { - "keycodes", "geometry", "deviceID" -}; -#define NUM_NKN (sizeof(nknNames)/sizeof(char *)) - -char * -XkbNKNDetailMaskText(unsigned detail,unsigned format) -{ -char *buf,*prefix,*suffix; -register int i; -register unsigned bit; -int len,plen,slen; - - - if ((detail&XkbAllNewKeyboardEventsMask)==0) { - char *tmp = ""; - if (format==XkbCFile) tmp= "0"; - else if (format==XkbMessage) tmp= "none"; - buf= tbGetBuffer(strlen(tmp)+1); - strcpy(buf,tmp); - return buf; - } - else if ((detail&XkbAllNewKeyboardEventsMask)==XkbAllNewKeyboardEventsMask){ - char * tmp; - if (format==XkbCFile) tmp= "XkbAllNewKeyboardEventsMask"; - else tmp= "all"; - buf= tbGetBuffer(strlen(tmp)+1); - strcpy(buf,tmp); - return buf; - } - if (format==XkbMessage) { - prefix= ""; - suffix= ""; - slen= plen= 0; - } - else { - prefix= "XkbNKN_"; - plen= 7; - if (format==XkbCFile) - suffix= "Mask"; - else suffix= ""; - slen= strlen(suffix); - } - for (len=0,i=0,bit=1;i<NUM_NKN;i++,bit<<=1) { - if (detail&bit) { - if (len!=0) len+= 1; /* room for '+' or '|' */ - len+= plen+slen+strlen(nknNames[i]); - } - } - buf= tbGetBuffer(len+1); - buf[0]= '\0'; - for (len=0,i=0,bit=1;i<NUM_NKN;i++,bit<<=1) { - if (detail&bit) { - if (len!=0) { - if (format==XkbCFile) buf[len++]= '|'; - else buf[len++]= '+'; - } - if (plen) { - strcpy(&buf[len],prefix); - len+= plen; - } - strcpy(&buf[len],nknNames[i]); - len+= strlen(nknNames[i]); - if (slen) { - strcpy(&buf[len],suffix); - len+= slen; - } - } - } - buf[len++]= '\0'; - return buf; -} - static char *ctrlNames[] = { "repeatKeys", "slowKeys", diff --git a/xkb/xkmread.c b/xkb/xkmread.c index fec86874f..c6c18422d 100644 --- a/xkb/xkmread.c +++ b/xkb/xkmread.c @@ -41,7 +41,7 @@ #include "inputstr.h" #include <X11/extensions/XKBstr.h> #define XKBSRV_NEED_FILE_FUNCS -#include <X11/extensions/XKBsrv.h> +#include <xkbsrv.h> #include <X11/extensions/XKBgeom.h> Atom @@ -1098,18 +1098,6 @@ unsigned i,size_toc; return 1; } -xkmSectionInfo * -XkmFindTOCEntry(xkmFileInfo *finfo,xkmSectionInfo *toc,unsigned type) -{ -register int i; - - for (i=0;i<finfo->num_toc;i++) { - if (toc[i].type==type) - return &toc[i]; - } - return NULL; -} - Bool XkmReadFileSection( FILE * file, xkmSectionInfo * toc, |