linux: restore default INT/TERM signal handler

Allow to use CTRL-C to quit PCSX2 ("regression" of SDL2)
This commit is contained in:
Gregory Hainaut 2015-10-29 15:03:48 +01:00
parent 6f4ba08d4a
commit 96fc260488
1 changed files with 6 additions and 0 deletions

View File

@ -20,6 +20,7 @@
*/
#include "joystick.h"
#include <signal.h> // sigaction
//////////////////////////
// Joystick definitions //
@ -51,6 +52,11 @@ void JoystickInfo::EnumerateJoysticks(vector<GamePad*>& vjoysticks)
// Tell SDL to catch event even if the windows isn't focussed
SDL_SetHint(SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS, "1");
if (SDL_Init(SDL_INIT_JOYSTICK|SDL_INIT_HAPTIC|SDL_INIT_EVENTS) < 0) return;
// WTF! Give me back the control of my system
struct sigaction action;
action.sa_handler = SIG_DFL;
sigaction(SIGINT, &action, NULL);
sigaction(SIGTERM, &action, NULL);
#else
if (SDL_Init(SDL_INIT_JOYSTICK) < 0) return;
#endif