diff --git a/repos/gems/src/server/terminal/main.cc b/repos/gems/src/server/terminal/main.cc index 954c2ce6cf..69595928ec 100644 --- a/repos/gems/src/server/terminal/main.cc +++ b/repos/gems/src/server/terminal/main.cc @@ -539,7 +539,7 @@ struct Terminal::Main /* create root interface for service */ Terminal::Root_component _root; - Constructible _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; } diff --git a/repos/os/include/terminal/scancode_tracker.h b/repos/os/include/terminal/scancode_tracker.h index 0b24b6b40f..833fc0404c 100644 --- a/repos/os/include/terminal/scancode_tracker.h +++ b/repos/os/include/terminal/scancode_tracker.h @@ -148,7 +148,8 @@ class Terminal::Scancode_tracker if (!press) return; /* 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 */ if (!_last_character) {