mirror of
https://github.com/genodelabs/genode.git
synced 2025-01-11 15:33:04 +00:00
terminal: cursor-key handling w/o set key layout
This patch applies the handling of cursor keys, function keys, and page up/down keys even if no keymap is defined. This is the case when using the terminal with character events produced by the input filter.
This commit is contained in:
parent
c6690ea447
commit
6fcf95d536
@ -539,7 +539,7 @@ struct Terminal::Main
|
|||||||
/* create root interface for service */
|
/* create root interface for service */
|
||||||
Terminal::Root_component _root;
|
Terminal::Root_component _root;
|
||||||
|
|
||||||
Constructible<Terminal::Scancode_tracker> _scancode_tracker;
|
Terminal::Scancode_tracker _scancode_tracker;
|
||||||
|
|
||||||
/* state needed for key-repeat handling */
|
/* state needed for key-repeat handling */
|
||||||
unsigned const _repeat_delay = 250;
|
unsigned const _repeat_delay = 250;
|
||||||
@ -603,13 +603,6 @@ struct Terminal::Main
|
|||||||
font_family),
|
font_family),
|
||||||
_scancode_tracker(keymap, shift, altgr, Terminal::control)
|
_scancode_tracker(keymap, shift, altgr, Terminal::control)
|
||||||
{
|
{
|
||||||
/*
|
|
||||||
* Construct scancode tracker only if a key map is defined. Otherwise,
|
|
||||||
* the terminal responds solely by 'CHARACTER' input events.
|
|
||||||
*/
|
|
||||||
if (keymap)
|
|
||||||
_scancode_tracker.construct(keymap, shift, altgr, Terminal::control);
|
|
||||||
|
|
||||||
_input.sigh(_input_handler);
|
_input.sigh(_input_handler);
|
||||||
|
|
||||||
/* announce service at our parent */
|
/* announce service at our parent */
|
||||||
@ -630,18 +623,15 @@ void Terminal::Main::_handle_input()
|
|||||||
if (utf8.b3) _read_buffer.add(utf8.b3);
|
if (utf8.b3) _read_buffer.add(utf8.b3);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!_scancode_tracker.constructed())
|
|
||||||
return;
|
|
||||||
|
|
||||||
bool press = (event.type() == Input::Event::PRESS ? true : false);
|
bool press = (event.type() == Input::Event::PRESS ? true : false);
|
||||||
bool release = (event.type() == Input::Event::RELEASE ? true : false);
|
bool release = (event.type() == Input::Event::RELEASE ? true : false);
|
||||||
int keycode = event.code();
|
int keycode = event.code();
|
||||||
|
|
||||||
if (press || release)
|
if (press || release)
|
||||||
_scancode_tracker->submit(keycode, press);
|
_scancode_tracker.submit(keycode, press);
|
||||||
|
|
||||||
if (press) {
|
if (press) {
|
||||||
_scancode_tracker->emit_current_character(_read_buffer);
|
_scancode_tracker.emit_current_character(_read_buffer);
|
||||||
|
|
||||||
/* setup first key repeat */
|
/* setup first key repeat */
|
||||||
_repeat_next = _repeat_delay;
|
_repeat_next = _repeat_delay;
|
||||||
@ -661,7 +651,7 @@ void Terminal::Main::_handle_key_repeat(Duration)
|
|||||||
if (_repeat_next) {
|
if (_repeat_next) {
|
||||||
|
|
||||||
/* repeat current character or sequence */
|
/* repeat current character or sequence */
|
||||||
_scancode_tracker->emit_current_character(_read_buffer);
|
_scancode_tracker.emit_current_character(_read_buffer);
|
||||||
|
|
||||||
_repeat_next = _repeat_rate;
|
_repeat_next = _repeat_rate;
|
||||||
}
|
}
|
||||||
|
@ -148,7 +148,8 @@ class Terminal::Scancode_tracker
|
|||||||
if (!press) return;
|
if (!press) return;
|
||||||
|
|
||||||
/* convert key codes to ASCII */
|
/* convert key codes to ASCII */
|
||||||
_last_character = _keycode_to_latin1(keycode);
|
if (_keymap)
|
||||||
|
_last_character = _keycode_to_latin1(keycode);
|
||||||
|
|
||||||
/* handle special key to be represented by an escape sequence */
|
/* handle special key to be represented by an escape sequence */
|
||||||
if (!_last_character) {
|
if (!_last_character) {
|
||||||
|
Loading…
Reference in New Issue
Block a user