mirror of
https://github.com/genodelabs/genode.git
synced 2024-12-19 13:47:56 +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 */
|
||||
Terminal::Root_component _root;
|
||||
|
||||
Constructible<Terminal::Scancode_tracker> _scancode_tracker;
|
||||
Terminal::Scancode_tracker _scancode_tracker;
|
||||
|
||||
/* state needed for key-repeat handling */
|
||||
unsigned const _repeat_delay = 250;
|
||||
@ -603,13 +603,6 @@ struct Terminal::Main
|
||||
font_family),
|
||||
_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);
|
||||
|
||||
/* announce service at our parent */
|
||||
@ -630,18 +623,15 @@ void Terminal::Main::_handle_input()
|
||||
if (utf8.b3) _read_buffer.add(utf8.b3);
|
||||
}
|
||||
|
||||
if (!_scancode_tracker.constructed())
|
||||
return;
|
||||
|
||||
bool press = (event.type() == Input::Event::PRESS ? true : false);
|
||||
bool release = (event.type() == Input::Event::RELEASE ? true : false);
|
||||
int keycode = event.code();
|
||||
|
||||
if (press || release)
|
||||
_scancode_tracker->submit(keycode, press);
|
||||
_scancode_tracker.submit(keycode, press);
|
||||
|
||||
if (press) {
|
||||
_scancode_tracker->emit_current_character(_read_buffer);
|
||||
_scancode_tracker.emit_current_character(_read_buffer);
|
||||
|
||||
/* setup first key repeat */
|
||||
_repeat_next = _repeat_delay;
|
||||
@ -661,7 +651,7 @@ void Terminal::Main::_handle_key_repeat(Duration)
|
||||
if (_repeat_next) {
|
||||
|
||||
/* repeat current character or sequence */
|
||||
_scancode_tracker->emit_current_character(_read_buffer);
|
||||
_scancode_tracker.emit_current_character(_read_buffer);
|
||||
|
||||
_repeat_next = _repeat_rate;
|
||||
}
|
||||
|
@ -148,6 +148,7 @@ class Terminal::Scancode_tracker
|
||||
if (!press) return;
|
||||
|
||||
/* convert key codes to ASCII */
|
||||
if (_keymap)
|
||||
_last_character = _keycode_to_latin1(keycode);
|
||||
|
||||
/* handle special key to be represented by an escape sequence */
|
||||
|
Loading…
Reference in New Issue
Block a user