make DONT_SHADOW_SHIFTS=yes makes a binary that doesn´t use Shift keys

This commit is contained in:
Gwenhael Le Moine 2023-10-22 18:28:43 +02:00
parent 833baaa5ba
commit 93030325bf
No known key found for this signature in database
GPG key ID: FDFE3669426707A7
3 changed files with 13 additions and 2 deletions

View file

@ -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 CFLAGS += -Wall -Wextra -Wpedantic -Wno-unused-parameter -Wno-unused-function -Wconversion -Wdouble-promotion -Wno-sign-conversion -fsanitize=undefined -fsanitize-trap
endif endif
DONT_SHADOW_SHIFTS = no
ifeq ($(DONT_SHADOW_SHIFTS), yes)
CFLAGS += -DDONT_SHADOW_SHIFTS=1
endif
DOTOS = src/emu_serial.o \ DOTOS = src/emu_serial.o \
src/emu_emulate.o \ src/emu_emulate.o \
src/emu_init.o \ src/emu_init.o \

View file

@ -708,17 +708,19 @@ static int SDLKeyToKey( SDLKey k )
case SDLK_ESCAPE: case SDLK_ESCAPE:
return HPKEY_ON; return HPKEY_ON;
break; break;
#ifndef DONT_SHADOW_SHIFTS
case SDLK_LSHIFT: case SDLK_LSHIFT:
return HPKEY_SHL; return HPKEY_SHL;
break; break;
case SDLK_RSHIFT: case SDLK_RSHIFT:
return HPKEY_SHL; return HPKEY_SHR;
break; break;
#endif
case SDLK_LCTRL: case SDLK_LCTRL:
return HPKEY_SHR; return HPKEY_SHR;
break; break;
case SDLK_RCTRL: case SDLK_RCTRL:
return HPKEY_SHR; return HPKEY_SHL;
break; break;
case SDLK_LALT: case SDLK_LALT:
return HPKEY_ALPHA; return HPKEY_ALPHA;

View file

@ -2700,12 +2700,16 @@ int decode_key( XEvent* xev, KeySym sym, char* buf, int buflen )
key_event( HPKEY_ON, xev ); key_event( HPKEY_ON, xev );
wake = 1; wake = 1;
break; break;
#ifndef DONT_SHADOW_SHIFTS
case XK_Shift_L: case XK_Shift_L:
#endif
case XK_Control_R: case XK_Control_R:
key_event( HPKEY_SHL, xev ); key_event( HPKEY_SHL, xev );
wake = 1; wake = 1;
break; break;
#ifndef DONT_SHADOW_SHIFTS
case XK_Shift_R: case XK_Shift_R:
#endif
case XK_Control_L: case XK_Control_L:
key_event( HPKEY_SHR, xev ); key_event( HPKEY_SHR, xev );
wake = 1; wake = 1;