more or less revert 247d0cc
, don't have the energy to chase this weird bug where in x11 and sdl pressing F7 to exit needs an extra key to be pressed to actually work. please_exit
code is just commented away to maybe come back to it later on.
This commit is contained in:
parent
ed04ae3a7a
commit
0653be5951
9 changed files with 44 additions and 19 deletions
|
@ -3571,7 +3571,8 @@ static void cmd_exit( int argc, char** argv )
|
|||
printf( "Exit.\n" );
|
||||
|
||||
save_before_exit = false;
|
||||
please_exit = true;
|
||||
// please_exit = true;
|
||||
close_and_exit();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3581,7 +3582,8 @@ static void cmd_quit( int argc, char** argv )
|
|||
printf( "Exit.\n" );
|
||||
|
||||
save_before_exit = true;
|
||||
please_exit = true;
|
||||
// please_exit = true;
|
||||
close_and_exit();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4072,7 +4074,7 @@ int debug( void )
|
|||
if ( config.verbose )
|
||||
printf( "usnterrupt (SIGINT) ignored\n" );
|
||||
|
||||
please_exit = true;
|
||||
// please_exit = true;
|
||||
|
||||
if ( enter_debugger & BREAKPOINT_HIT )
|
||||
if ( config.verbose )
|
||||
|
@ -4183,7 +4185,7 @@ int debug( void )
|
|||
}
|
||||
in_debugger = false;
|
||||
|
||||
} while ( !continue_flag && !please_exit );
|
||||
} while ( !continue_flag /* && !please_exit */ );
|
||||
|
||||
/*
|
||||
* adjust the hp48's timers
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
#define RAM_SIZE_SX 0x10000
|
||||
#define RAM_SIZE_GX 0x40000
|
||||
|
||||
bool please_exit = false;
|
||||
// bool please_exit = false;
|
||||
bool save_before_exit = true;
|
||||
|
||||
bool rom_is_new = true;
|
||||
|
@ -1001,7 +1001,7 @@ void init_display( void )
|
|||
|
||||
void start_emulator( void )
|
||||
{
|
||||
please_exit = false;
|
||||
// please_exit = false;
|
||||
save_before_exit = true;
|
||||
|
||||
/* If files are successfully read => return and let's go */
|
||||
|
|
|
@ -287,7 +287,7 @@ extern void reset_timer( int timer );
|
|||
/**************/
|
||||
extern hpkey_t keyboard[ NB_KEYS ];
|
||||
extern int annunciators_bits[ NB_ANNUNCIATORS ];
|
||||
extern bool please_exit;
|
||||
// extern bool please_exit;
|
||||
extern bool save_before_exit;
|
||||
|
||||
extern void start_emulator( void ); /* used in main.c */
|
||||
|
|
|
@ -152,11 +152,16 @@ int main( int argc, char** argv )
|
|||
|
||||
if ( schedule_event-- <= 0 )
|
||||
schedule();
|
||||
} while ( !please_exit && !enter_debugger );
|
||||
|
||||
/* if ( please_exit ) */
|
||||
/* fprintf( stderr, "Should exit\n" ); */
|
||||
/* else */
|
||||
/* fprintf( stderr, "Should continue\n" ); */
|
||||
} while ( /* !please_exit && */ !enter_debugger );
|
||||
|
||||
if ( enter_debugger )
|
||||
debug();
|
||||
} while ( !please_exit );
|
||||
} while ( true /* !please_exit */ );
|
||||
|
||||
ui_stop();
|
||||
exit_emulator();
|
||||
|
|
10
src/ui.c
10
src/ui.c
|
@ -2124,8 +2124,6 @@ void start_UI( int argc, char** argv )
|
|||
|
||||
void ui_stop( void )
|
||||
{
|
||||
ui_init_LCD();
|
||||
|
||||
switch ( config.frontend_type ) {
|
||||
#if defined( HAS_X11 )
|
||||
case FRONTEND_X11:
|
||||
|
@ -2151,3 +2149,11 @@ void ui_stop( void )
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void close_and_exit( void )
|
||||
{
|
||||
ui_stop();
|
||||
exit_emulator();
|
||||
|
||||
exit( 0 );
|
||||
}
|
||||
|
|
3
src/ui.h
3
src/ui.h
|
@ -55,7 +55,8 @@ extern void ( *ui_refresh_LCD )( void );
|
|||
/* used in: main.c */
|
||||
/*******************/
|
||||
extern void ui_stop( void );
|
||||
|
||||
extern void start_UI( int argc, char** argv );
|
||||
|
||||
extern void close_and_exit( void );
|
||||
|
||||
#endif /* !_UI_H */
|
||||
|
|
|
@ -386,8 +386,9 @@ static int sdlkey_to_hpkey( SDLKey k )
|
|||
return HPKEY_ALPHA;
|
||||
case SDLK_F7:
|
||||
case SDLK_F10:
|
||||
please_exit = true;
|
||||
break;
|
||||
// please_exit = true;
|
||||
close_and_exit();
|
||||
return -1;
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
|
@ -1244,7 +1245,8 @@ void sdl_get_event( void )
|
|||
while ( SDL_PollEvent( &event ) ) {
|
||||
switch ( event.type ) {
|
||||
case SDL_QUIT:
|
||||
please_exit = true;
|
||||
// please_exit = true;
|
||||
close_and_exit();
|
||||
break;
|
||||
|
||||
case SDL_MOUSEBUTTONDOWN:
|
||||
|
|
|
@ -542,7 +542,8 @@ void text_get_event( void )
|
|||
case '|': /* Shift+\ */
|
||||
case KEY_SEND: /* Shift+End */
|
||||
case KEY_F( 10 ):
|
||||
please_exit = true;
|
||||
// please_exit = true;
|
||||
close_and_exit();
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
14
src/ui_x11.c
14
src/ui_x11.c
|
@ -2051,7 +2051,8 @@ static void decode_key( XEvent* xev, KeySym sym, char* buf, int buflen )
|
|||
break;
|
||||
case XK_F7:
|
||||
case XK_F10:
|
||||
please_exit = true;
|
||||
close_and_exit();
|
||||
// please_exit = true;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -2419,6 +2420,10 @@ void x11_get_event( void )
|
|||
|
||||
i = XLookupString( &xev.xkey, buf, bufs, &sym, NULL );
|
||||
decode_key( &xev, sym, buf, i );
|
||||
|
||||
/* if ( please_exit ) */
|
||||
/* return; */
|
||||
|
||||
first_key = 1;
|
||||
break;
|
||||
|
||||
|
@ -2896,8 +2901,11 @@ void x11_get_event( void )
|
|||
cm = ( XClientMessageEvent* )&xev;
|
||||
|
||||
if ( cm->message_type == wm_protocols ) {
|
||||
if ( cm->data.l[ 0 ] == ( long )wm_delete_window )
|
||||
please_exit = true;
|
||||
if ( cm->data.l[ 0 ] == ( long )wm_delete_window ) {
|
||||
close_and_exit();
|
||||
// please_exit = true;
|
||||
// return;
|
||||
}
|
||||
if ( cm->data.l[ 0 ] == ( long )wm_save_yourself ) {
|
||||
int wm_argc = 0;
|
||||
char** wm_argv = ( char** )malloc( ( saved_argc + 5 ) * sizeof( char* ) );
|
||||
|
|
Loading…
Reference in a new issue