mirror of
https://github.com/libretro/RetroArch
synced 2025-01-29 18:32:44 +00:00
move more code to linux_common.c
This commit is contained in:
parent
bfec58154e
commit
8005585853
@ -92,25 +92,26 @@ static void linux_terminal_restore_signal(int sig)
|
||||
kill(getpid(), sig);
|
||||
}
|
||||
|
||||
void linux_terminal_disable_input(void)
|
||||
bool linux_terminal_disable_input(void)
|
||||
{
|
||||
struct sigaction sa = {{0}};
|
||||
|
||||
/* Avoid accidentally typing stuff. */
|
||||
if (!isatty(0))
|
||||
return;
|
||||
return false;
|
||||
|
||||
if (!linux_terminal_init())
|
||||
{
|
||||
linux_terminal_flush();
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
sa.sa_handler = linux_terminal_restore_signal;
|
||||
sa.sa_flags = SA_RESTART | SA_RESETHAND;
|
||||
sigemptyset(&sa.sa_mask);
|
||||
|
||||
/* Trap some fatal signals. */
|
||||
/* Trap some standard termination codes so we
|
||||
* can restore the keyboard before we lose control. */
|
||||
sigaction(SIGABRT, &sa, NULL);
|
||||
sigaction(SIGBUS, &sa, NULL);
|
||||
sigaction(SIGFPE, &sa, NULL);
|
||||
@ -119,4 +120,6 @@ void linux_terminal_disable_input(void)
|
||||
sigaction(SIGSEGV, &sa, NULL);
|
||||
|
||||
atexit(linux_terminal_restore_input);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -28,6 +28,6 @@ void linux_terminal_claim_stdin(void);
|
||||
|
||||
bool linux_terminal_grab_stdin(void *data);
|
||||
|
||||
void linux_terminal_disable_input(void);
|
||||
bool linux_terminal_disable_input(void);
|
||||
|
||||
#endif
|
||||
|
@ -37,12 +37,6 @@ typedef struct linuxraw_input
|
||||
bool state[0x80];
|
||||
} linuxraw_input_t;
|
||||
|
||||
static void linuxraw_exit_gracefully(int sig)
|
||||
{
|
||||
linux_terminal_restore_input();
|
||||
kill(getpid(), sig);
|
||||
}
|
||||
|
||||
static void *linuxraw_input_init(void)
|
||||
{
|
||||
struct sigaction sa = {{0}};
|
||||
@ -64,29 +58,13 @@ static void *linuxraw_input_init(void)
|
||||
if (!linuxraw)
|
||||
return NULL;
|
||||
|
||||
|
||||
if (!linux_terminal_init())
|
||||
if (!linux_terminal_disable_input())
|
||||
{
|
||||
linux_terminal_restore_input();
|
||||
free(linuxraw);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
sa.sa_handler = linuxraw_exit_gracefully;
|
||||
sa.sa_flags = SA_RESTART | SA_RESETHAND;
|
||||
sigemptyset(&sa.sa_mask);
|
||||
|
||||
/* Trap some standard termination codes so we
|
||||
* can restore the keyboard before we lose control. */
|
||||
sigaction(SIGABRT, &sa, NULL);
|
||||
sigaction(SIGBUS, &sa, NULL);
|
||||
sigaction(SIGFPE, &sa, NULL);
|
||||
sigaction(SIGILL, &sa, NULL);
|
||||
sigaction(SIGQUIT, &sa, NULL);
|
||||
sigaction(SIGSEGV, &sa, NULL);
|
||||
|
||||
atexit(linux_terminal_restore_input);
|
||||
|
||||
linuxraw->joypad = input_joypad_init_driver(
|
||||
settings->input.joypad_driver, linuxraw);
|
||||
input_keymaps_init_keyboard_lut(rarch_key_map_linux);
|
||||
|
Loading…
x
Reference in New Issue
Block a user