00001
00005 #ifndef __XKLAVIER_H__
00006 #define __XKLAVIER_H__
00007
00008 #include <stdarg.h>
00009
00010 #include <X11/Xlib.h>
00011
00012 #ifdef __cplusplus
00013 extern "C"
00014 {
00015 #endif
00016
00017 typedef enum
00018 {
00022 GROUP_CHANGED,
00026 INDICATORS_CHANGED
00027 }
00028 XklStateChange;
00029
00033 #define XKLF_CAN_TOGGLE_INDICATORS 0x01
00034
00038 #define XKLF_CAN_OUTPUT_CONFIG_AS_ASCII 0x02
00039
00043 #define XKLF_CAN_OUTPUT_CONFIG_AS_BINARY 0x04
00044
00048 #define XKLF_MULTIPLE_LAYOUTS_SUPPORTED 0x08
00049
00055 #define XKLF_REQUIRES_MANUAL_LAYOUT_MANAGEMENT 0x10
00056
00060 typedef struct
00061 {
00063 int group;
00065 unsigned indicators;
00066 }
00067 XklState;
00068
00082 extern int XklInit( Display * dpy );
00083
00087 extern int XklTerm( void );
00088
00093 extern const char *XklGetBackendName( void );
00094
00100 extern int XklGetBackendFeatures( void );
00101
00108 extern unsigned XklGetMaxNumGroups( void );
00120 #define XKLL_MANAGE_WINDOW_STATES 0x01
00121
00125 #define XKLL_TRACK_KEYBOARD_STATE 0x02
00126
00131 #define XKLL_MANAGE_LAYOUTS 0x04
00132
00138 extern int XklStartListen( int what );
00139
00144 extern int XklStopListen( void );
00145
00150 extern int XklPauseListen( void );
00151
00156 extern int XklResumeListen( void );
00157
00164 extern Bool XklGrabKey( int keycode, unsigned modifiers );
00165
00172 extern Bool XklUngrabKey( int keycode, unsigned modifiers );
00173
00181 extern int XklFilterEvents( XEvent * evt );
00182
00186 extern void XklAllowOneSwitchToSecondaryGroup( void );
00187
00198 extern Window XklGetCurrentWindow( void );
00199
00204 extern XklState *XklGetCurrentState( void );
00205
00217 extern char *XklGetWindowTitle( Window w );
00218
00226 extern Bool XklGetState( Window win, XklState * state_return );
00227
00232 extern void XklDelState( Window win );
00233
00239 extern void XklSaveState( Window win, XklState * state );
00240
00248 extern void XklSetTransparent( Window win, Bool transparent );
00249
00255 extern Bool XklIsTransparent( Window win );
00256
00263 extern Bool XklIsSameApp( Window win1, Window win2 );
00264
00276 extern unsigned XklGetNumGroups( void );
00277
00283 extern const char **XklGetGroupNames( void );
00284
00290 extern const char **XklGetIndicatorNames( void );
00291
00303 extern int XklGetNextGroup( void );
00304
00309 extern int XklGetPrevGroup( void );
00310
00315 extern int XklGetRestoreGroup( void );
00316
00324 extern void XklLockGroup( int group );
00325
00338 typedef void ( *XklConfigCallback ) ( void *userData );
00339
00346 extern int XklRegisterConfigCallback( XklConfigCallback fun,
00347 void *userData );
00348
00360 typedef int ( *XklWinCallback ) ( Window win, Window parent,
00361 void *userData );
00362
00369 extern int XklRegisterWindowCallback( XklWinCallback fun, void *userData );
00370
00380 typedef void ( *XklStateCallback ) ( XklStateChange changeType, int group,
00381 Bool restore, void *userData );
00382
00389 extern int XklRegisterStateCallback( XklStateCallback fun, void *userData );
00390
00402 extern void XklSetGroupPerApp( Bool isGlobal );
00403
00407 extern Bool XklIsGroupPerApp( void );
00408
00413 extern void XklSetIndicatorsHandling( Bool whetherHandle );
00414
00418 extern Bool XklGetIndicatorsHandling( void );
00419
00426 extern void XklSetSecondaryGroupsMask( int mask );
00427
00431 extern int XklGetSecondaryGroupsMask( void );
00432
00438 extern void XklSetDefaultGroup( int group );
00439
00445 extern int XklGetDefaultGroup( void );
00446
00457 extern const char *XklGetLastError( void );
00458
00469 extern void _XklDebug( const char file[], const char function[], int level,
00470 const char format[], ... );
00471
00486 typedef void ( *XklLogAppender ) ( const char file[], const char function[],
00487 int level, const char format[],
00488 va_list args );
00489
00501 extern void XklDefaultLogAppender( const char file[], const char function[],
00502 int level, const char format[],
00503 va_list args );
00504
00509 extern void XklSetLogAppender( XklLogAppender fun );
00510
00516 extern void XklSetDebugLevel( int level );
00517
00518
00519 #if defined(G_HAVE_GNUC_VARARGS)
00520
00526 #else
00527
00532 #endif
00533 #ifdef G_HAVE_ISO_VARARGS
00534 #define XklDebug( level, ... ) \
00535 _XklDebug( __FILE__, __func__, level, __VA_ARGS__ )
00536 #elif defined(G_HAVE_GNUC_VARARGS)
00537 #define XklDebug( level, format, args... ) \
00538 _XklDebug( __FILE__, __func__, level, format, ## args )
00539 #else
00540 #define XklDebug( level, ... ) \
00541 _XklDebug( __FILE__, __func__, level, __VA_ARGS__ )
00542 #endif
00543
00546 #ifdef __cplusplus
00547 }
00548 #endif
00549
00550 #endif