summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorZack Middleton <zturtleman@gmail.com>2013-11-26 16:58:56 -0600
committerTim Angus <tim@ngus.net>2014-08-28 11:03:30 +0100
commit482262a75610e63d2a779fea5b37b8206d87e947 (patch)
treede88474519b6f0bea0b42a2294fb45576b3d7e4f /src
parent697bad39e02a5b6e4fb21db8ff1fe497b75cc0cd (diff)
Readd backspace char event for UI VM text fields
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).
Diffstat (limited to 'src')
-rw-r--r--src/client/cl_keys.c10
-rw-r--r--src/sdl/sdl_input.c3
2 files changed, 4 insertions, 9 deletions
diff --git a/src/client/cl_keys.c b/src/client/cl_keys.c
index 191d7fe4..0fbddd23 100644
--- a/src/client/cl_keys.c
+++ b/src/client/cl_keys.c
@@ -438,19 +438,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++;
diff --git a/src/sdl/sdl_input.c b/src/sdl/sdl_input.c
index 473aa65b..c6f52ac9 100644
--- a/src/sdl/sdl_input.c
+++ b/src/sdl/sdl_input.c
@@ -778,6 +778,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;