deprecate --tiny and --small in favor of --tui-tiny and --tui-small

This commit is contained in:
Gwenhael Le Moine 2023-11-04 23:05:18 +01:00
parent 7624a3afc2
commit dda20068bd
No known key found for this signature in database
GPG key ID: FDFE3669426707A7
5 changed files with 100 additions and 63 deletions

4
dist/config.lua vendored
View file

@ -22,13 +22,11 @@ throttle = false
-------------------- --------------------
-- User Interface -- -- User Interface --
-------------------- --------------------
frontend = "x11" -- possible values: "x11", "sdl", "tui" frontend = "x11" -- possible values: "x11", "sdl", "tui", "tui-small", "tui-tiny"
hide_chrome = false hide_chrome = false
fullscreen = false fullscreen = false
mono = false mono = false
gray = false gray = false
small = false
tiny = false
leave_shift_keys = false leave_shift_keys = false
x11_visual = "default" x11_visual = "default"

8
dist/x48ng.man.1 vendored
View file

@ -80,6 +80,10 @@ where options include (depending on compiled front-ends):
\-\-sdl use SDL front-end (default: false) \-\-sdl use SDL front-end (default: false)
.br .br
\-\-tui use terminal front-end (default: false) \-\-tui use terminal front-end (default: false)
.br
\-\-tui\-small use text small front-end (2×2 pixels per character) (default: false)
.br
\-\-tui\-tiny use text tiny front-end (2×2 pixels per character) (default: false)
.br .br
\-t \-\-terminal activate pseudo terminal interface (default: false) \-t \-\-terminal activate pseudo terminal interface (default: false)
.br .br
@ -110,10 +114,6 @@ where options include (depending on compiled front-ends):
\-\-mono make the UI monochrome (default: false) \-\-mono make the UI monochrome (default: false)
.br .br
\-\-gray make the UI grayscale (default: false) \-\-gray make the UI grayscale (default: false)
.br
\-\-small make the text UI small (2×2 pixels per character) (default: false)
.br
\-\-tiny make the text UI tiny (2×4 pixels per character) (default: false)
.br .br
\-\-leave\-shift\-keys _not_ mapping the shift keys to let them free for numbers (default: false) \-\-leave\-shift\-keys _not_ mapping the shift keys to let them free for numbers (default: false)

View file

@ -77,7 +77,7 @@ char normalized_port2_path[ MAX_LENGTH_FILENAME ];
lua_State* config_lua_values; lua_State* config_lua_values;
#ifndef LUA_OK #ifndef LUA_OK
#define LUA_OK 0 # define LUA_OK 0
#endif #endif
static inline bool config_read( const char* filename ) static inline bool config_read( const char* filename )
@ -250,50 +250,52 @@ int parse_args( int argc, char* argv[] )
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, NULL, 9100 },
{ "small", no_argument, NULL, 9109 }, /* DEPRECATED */
{ "tui-small", no_argument, NULL, 9110 },
{ "tiny", no_argument, NULL, 9119 }, /* DEPRECATED */
{ "tui-tiny", no_argument, NULL, 9120 },
{ "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 }, { "leave-shift-keys", no_argument, &clopt_leave_shift_keys, 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 }
}; };
char* help_text = "usage: %s [options]\n" char* help_text = "usage: %s [options]\n"
@ -320,7 +322,11 @@ int parse_args( int argc, char* argv[] )
" -V --verbose be verbose (default: false)\n" " -V --verbose be verbose (default: false)\n"
" --x11 use X11 front-end (default: true)\n" " --x11 use X11 front-end (default: true)\n"
" --sdl use SDL front-end (default: false)\n" " --sdl use SDL front-end (default: false)\n"
" --tui use terminal front-end (default: false)\n" " --tui use text front-end (default: false)\n"
" --tui-small use text small front-end (2×2 pixels per character) (default: "
"false)\n"
" --tui-tiny use text tiny front-end (2×4 pixels per character) (default: "
"false)\n"
" -t --use-terminal activate pseudo terminal interface (default: " " -t --use-terminal activate pseudo terminal interface (default: "
"true)\n" "true)\n"
" -s --use-serial activate serial interface (default: false)\n" " -s --use-serial activate serial interface (default: false)\n"
@ -349,10 +355,6 @@ int parse_args( int argc, char* argv[] )
"false)\n" "false)\n"
" --gray make the UI grayscale (default: " " --gray make the UI grayscale (default: "
"false)\n" "false)\n"
" --small make the text UI small (2×2 pixels per character) (default: "
"false)\n"
" --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: " " --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 ) {
@ -406,6 +408,25 @@ int parse_args( int argc, char* argv[] )
case 8114: case 8114:
clopt_connFont = optarg; clopt_connFont = optarg;
break; break;
case 9100:
clopt_frontend_type = FRONTEND_TEXT;
clopt_small = false;
clopt_tiny = false;
break;
case 9109:
fprintf( stdout, "`--small` is deprecated, please use `--tui-small` instead of `--tui --small`" );
case 9110:
clopt_frontend_type = FRONTEND_TEXT;
clopt_small = true;
clopt_tiny = false;
break;
case 9119:
fprintf( stdout, "`--tiny` is deprecated, please use `--tui-tiny` instead of `--tui --tiny`" );
case 9120:
clopt_frontend_type = FRONTEND_TEXT;
clopt_small = false;
clopt_tiny = true;
break;
case 'V': case 'V':
clopt_verbose = true; clopt_verbose = true;
break; break;
@ -498,8 +519,21 @@ int parse_args( int argc, char* argv[] )
frontend_type = FRONTEND_X11; frontend_type = FRONTEND_X11;
if ( strcmp( svalue, "sdl" ) == 0 ) if ( strcmp( svalue, "sdl" ) == 0 )
frontend_type = FRONTEND_SDL; frontend_type = FRONTEND_SDL;
if ( strcmp( svalue, "tui" ) == 0 ) if ( strcmp( svalue, "tui" ) == 0 ) {
frontend_type = FRONTEND_TEXT; frontend_type = FRONTEND_TEXT;
small = false;
tiny = false;
}
if ( strcmp( svalue, "tui-small" ) == 0 ) {
frontend_type = FRONTEND_TEXT;
small = true;
tiny = false;
}
if ( strcmp( svalue, "tui-tiny" ) == 0 ) {
frontend_type = FRONTEND_TEXT;
small = false;
tiny = true;
}
} }
lua_getglobal( config_lua_values, "hide_chrome" ); lua_getglobal( config_lua_values, "hide_chrome" );
@ -517,9 +551,11 @@ int parse_args( int argc, char* argv[] )
lua_getglobal( config_lua_values, "gray" ); lua_getglobal( config_lua_values, "gray" );
gray = lua_toboolean( config_lua_values, -1 ); gray = lua_toboolean( config_lua_values, -1 );
/* DEPRECATED */
lua_getglobal( config_lua_values, "small" ); lua_getglobal( config_lua_values, "small" );
small = lua_toboolean( config_lua_values, -1 ); small = lua_toboolean( config_lua_values, -1 );
/* DEPRECATED */
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 );
@ -638,16 +674,19 @@ int parse_args( int argc, char* argv[] )
fprintf( stdout, "sdl" ); fprintf( stdout, "sdl" );
break; break;
case FRONTEND_TEXT: case FRONTEND_TEXT:
fprintf( stdout, "tui" ); if ( small )
fprintf( stdout, "tui-small" );
else if ( tiny )
fprintf( stdout, "tui-tiny" );
else
fprintf( stdout, "tui" );
break; break;
} }
fprintf( stdout, "\" -- possible values: \"x11\", \"sdl\", \"tui\"\n" ); fprintf( stdout, "\" -- possible values: \"x11\", \"sdl\", \"tui\", \"tui-small\", \"tui-tiny\"\n" );
fprintf( stdout, "hide_chrome = %s\n", hide_chrome ? "true" : "false" ); fprintf( stdout, "hide_chrome = %s\n", hide_chrome ? "true" : "false" );
fprintf( stdout, "fullscreen = %s\n", show_ui_fullscreen ? "true" : "false" ); fprintf( stdout, "fullscreen = %s\n", show_ui_fullscreen ? "true" : "false" );
fprintf( stdout, "mono = %s\n", mono ? "true" : "false" ); fprintf( stdout, "mono = %s\n", mono ? "true" : "false" );
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, "tiny = %s\n", tiny ? "true" : "false" );
fprintf( stdout, "leave_shift_keys = %s\n", leave_shift_keys ? "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 );

View file

@ -153,24 +153,24 @@ void ( *init_ui )( int argc, char** argv );
void setup_frontend( void ) void setup_frontend( void )
{ {
switch ( frontend_type ) { switch ( frontend_type ) {
#if (defined(HAS_X11)) #if ( defined( HAS_X11 ) )
case FRONTEND_X11: case FRONTEND_X11:
default: default:
init_ui = init_x11_ui; init_ui = init_x11_ui;
break; break;
#endif #endif
#if (defined(HAS_SDL)) #if ( defined( HAS_SDL ) )
case FRONTEND_SDL: case FRONTEND_SDL:
#if (!defined(HAS_X11)) # if ( !defined( HAS_X11 ) )
default: default:
#endif # endif
init_ui = init_sdl_ui; init_ui = init_sdl_ui;
break; break;
#endif #endif
case FRONTEND_TEXT: case FRONTEND_TEXT:
#if (!defined(HAS_X11) && !defined(HAS_SDL)) #if ( !defined( HAS_X11 ) && !defined( HAS_SDL ) )
default: default:
#endif #endif
init_ui = init_text_ui; init_ui = init_text_ui;

View file

@ -2734,37 +2734,37 @@ int decode_key( XEvent* xev, KeySym sym, char* buf, int buflen )
break; break;
case XK_a: case XK_a:
case XK_A: case XK_A:
/* case XK_F1: */ /* case XK_F1: */
key_event( HPKEY_A, xev ); key_event( HPKEY_A, xev );
wake = 1; wake = 1;
break; break;
case XK_b: case XK_b:
case XK_B: case XK_B:
/* case XK_F2: */ /* case XK_F2: */
key_event( HPKEY_B, xev ); key_event( HPKEY_B, xev );
wake = 1; wake = 1;
break; break;
case XK_c: case XK_c:
case XK_C: case XK_C:
/* case XK_F3: */ /* case XK_F3: */
key_event( HPKEY_C, xev ); key_event( HPKEY_C, xev );
wake = 1; wake = 1;
break; break;
case XK_d: case XK_d:
case XK_D: case XK_D:
/* case XK_F4: */ /* case XK_F4: */
key_event( HPKEY_D, xev ); key_event( HPKEY_D, xev );
wake = 1; wake = 1;
break; break;
case XK_e: case XK_e:
case XK_E: case XK_E:
/* case XK_F5: */ /* case XK_F5: */
key_event( HPKEY_E, xev ); key_event( HPKEY_E, xev );
wake = 1; wake = 1;
break; break;
case XK_f: case XK_f:
case XK_F: case XK_F:
/* case XK_F6: */ /* case XK_F6: */
key_event( HPKEY_F, xev ); key_event( HPKEY_F, xev );
wake = 1; wake = 1;
break; break;