mirror of
https://github.com/UberGames/ioef.git
synced 2024-12-01 08:31:44 +00:00
* Handle dead keys more gracefully by taking a "best guess" rather than ignoring
completely * When activating or deactivating the mouse flush any pending motion events; this should stop the view moving unpredictably in these circumstances * Add keyname completion to "unbind"
This commit is contained in:
parent
a6382d2d9b
commit
36a43f2aa1
2 changed files with 54 additions and 15 deletions
|
@ -3333,6 +3333,14 @@ static void Field_CompleteCommand( char *cmd,
|
||||||
Field_CompleteCommand( p, qtrue, qtrue );
|
Field_CompleteCommand( p, qtrue, qtrue );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if( !Q_stricmp( baseCmd, "unbind" ) && completionArgument == 2 )
|
||||||
|
{
|
||||||
|
// Skip "unbind "
|
||||||
|
p = Com_SkipTokens( cmd, 1, " " );
|
||||||
|
|
||||||
|
if( p > cmd )
|
||||||
|
Field_CompleteKeyname( );
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -218,7 +218,9 @@ static const char *IN_TranslateSDLToQ3Key( SDL_keysym *keysym,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( down && !( keysym->unicode & 0xFF80 ) )
|
if( down )
|
||||||
|
{
|
||||||
|
if( keysym->unicode && !( keysym->unicode & 0xFF80 ) )
|
||||||
{
|
{
|
||||||
char ch = (char)keysym->unicode & 0x7F;
|
char ch = (char)keysym->unicode & 0x7F;
|
||||||
|
|
||||||
|
@ -239,6 +241,16 @@ static const char *IN_TranslateSDLToQ3Key( SDL_keysym *keysym,
|
||||||
default: *buf = ch; break;
|
default: *buf = ch; break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Unicode character which isn't ASCII, possibly the character
|
||||||
|
// following a dead key. Fallback on what SDL calls the key
|
||||||
|
|
||||||
|
const char *keyString = SDL_GetKeyName( keysym->sym );
|
||||||
|
if( strlen( keyString ) == 1 )
|
||||||
|
*buf = *keyString;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Never allow a '~' SE_CHAR event to be generated
|
// Never allow a '~' SE_CHAR event to be generated
|
||||||
if( *key == '~' )
|
if( *key == '~' )
|
||||||
|
@ -278,6 +290,21 @@ static io_connect_t IN_GetIOHandle(void) // mac os x mouse accel hack
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
===============
|
||||||
|
IN_GobbleMotionEvents
|
||||||
|
===============
|
||||||
|
*/
|
||||||
|
static void IN_GobbleMotionEvents( void )
|
||||||
|
{
|
||||||
|
SDL_Event dummy[ 1 ];
|
||||||
|
|
||||||
|
// Gobble any mouse motion events
|
||||||
|
SDL_PumpEvents( );
|
||||||
|
while( SDL_PeepEvents( dummy, 1, SDL_GETEVENT,
|
||||||
|
SDL_EVENTMASK( SDL_MOUSEMOTION ) ) ) { }
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
===============
|
===============
|
||||||
IN_ActivateMouse
|
IN_ActivateMouse
|
||||||
|
@ -333,6 +360,8 @@ static void IN_ActivateMouse( void )
|
||||||
SDL_ShowCursor( 0 );
|
SDL_ShowCursor( 0 );
|
||||||
#endif
|
#endif
|
||||||
SDL_WM_GrabInput( SDL_GRAB_ON );
|
SDL_WM_GrabInput( SDL_GRAB_ON );
|
||||||
|
|
||||||
|
IN_GobbleMotionEvents( );
|
||||||
}
|
}
|
||||||
|
|
||||||
// in_nograb makes no sense in fullscreen mode
|
// in_nograb makes no sense in fullscreen mode
|
||||||
|
@ -391,6 +420,8 @@ static void IN_DeactivateMouse( void )
|
||||||
|
|
||||||
if( mouseActive )
|
if( mouseActive )
|
||||||
{
|
{
|
||||||
|
IN_GobbleMotionEvents( );
|
||||||
|
|
||||||
SDL_WM_GrabInput( SDL_GRAB_OFF );
|
SDL_WM_GrabInput( SDL_GRAB_OFF );
|
||||||
|
|
||||||
// Don't warp the mouse unless the cursor is within the window
|
// Don't warp the mouse unless the cursor is within the window
|
||||||
|
|
Loading…
Reference in a new issue