From d2458ff5d3f8194a5822ad38210c0e51fd92af0e Mon Sep 17 00:00:00 2001 From: Geoffrey McRae Date: Tue, 19 Jan 2021 03:08:56 +1100 Subject: [PATCH] [client] retain backwards compatibillity for the capture keycode This is an ugly hack for now that will get us over the line for Beta 3, after which will need to be addressed and people will need to be informed that their configured escape key will have changed. --- client/displayservers/SDL/kb.h | 4 +++- client/src/config.c | 10 +++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/client/displayservers/SDL/kb.h b/client/displayservers/SDL/kb.h index a9dfdd85..ff0644d6 100644 --- a/client/displayservers/SDL/kb.h +++ b/client/displayservers/SDL/kb.h @@ -20,7 +20,9 @@ Place, Suite 330, Boston, MA 02111-1307 USA #include #include -static uint32_t sdl_to_xfree86[SDL_NUM_SCANCODES] = +//FIXME: this should be made static once config.c is no longer using SDL +//scancodes +uint32_t sdl_to_xfree86[SDL_NUM_SCANCODES] = { [SDL_SCANCODE_UNKNOWN] /* = USB 0 */ = KEY_RESERVED, [SDL_SCANCODE_A] /* = USB 4 */ = KEY_A, diff --git a/client/src/config.c b/client/src/config.c index 5e99610c..0ed5548a 100644 --- a/client/src/config.c +++ b/client/src/config.c @@ -27,6 +27,10 @@ Place, Suite 330, Boston, MA 02111-1307 USA #include #include +//FIXME: this should really not be included here and is an ugly hack to retain +//backwards compatibility with the escape key scancode +extern uint32_t sdl_to_xfree86[]; + // forwards static bool optRendererParse (struct Option * opt, const char * str); static StringList optRendererValues (struct Option * opt); @@ -528,6 +532,9 @@ bool config_load(int argc, char * argv[]) params.alwaysShowCursor = option_get_bool("spice", "alwaysShowCursor"); } + //FIXME, this should be using linux keycodes + params.escapeKey = sdl_to_xfree86[params.escapeKey]; + return true; } @@ -678,7 +685,8 @@ static char * optSizeToString(struct Option * opt) static char * optScancodeToString(struct Option * opt) { char * str; - alloc_sprintf(&str, "%d = %s", opt->value.x_int, SDL_GetScancodeName(opt->value.x_int)); + alloc_sprintf(&str, "%d = %s", opt->value.x_int, + SDL_GetScancodeName(opt->value.x_int)); return str; }