From 93030325bf2a6eb0a3aecd1c9974f677ed9b9015 Mon Sep 17 00:00:00 2001 From: Gwenhael Le Moine Date: Sun, 22 Oct 2023 18:28:43 +0200 Subject: [PATCH] =?UTF-8?q?`make=20DONT=5FSHADOW=5FSHIFTS=3Dyes`=20makes?= =?UTF-8?q?=20a=20binary=20that=20doesn=C2=B4t=20=20use=20Shift=20keys?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Makefile | 5 +++++ src/ui_sdl.c | 6 ++++-- src/ui_x11.c | 4 ++++ 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 977973e..e2982bd 100644 --- a/Makefile +++ b/Makefile @@ -29,6 +29,11 @@ ifeq ($(FULL_WARNINGS), yes) CFLAGS += -Wall -Wextra -Wpedantic -Wno-unused-parameter -Wno-unused-function -Wconversion -Wdouble-promotion -Wno-sign-conversion -fsanitize=undefined -fsanitize-trap endif +DONT_SHADOW_SHIFTS = no +ifeq ($(DONT_SHADOW_SHIFTS), yes) + CFLAGS += -DDONT_SHADOW_SHIFTS=1 +endif + DOTOS = src/emu_serial.o \ src/emu_emulate.o \ src/emu_init.o \ diff --git a/src/ui_sdl.c b/src/ui_sdl.c index 323e892..7cac7b3 100644 --- a/src/ui_sdl.c +++ b/src/ui_sdl.c @@ -708,17 +708,19 @@ static int SDLKeyToKey( SDLKey k ) case SDLK_ESCAPE: return HPKEY_ON; break; +#ifndef DONT_SHADOW_SHIFTS case SDLK_LSHIFT: return HPKEY_SHL; break; case SDLK_RSHIFT: - return HPKEY_SHL; + return HPKEY_SHR; break; +#endif case SDLK_LCTRL: return HPKEY_SHR; break; case SDLK_RCTRL: - return HPKEY_SHR; + return HPKEY_SHL; break; case SDLK_LALT: return HPKEY_ALPHA; diff --git a/src/ui_x11.c b/src/ui_x11.c index d441f96..0fb4900 100644 --- a/src/ui_x11.c +++ b/src/ui_x11.c @@ -2700,12 +2700,16 @@ int decode_key( XEvent* xev, KeySym sym, char* buf, int buflen ) key_event( HPKEY_ON, xev ); wake = 1; break; +#ifndef DONT_SHADOW_SHIFTS case XK_Shift_L: +#endif case XK_Control_R: key_event( HPKEY_SHL, xev ); wake = 1; break; +#ifndef DONT_SHADOW_SHIFTS case XK_Shift_R: +#endif case XK_Control_L: key_event( HPKEY_SHR, xev ); wake = 1;