SDL/src/core
Ryan C. Gordon f59b0056d3 evdev: On sudden termination, make sure keyboard isn't lost (thanks, Tadek!)
"In release 2.0.6, when Linux evdev keyboard support has been moved to a
separate source file, a feature was added to disable normal keyboard event
processing to prevent "spilling" keystrokes to background virtual console.

This feature has one unpleasant side effect: if application fails to call
`SDL_Exit` before termination or crashes with fatal signal, console is left
in unusable state with keyboard not working and no possibility to switch
virtual console. If user has a chance, he can login remotely and restore
keyboard with `kbd_mode`, otherwise the only option is to reboot the machine.

This patch fixes that problem by intercepting fatal signals (with `sigaction`)
and process termination (with `atexit`), to restore keyboard state, if it
wasn't properly restored with `SDL_Exit`.

The function registered with `atexit` also restores original signal handlers,
to prevent leaving invalid handlers after SDL library is unloaded, if it was
loaded dynamically with `dlopen`.

No signal handlers or `atexit` function are installed if SDL boolean hint
`SDL_HINT_NO_SIGNAL_HANDLERS` is `SDL_TRUE`.

Additionally, if environment variable `SDL_INPUT_LINUX_KEEP_KBD` exists,
keyboard initialization function completely skips disabling keyboard. This
can be useful for debugging."

Fixes Bugzilla #4193.
2018-08-07 16:56:46 -04:00
..
android Allow trapping the back button so right mouse click can work on some Android systems (thanks Rachel!) 2018-07-12 13:28:13 -07:00
linux evdev: On sudden termination, make sure keyboard isn't lost (thanks, Tadek!) 2018-08-07 16:56:46 -04:00
unix Updated copyright for 2018 2018-01-03 10:03:25 -08:00
windows Fixed bug 4102 - define _WIN32_WINNT_WIN7 if not already defined 2018-03-10 21:22:42 -08:00
winrt Updated copyright for 2018 2018-01-03 10:03:25 -08:00