diff options
author | Sergey Udaltsov <svu@gnome.org> | 2004-01-20 08:56:41 +0000 |
---|---|---|
committer | Sergey Udaltsov <svu@gnome.org> | 2004-01-20 08:56:41 +0000 |
commit | 21b25ac93553d1a8e4a94607875bd99b016d4a71 (patch) | |
tree | fa905c4b6ba115d5fd17c146eb7023e9d9f0e1bd /libxklavier/xklavier_xkb.c | |
parent | ab2c2908cc9605d2810cd2e56011e114d02fff7f (diff) | |
download | libxklavier-21b25ac93553d1a8e4a94607875bd99b016d4a71.tar.gz |
Trying to make libxklavier buildable without xkb headers, first round
Diffstat (limited to 'libxklavier/xklavier_xkb.c')
-rw-r--r-- | libxklavier/xklavier_xkb.c | 42 |
1 files changed, 38 insertions, 4 deletions
diff --git a/libxklavier/xklavier_xkb.c b/libxklavier/xklavier_xkb.c index 5dd6994..3dd2351 100644 --- a/libxklavier/xklavier_xkb.c +++ b/libxklavier/xklavier_xkb.c @@ -9,7 +9,7 @@ #include "xklavier_private_xkb.h" XkbDescPtr _xklXkb; - +#ifdef XKB_HEADERS_PRESENT char *_xklIndicatorNames[XkbNumIndicators]; unsigned _xklPhysIndicatorsMask; @@ -22,6 +22,13 @@ const char **XklGetGroupNames( void ) { return ( const char ** ) groupNames; } +#else +const char **XklGetGroupNames( void ) +{ + static const char* dummyName = "???"; + return ( const char ** ) &dummyName; +} +#endif int XklInit( Display * a_dpy ) { @@ -31,6 +38,7 @@ int XklInit( Display * a_dpy ) _xklDefaultErrHandler = XSetErrorHandler( ( XErrorHandler ) _XklErrHandler ); +#ifdef XKB_HEADERS_PRESENT /* Lets begin */ _xklXkbExtPresent = XkbQueryExtension( _xklDpy = a_dpy, &opcode, &_xklXkbEventType, @@ -39,22 +47,31 @@ int XklInit( Display * a_dpy ) { return -1; } +#endif scr = DefaultScreen( _xklDpy ); _xklRootWindow = RootWindow( _xklDpy, scr ); +#ifdef XKB_HEADERS_PRESENT XklDebug( 160, "xkbEvenType: %X, xkbError: %X, display: %p, root: " WINID_FORMAT "\n", _xklXkbEventType, _xklXkbError, _xklDpy, _xklRootWindow ); +#else + XklDebug( 160, + "NO XKB LIBS, display: %p, root: " WINID_FORMAT + "\n", _xklDpy, _xklRootWindow ); +#endif _xklAtoms[WM_NAME] = XInternAtom( _xklDpy, "WM_NAME", False ); _xklAtoms[WM_STATE] = XInternAtom( _xklDpy, "WM_STATE", False ); _xklAtoms[XKLAVIER_STATE] = XInternAtom( _xklDpy, "XKLAVIER_STATE", False ); _xklAtoms[XKLAVIER_TRANSPARENT] = XInternAtom( _xklDpy, "XKLAVIER_TRANSPARENT", False ); +#ifdef XKB_HEADERS_PRESENT _xklAtoms[XKB_RF_NAMES_PROP_ATOM] = XInternAtom( _xklDpy, _XKB_RF_NAMES_PROP_ATOM, False ); _xklAtoms[XKB_RF_NAMES_PROP_ATOM_BACKUP] = XInternAtom( _xklDpy, "_XKB_RULES_NAMES_BACKUP", False ); +#endif _xklAllowSecondaryGroupOnce = False; _xklSkipOneRestore = False; @@ -67,6 +84,7 @@ int XklInit( Display * a_dpy ) int XklPauseListen( ) { +#ifdef XKB_HEADERS_PRESENT XkbSelectEvents( _xklDpy, XkbUseCoreKbd, XkbAllEventsMask, 0 ); // XkbSelectEventDetails( _xklDpy, // XkbUseCoreKbd, @@ -75,11 +93,13 @@ int XklPauseListen( ) // 0 ); //!!_XklSelectInput( _xklRootWindow, 0 ); +#endif return 0; } int XklResumeListen( ) { +#ifdef XKB_HEADERS_PRESENT /* What events we want */ #define XKB_EVT_MASK \ (XkbStateNotifyMask| \ @@ -106,7 +126,7 @@ int XklResumeListen( ) XkbUseCoreKbd, XkbNamesNotify, XKB_NAMES_EVT_DTL_MASK, XKB_NAMES_EVT_DTL_MASK ); - +#endif _XklSelectInputMerging( _xklRootWindow, SubstructureNotifyMask | PropertyChangeMask ); _XklGetRealState( &_xklCurState ); @@ -115,7 +135,11 @@ int XklResumeListen( ) unsigned XklGetNumGroups( ) { +#ifdef XKB_HEADERS_PRESENT return _xklXkb->ctrls->num_groups; +#else + return 1; +#endif } #define KBD_MASK \ @@ -127,6 +151,7 @@ unsigned XklGetNumGroups( ) void _XklFreeAllInfo( ) { +#ifdef XKB_HEADERS_PRESENT if( _xklXkb != NULL ) { int i; @@ -140,6 +165,7 @@ void _XklFreeAllInfo( ) XkbFreeKeyboard( _xklXkb, XkbAllComponentsMask, True ); _xklXkb = NULL; } +#endif } /** @@ -147,6 +173,7 @@ void _XklFreeAllInfo( ) */ Bool _XklLoadAllInfo( ) { +#ifdef XKB_HEADERS_PRESENT int i; unsigned bit; Atom *gna; @@ -210,16 +237,18 @@ Bool _XklLoadAllInfo( ) XklDebug( 200, "Real indicators are %X\n", _xklXkb->indicators->phys_indicators ); +#endif if( _xklConfigCallback != NULL ) ( *_xklConfigCallback ) ( _xklConfigCallbackData ); - return True; } void XklLockGroup( int group ) { XklDebug( 100, "Posted request for change the group to %d ##\n", group ); +#ifdef XKB_HEADERS_PRESENT XkbLockGroup( _xklDpy, XkbUseCoreKbd, group ); +#endif XSync( _xklDpy, False ); } @@ -228,9 +257,12 @@ void XklLockGroup( int group ) */ void _XklGetRealState( XklState * curState_return ) { +#ifdef XKB_HEADERS_PRESENT XkbStateRec state; +#endif curState_return->group = 0; +#ifdef XKB_HEADERS_PRESENT if( Success == XkbGetState( _xklDpy, XkbUseCoreKbd, &state ) ) curState_return->group = state.locked_group; @@ -239,6 +271,7 @@ void _XklGetRealState( XklState * curState_return ) &curState_return->indicators ) ) curState_return->indicators &= _xklXkb->indicators->phys_indicators; else +#endif curState_return->indicators = 0; } @@ -248,6 +281,7 @@ void _XklGetRealState( XklState * curState_return ) */ Bool _XklSetIndicator( int indicatorNum, Bool set ) { +#ifdef XKB_HEADERS_PRESENT XkbIndicatorMapPtr map; map = _xklXkb->indicators->maps + indicatorNum; @@ -396,6 +430,6 @@ Bool _XklSetIndicator( int indicatorNum, Bool set ) return True; } } - +#endif return True; } |