Skip to content

Commit

Permalink
Readd backspace char event for UI VM text fields
Browse files Browse the repository at this point in the history
UI VMs expect a backspace char event, but sdl2 branch only was only sending a key event.
Revert cl_keys.c to master branch (it would cause backspace to happen twice in console).
  • Loading branch information
zturtleman committed Nov 26, 2013
1 parent ad514c9 commit 952fd04
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
10 changes: 1 addition & 9 deletions code/client/cl_keys.c
Expand Up @@ -441,19 +441,11 @@ void Field_KeyDownEvent( field_t *edit, int key ) {
switch ( key ) {
case K_DEL:
if ( edit->cursor < len ) {
memmove( edit->buffer + edit->cursor,
memmove( edit->buffer + edit->cursor,
edit->buffer + edit->cursor + 1, len - edit->cursor );
}
break;

case K_BACKSPACE:
if ( edit->cursor > 0 ) {
memmove( edit->buffer + edit->cursor - 1,
edit->buffer + edit->cursor, len + 1 - edit->cursor );
edit->cursor--;
}
break;

case K_RIGHTARROW:
if ( edit->cursor < len ) {
edit->cursor++;
Expand Down
3 changes: 3 additions & 0 deletions code/sdl/sdl_input.c
Expand Up @@ -729,6 +729,9 @@ static void IN_ProcessEvents( void )
if( ( key = IN_TranslateSDLToQ3Key( &e.key.keysym, qtrue ) ) )
Com_QueueEvent( 0, SE_KEY, key, qtrue, 0, NULL );

if( key == K_BACKSPACE )
Com_QueueEvent( 0, SE_CHAR, CTRL('h'), 0, 0, NULL );

lastKeyDown = key;
break;

Expand Down

0 comments on commit 952fd04

Please sign in to comment.