Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions docs/design/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,16 @@ and if this signal became unhandled current process will be terminated. \
On POSIX compatible platforms keyboard handler will register it's own signal handler for the
`SIGINT` to be able to return terminal input in canonical mode after abnormal program termination
via pressing `Ctrl+C`. This signal handling could overlap with registered specific `SIGINT`
handler on upper level or inside keyboard handler's clients. It could cause side effects and
considering as current design and implementation limitations.
handler on upper level or inside keyboard handler's clients. To avoid this overlap keyboard handler
will save previous `SIGINT` handler and call it after processing its own signal handler. It will
also restore the previous `SIGINT` handler in destructor. The keyboard handler constructor has an
optional parameter `bool install_signal_handler` which by default is set to `true`. If this
parameter is set to `false`, keyboard handler will not register its own `SIGINT` handler and
will not restore previous `SIGINT` handler in destructor. This could be useful in cases when client
code already registered its own `SIGINT` handler and don't want to overlap it with keyboard
handler's one. In this case client code should be responsible for restoring terminal input in
canonical mode after abnormal program termination via pressing `Ctrl+C` by calling static method
`KeyboardHandler::restore_terminal_input_canonical_mode()`.

## Handling cases when client's code subscribed to the key press event got destructed before keyboard handler
There are two options to properly handle this case:
Expand Down Expand Up @@ -241,4 +249,3 @@ issues:
`F1..F12` and other control keys.
- Windows implementation not able to detect `CTRL` + `ALT` + `key` combinations.
- Windows implementation not able to detect `ALT` + `F1..12` keys.

Loading