[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.
This commit is contained in:
Geoffrey McRae 2021-01-19 03:08:56 +11:00
parent 8a1578230f
commit d2458ff5d3
2 changed files with 12 additions and 2 deletions

View File

@ -20,7 +20,9 @@ Place, Suite 330, Boston, MA 02111-1307 USA
#include <linux/input.h> #include <linux/input.h>
#include <SDL2/SDL.h> #include <SDL2/SDL.h>
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_UNKNOWN] /* = USB 0 */ = KEY_RESERVED,
[SDL_SCANCODE_A] /* = USB 4 */ = KEY_A, [SDL_SCANCODE_A] /* = USB 4 */ = KEY_A,

View File

@ -27,6 +27,10 @@ Place, Suite 330, Boston, MA 02111-1307 USA
#include <pwd.h> #include <pwd.h>
#include <unistd.h> #include <unistd.h>
//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 // forwards
static bool optRendererParse (struct Option * opt, const char * str); static bool optRendererParse (struct Option * opt, const char * str);
static StringList optRendererValues (struct Option * opt); static StringList optRendererValues (struct Option * opt);
@ -528,6 +532,9 @@ bool config_load(int argc, char * argv[])
params.alwaysShowCursor = option_get_bool("spice", "alwaysShowCursor"); params.alwaysShowCursor = option_get_bool("spice", "alwaysShowCursor");
} }
//FIXME, this should be using linux keycodes
params.escapeKey = sdl_to_xfree86[params.escapeKey];
return true; return true;
} }
@ -678,7 +685,8 @@ static char * optSizeToString(struct Option * opt)
static char * optScancodeToString(struct Option * opt) static char * optScancodeToString(struct Option * opt)
{ {
char * str; 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; return str;
} }