diff options
author | Sergey Udaltsov <svu@gnome.org> | 2004-06-08 01:20:18 +0000 |
---|---|---|
committer | Sergey Udaltsov <svu@gnome.org> | 2004-06-08 01:20:18 +0000 |
commit | 445f9109d7c297d03e6ffe069d1cb8bfe6319e92 (patch) | |
tree | 60ad0631c847ff3f79ff8e3b55309ae755d7113f | |
parent | b046909a0564a110015d3010e6661dba4142e354 (diff) | |
download | libxklavier-445f9109d7c297d03e6ffe069d1cb8bfe6319e92.tar.gz |
Some little restructuring, more debugging - AND BIG FIX for global mode - we should not read current state from the window focus switched to.
-rw-r--r-- | libxklavier/xklavier_evt.c | 20 | ||||
-rw-r--r-- | libxklavier/xklavier_private.h | 2 | ||||
-rw-r--r-- | libxklavier/xklavier_util.c | 8 |
3 files changed, 23 insertions, 7 deletions
diff --git a/libxklavier/xklavier_evt.c b/libxklavier/xklavier_evt.c index 33e8c23..6369092 100644 --- a/libxklavier/xklavier_evt.c +++ b/libxklavier/xklavier_evt.c @@ -97,8 +97,7 @@ void _XklStdXkbHandler( int grp, XklStateChange changeType, unsigned inds, if( focusedApp != _xklCurClient ) { - _xklCurState.group = grp; - _xklCurState.indicators = inds; + _XklUpdateCurState( grp, inds ); _XklAddAppWindow( focusedApp, ( Window ) NULL, False, &_xklCurState ); _xklCurClient = focusedApp; @@ -111,8 +110,8 @@ void _XklStdXkbHandler( int grp, XklStateChange changeType, unsigned inds, if( setGroup || haveState ) { - _xklCurState.group = setGroup ? grp : oldState.group; - _xklCurState.indicators = setInds ? inds : oldState.indicators; + _XklUpdateCurState( setGroup ? grp : oldState.group, + setInds ? inds : oldState.indicators ); } if( haveState ) @@ -147,8 +146,15 @@ void _XklXkbEvHandler( XkbEvent * kev ) if( kev->state.changed & GROUP_CHANGE_MASK ) _XklStdXkbHandler( kev->state.locked_group, GROUP_CHANGED, 0, False ); else + { XklDebug( 200, "This type of state notification is not regarding groups\n" ); + if ( kev->state.locked_group != _xklCurState.group ) + XklDebug( 0, + "ATTENTION! Currently cached group %d is not equal to the current group from the event: %d\n!", + _xklCurState.group, + kev->state.locked_group ); + } break; @@ -244,10 +250,10 @@ void _XklFocusInEvHandler( XFocusChangeEvent * fev ) /** * For fast mouse movements - the state is probably not updated yet * (because of the group change notification being late). - * so we'll enforce the update. + * so we'll enforce the update. But this should only happen in GPA mode */ - if( XklGetState( _xklCurClient, &tmpState ) ) - _xklCurState = tmpState; + if( XklIsGroupPerApp() && XklGetState( _xklCurClient, &tmpState ) ) + _XklUpdateCurState( tmpState.group, tmpState.indicators ); _xklCurClient = appWin; XklDebug( 150, "CurClient:changed to " WINID_FORMAT ", '%s'\n", diff --git a/libxklavier/xklavier_private.h b/libxklavier/xklavier_private.h index 6707450..260cf48 100644 --- a/libxklavier/xklavier_private.h +++ b/libxklavier/xklavier_private.h @@ -77,6 +77,8 @@ extern const char *_XklGetEventName( int type ); extern Bool _XklIsTransparentAppWindow( Window appWin ); +extern void _XklUpdateCurState( int group, unsigned indicators ); + extern Display *_xklDpy; extern Window _xklRootWindow; diff --git a/libxklavier/xklavier_util.c b/libxklavier/xklavier_util.c index b555c43..7385fec 100644 --- a/libxklavier/xklavier_util.c +++ b/libxklavier/xklavier_util.c @@ -256,3 +256,11 @@ const char *_XklGetEventName( int type ) return NULL; return evtNames[type]; } + +void _XklUpdateCurState( int group, unsigned indicators ) +{ + XklDebug( 150, + "Updating the current state with [%d:%u]\n", group, indicators ); + _xklCurState.group = group; + _xklCurState.indicators = indicators; +} |