add a --leave-shift-keys, remove DONT_SHADOW_SHIFTS. refine #13
This commit is contained in:
parent
a79bbf5a38
commit
0a899ecdc5
7 changed files with 69 additions and 50 deletions
5
Makefile
5
Makefile
|
@ -33,11 +33,6 @@ 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 \
|
||||||
|
|
1
dist/config.lua
vendored
1
dist/config.lua
vendored
|
@ -29,6 +29,7 @@ mono = false
|
||||||
gray = false
|
gray = false
|
||||||
small = false
|
small = false
|
||||||
tiny = false
|
tiny = false
|
||||||
|
leave_shift_keys = false
|
||||||
|
|
||||||
x11_visual = "default"
|
x11_visual = "default"
|
||||||
netbook = false
|
netbook = false
|
||||||
|
|
13
dist/x48ng.man.1
vendored
13
dist/x48ng.man.1
vendored
|
@ -61,15 +61,15 @@ where options include (depending on compiled front-ends):
|
||||||
.br
|
.br
|
||||||
\-\-config\-dir=<path> use <path> as x48ng's home (default: ~/.config/x48ng/)
|
\-\-config\-dir=<path> use <path> as x48ng's home (default: ~/.config/x48ng/)
|
||||||
.br
|
.br
|
||||||
\-\-rom=<filename> use <filename> (absolute or relative to <config\-dir>) as ROM (default: rom)
|
\-\-rom=<filename> use <filename> (absolute or relative to <config\-dir>) as ROM (default: rom)
|
||||||
.br
|
.br
|
||||||
\-\-ram=<filename> use <filename> (absolute or relative to <config\-dir>) as RAM (default: ram)
|
\-\-ram=<filename> use <filename> (absolute or relative to <config\-dir>) as RAM (default: ram)
|
||||||
.br
|
.br
|
||||||
\-\-state=<filename> use <filename> (absolute or relative to <config\-dir>) as STATE (default: hp48)
|
\-\-state=<filename> use <filename> (absolute or relative to <config\-dir>) as STATE (default: hp48)
|
||||||
.br
|
.br
|
||||||
\-\-port1=<filename> use <filename> (absolute or relative to <config\-dir>) as PORT1 (default: port1)
|
\-\-port1=<filename> use <filename> (absolute or relative to <config\-dir>) as PORT1 (default: port1)
|
||||||
.br
|
.br
|
||||||
\-\-port2=<filename> use <filename> (absolute or relative to <config\-dir>) as PORT2 (default: port2)
|
\-\-port2=<filename> use <filename> (absolute or relative to <config\-dir>) as PORT2 (default: port2)
|
||||||
.br
|
.br
|
||||||
\-\-serial\-line=<path> use <path> as serial device default: /dev/ttyS0)
|
\-\-serial\-line=<path> use <path> as serial device default: /dev/ttyS0)
|
||||||
.br
|
.br
|
||||||
|
@ -114,6 +114,9 @@ where options include (depending on compiled front-ends):
|
||||||
\-\-small make the text UI small (2×2 pixels per character) (default: false)
|
\-\-small make the text UI small (2×2 pixels per character) (default: false)
|
||||||
.br
|
.br
|
||||||
\-\-tiny make the text UI tiny (2×4 pixels per character) (default: false)
|
\-\-tiny make the text UI tiny (2×4 pixels per character) (default: false)
|
||||||
|
.br
|
||||||
|
\-\-leave\-shift\-keys _not_ mapping the shift keys to let them free for numbers (default: false)
|
||||||
|
|
||||||
|
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
.I x48ng
|
.I x48ng
|
||||||
|
|
|
@ -37,6 +37,8 @@ char* port2FileName = NULL;
|
||||||
|
|
||||||
int frontend_type = FRONTEND_TEXT;
|
int frontend_type = FRONTEND_TEXT;
|
||||||
|
|
||||||
|
bool leave_shift_keys = false;
|
||||||
|
|
||||||
bool mono = false;
|
bool mono = false;
|
||||||
bool gray = false;
|
bool gray = false;
|
||||||
|
|
||||||
|
@ -244,50 +246,52 @@ int parse_args( int argc, char* argv[] )
|
||||||
int clopt_gray = -1;
|
int clopt_gray = -1;
|
||||||
int clopt_small = -1;
|
int clopt_small = -1;
|
||||||
int clopt_tiny = -1;
|
int clopt_tiny = -1;
|
||||||
|
int clopt_leave_shift_keys = -1;
|
||||||
|
|
||||||
char* optstring = "c:hvVtsirT";
|
char* optstring = "c:hvVtsirT";
|
||||||
struct option long_options[] = {
|
struct option long_options[] = {
|
||||||
{"config", required_argument, NULL, 'c' },
|
{"config", required_argument, NULL, 'c' },
|
||||||
{ "config-dir", required_argument, NULL, 1000 },
|
{ "config-dir", required_argument, NULL, 1000 },
|
||||||
{ "rom", required_argument, NULL, 1010 },
|
{ "rom", required_argument, NULL, 1010 },
|
||||||
{ "ram", required_argument, NULL, 1011 },
|
{ "ram", required_argument, NULL, 1011 },
|
||||||
{ "state", required_argument, NULL, 1012 },
|
{ "state", required_argument, NULL, 1012 },
|
||||||
{ "port1", required_argument, NULL, 1013 },
|
{ "port1", required_argument, NULL, 1013 },
|
||||||
{ "port2", required_argument, NULL, 1014 },
|
{ "port2", required_argument, NULL, 1014 },
|
||||||
|
|
||||||
{ "serial-line", required_argument, NULL, 1015 },
|
{ "serial-line", required_argument, NULL, 1015 },
|
||||||
|
|
||||||
{ "help", no_argument, NULL, 'h' },
|
{ "help", no_argument, NULL, 'h' },
|
||||||
{ "version", no_argument, NULL, 'v' },
|
{ "version", no_argument, NULL, 'v' },
|
||||||
|
|
||||||
{ "print-config", no_argument, ( int* )&print_config, true },
|
{ "print-config", no_argument, ( int* )&print_config, true },
|
||||||
{ "verbose", no_argument, &clopt_verbose, true },
|
{ "verbose", no_argument, &clopt_verbose, true },
|
||||||
{ "terminal", no_argument, &clopt_useTerminal, true },
|
{ "terminal", no_argument, &clopt_useTerminal, true },
|
||||||
{ "serial", no_argument, &clopt_useSerial, true },
|
{ "serial", no_argument, &clopt_useSerial, true },
|
||||||
|
|
||||||
{ "reset", no_argument, ( int* )&resetOnStartup, true },
|
{ "reset", no_argument, ( int* )&resetOnStartup, true },
|
||||||
{ "throttle", no_argument, &clopt_throttle, true },
|
{ "throttle", no_argument, &clopt_throttle, true },
|
||||||
|
|
||||||
{ "debug", no_argument, &clopt_useDebugger, true },
|
{ "debug", no_argument, &clopt_useDebugger, true },
|
||||||
|
|
||||||
{ "sdl", no_argument, &clopt_frontend_type, FRONTEND_SDL },
|
{ "sdl", no_argument, &clopt_frontend_type, FRONTEND_SDL },
|
||||||
{ "no-chrome", no_argument, &clopt_hide_chrome, true },
|
{ "no-chrome", no_argument, &clopt_hide_chrome, true },
|
||||||
{ "fullscreen", no_argument, &clopt_show_ui_fullscreen, true },
|
{ "fullscreen", no_argument, &clopt_show_ui_fullscreen, true },
|
||||||
|
|
||||||
{ "x11", no_argument, &clopt_frontend_type, FRONTEND_X11 },
|
{ "x11", no_argument, &clopt_frontend_type, FRONTEND_X11 },
|
||||||
{ "netbook", no_argument, &clopt_netbook, true },
|
{ "netbook", no_argument, &clopt_netbook, true },
|
||||||
{ "visual", required_argument, NULL, 8110 },
|
{ "visual", required_argument, NULL, 8110 },
|
||||||
{ "small-font", required_argument, NULL, 8111 },
|
{ "small-font", required_argument, NULL, 8111 },
|
||||||
{ "medium-font", required_argument, NULL, 8112 },
|
{ "medium-font", required_argument, NULL, 8112 },
|
||||||
{ "large-font", required_argument, NULL, 8113 },
|
{ "large-font", required_argument, NULL, 8113 },
|
||||||
{ "connection-font", required_argument, NULL, 8114 },
|
{ "connection-font", required_argument, NULL, 8114 },
|
||||||
|
|
||||||
{ "tui", no_argument, &clopt_frontend_type, FRONTEND_TEXT},
|
{ "tui", no_argument, &clopt_frontend_type, FRONTEND_TEXT},
|
||||||
|
|
||||||
{ "mono", no_argument, &clopt_mono, true },
|
{ "mono", no_argument, &clopt_mono, true },
|
||||||
{ "gray", no_argument, &clopt_gray, true },
|
{ "gray", no_argument, &clopt_gray, true },
|
||||||
{ "small", no_argument, &clopt_small, true },
|
{ "small", no_argument, &clopt_small, true },
|
||||||
{ "tiny", no_argument, &clopt_tiny, true },
|
{ "tiny", no_argument, &clopt_tiny, true },
|
||||||
|
{ "leave-shift-keys", no_argument, &clopt_leave_shift_keys, true },
|
||||||
|
|
||||||
{ 0, 0, 0, 0 }
|
{ 0, 0, 0, 0 }
|
||||||
};
|
};
|
||||||
|
@ -348,6 +352,8 @@ int parse_args( int argc, char* argv[] )
|
||||||
" --small make the text UI small (2×2 pixels per character) (default: "
|
" --small make the text UI small (2×2 pixels per character) (default: "
|
||||||
"false)\n"
|
"false)\n"
|
||||||
" --tiny make the text UI tiny (2×4 pixels per character) (default: "
|
" --tiny make the text UI tiny (2×4 pixels per character) (default: "
|
||||||
|
"false)\n"
|
||||||
|
" --leave-shift-keys _not_ mapping the shift keys to let them free for numbers (default: "
|
||||||
"false)\n";
|
"false)\n";
|
||||||
while ( c != EOF ) {
|
while ( c != EOF ) {
|
||||||
c = getopt_long( argc, argv, optstring, long_options, &option_index );
|
c = getopt_long( argc, argv, optstring, long_options, &option_index );
|
||||||
|
@ -517,6 +523,9 @@ int parse_args( int argc, char* argv[] )
|
||||||
lua_getglobal( config_lua_values, "tiny" );
|
lua_getglobal( config_lua_values, "tiny" );
|
||||||
tiny = lua_toboolean( config_lua_values, -1 );
|
tiny = lua_toboolean( config_lua_values, -1 );
|
||||||
|
|
||||||
|
lua_getglobal( config_lua_values, "leave_shift_keys" );
|
||||||
|
leave_shift_keys = lua_toboolean( config_lua_values, -1 );
|
||||||
|
|
||||||
lua_getglobal( config_lua_values, "x11_visual" );
|
lua_getglobal( config_lua_values, "x11_visual" );
|
||||||
x11_visual = ( char* )luaL_optstring( config_lua_values, -1, "default" );
|
x11_visual = ( char* )luaL_optstring( config_lua_values, -1, "default" );
|
||||||
|
|
||||||
|
@ -586,6 +595,8 @@ int parse_args( int argc, char* argv[] )
|
||||||
small = clopt_small;
|
small = clopt_small;
|
||||||
if ( clopt_tiny != -1 )
|
if ( clopt_tiny != -1 )
|
||||||
tiny = clopt_tiny;
|
tiny = clopt_tiny;
|
||||||
|
if ( clopt_leave_shift_keys != -1 )
|
||||||
|
leave_shift_keys = clopt_leave_shift_keys;
|
||||||
|
|
||||||
/* After getting configs and params */
|
/* After getting configs and params */
|
||||||
/* normalize config_dir again in case it's been modified */
|
/* normalize config_dir again in case it's been modified */
|
||||||
|
@ -637,6 +648,7 @@ int parse_args( int argc, char* argv[] )
|
||||||
fprintf( stdout, "gray = %s\n", gray ? "true" : "false" );
|
fprintf( stdout, "gray = %s\n", gray ? "true" : "false" );
|
||||||
fprintf( stdout, "small = %s\n", small ? "true" : "false" );
|
fprintf( stdout, "small = %s\n", small ? "true" : "false" );
|
||||||
fprintf( stdout, "tiny = %s\n", tiny ? "true" : "false" );
|
fprintf( stdout, "tiny = %s\n", tiny ? "true" : "false" );
|
||||||
|
fprintf( stdout, "leave_shift_keys = %s\n", leave_shift_keys ? "true" : "false" );
|
||||||
fprintf( stdout, "\n" );
|
fprintf( stdout, "\n" );
|
||||||
fprintf( stdout, "x11_visual = \"%s\"\n", x11_visual );
|
fprintf( stdout, "x11_visual = \"%s\"\n", x11_visual );
|
||||||
fprintf( stdout, "netbook = %s\n", netbook ? "true" : "false" );
|
fprintf( stdout, "netbook = %s\n", netbook ? "true" : "false" );
|
||||||
|
|
|
@ -19,6 +19,8 @@ extern int frontend_type;
|
||||||
|
|
||||||
extern char* serialLine;
|
extern char* serialLine;
|
||||||
|
|
||||||
|
extern bool leave_shift_keys;
|
||||||
|
|
||||||
extern bool mono;
|
extern bool mono;
|
||||||
extern bool gray;
|
extern bool gray;
|
||||||
|
|
||||||
|
|
|
@ -708,14 +708,14 @@ 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;
|
if ( !leave_shift_keys )
|
||||||
|
return HPKEY_SHL;
|
||||||
break;
|
break;
|
||||||
case SDLK_RSHIFT:
|
case SDLK_RSHIFT:
|
||||||
return HPKEY_SHR;
|
if ( !leave_shift_keys )
|
||||||
|
return HPKEY_SHR;
|
||||||
break;
|
break;
|
||||||
#endif
|
|
||||||
case SDLK_LCTRL:
|
case SDLK_LCTRL:
|
||||||
return HPKEY_SHR;
|
return HPKEY_SHR;
|
||||||
break;
|
break;
|
||||||
|
|
14
src/ui_x11.c
14
src/ui_x11.c
|
@ -2700,16 +2700,22 @@ 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
|
if ( !leave_shift_keys ) {
|
||||||
|
key_event( HPKEY_SHL, xev );
|
||||||
|
wake = 1;
|
||||||
|
}
|
||||||
|
break;
|
||||||
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
|
if ( !leave_shift_keys ) {
|
||||||
|
key_event( HPKEY_SHR, xev );
|
||||||
|
wake = 1;
|
||||||
|
}
|
||||||
|
break;
|
||||||
case XK_Control_L:
|
case XK_Control_L:
|
||||||
key_event( HPKEY_SHR, xev );
|
key_event( HPKEY_SHR, xev );
|
||||||
wake = 1;
|
wake = 1;
|
||||||
|
|
Loading…
Reference in a new issue