From 0011dd1623e2b50d26d620595913a7414cff572a Mon Sep 17 00:00:00 2001 From: Norman Feske Date: Wed, 11 Apr 2018 14:40:21 +0200 Subject: [PATCH] terminal: remove built-in keyboard layout handling Fixes #2757 --- .../recipes/raw/drivers_managed-pc/content.mk | 4 +- .../drivers_managed-pc/input_filter.config | 1 + repos/gems/run/sculpt.run | 9 +- repos/gems/src/server/terminal/main.cc | 148 +++++-------- repos/gems/src/server/terminal/session.h | 1 + repos/os/include/terminal/keymaps.h | 127 ----------- repos/os/include/terminal/scancode_tracker.h | 204 ------------------ .../raw/drivers_interactive-linux/content.mk | 4 +- .../input_filter.config | 1 + .../raw/drivers_interactive-pbxa9/content.mk | 4 +- .../input_filter.config | 1 + .../raw/drivers_interactive-pc/content.mk | 4 +- .../input_filter.config | 1 + .../src/server/input_filter/special.chargen | 27 +++ 14 files changed, 97 insertions(+), 439 deletions(-) delete mode 100644 repos/os/include/terminal/keymaps.h delete mode 100644 repos/os/include/terminal/scancode_tracker.h create mode 100644 repos/os/src/server/input_filter/special.chargen diff --git a/repos/gems/recipes/raw/drivers_managed-pc/content.mk b/repos/gems/recipes/raw/drivers_managed-pc/content.mk index 0aad7234d..5ffca7ced 100644 --- a/repos/gems/recipes/raw/drivers_managed-pc/content.mk +++ b/repos/gems/recipes/raw/drivers_managed-pc/content.mk @@ -1,5 +1,5 @@ content: drivers.config fb_drv.config input_filter.config en_us.chargen \ - numlock_remap.config + special.chargen numlock_remap.config drivers.config numlock_remap.config: cp $(REP_DIR)/recipes/raw/drivers_managed-pc/$@ $@ @@ -7,5 +7,5 @@ drivers.config numlock_remap.config: fb_drv.config input_filter.config: cp $(GENODE_DIR)/repos/os/recipes/raw/drivers_interactive-pc/$@ $@ -en_us.chargen: +en_us.chargen special.chargen: cp $(GENODE_DIR)/repos/os/src/server/input_filter/$@ $@ diff --git a/repos/gems/recipes/raw/drivers_managed-pc/input_filter.config b/repos/gems/recipes/raw/drivers_managed-pc/input_filter.config index d6dbfe10a..583477562 100644 --- a/repos/gems/recipes/raw/drivers_managed-pc/input_filter.config +++ b/repos/gems/recipes/raw/drivers_managed-pc/input_filter.config @@ -32,6 +32,7 @@ + diff --git a/repos/gems/run/sculpt.run b/repos/gems/run/sculpt.run index 87a238ba5..66b1f81ef 100644 --- a/repos/gems/run/sculpt.run +++ b/repos/gems/run/sculpt.run @@ -110,6 +110,7 @@ install_config { + @@ -467,11 +468,9 @@ file copy -force [genode_dir]/repos/gems/run/sculpt/machine.vbox [run_dir]/genod file copy -force [genode_dir]/repos/gems/recipes/raw/drivers_managed-pc/drivers.config \ [run_dir]/genode/drivers.config -file copy -force [genode_dir]/repos/os/src/server/input_filter/en_us.chargen \ - [run_dir]/genode/en_us.chargen - -file copy -force [genode_dir]/repos/os/src/server/input_filter/de.chargen \ - [run_dir]/genode/de.chargen +foreach file { en_us.chargen de.chargen special.chargen } { + file copy -force [genode_dir]/repos/os/src/server/input_filter/$file \ + [run_dir]/genode/$file } file copy -force [genode_dir]/repos/gems/recipes/raw/drivers_managed-pc/input_filter.config \ [run_dir]/genode/input_filter.config diff --git a/repos/gems/src/server/terminal/main.cc b/repos/gems/src/server/terminal/main.cc index f53ec8b3c..9aa6314ef 100644 --- a/repos/gems/src/server/terminal/main.cc +++ b/repos/gems/src/server/terminal/main.cc @@ -26,8 +26,6 @@ /* terminal includes */ #include #include -#include -#include /* local includes */ #include "text_screen_surface.h" @@ -59,10 +57,6 @@ struct Terminal::Main : Character_consumer Reconstructible _font_family { *_font }; - unsigned char *_keymap = Terminal::usenglish_keymap; - unsigned char *_shift = Terminal::usenglish_shift; - unsigned char *_altgr = nullptr; - Color_palette _color_palette { }; void _handle_config(); @@ -130,29 +124,11 @@ struct Terminal::Main : Character_consumer /* create root interface for service */ Root_component _root { _env, _heap, _read_buffer, *this }; - /* - * builtin keyboard-layout handling - * - * \deprecated The keyboard layout should be handled by the input-filter - * component. - */ - Constructible _scancode_tracker { }; - - /* state needed for key-repeat handling */ - unsigned const _repeat_delay = 250; - unsigned const _repeat_rate = 25; - unsigned _repeat_next = 0; - void _handle_input(); Signal_handler
_input_handler { _env.ep(), *this, &Main::_handle_input }; - void _handle_key_repeat(Duration); - - Timer::One_shot_timeout
_key_repeat_timeout { - _timer, *this, &Main::_handle_key_repeat }; - Main(Env &env) : _env(env) { _handle_config(); @@ -209,32 +185,6 @@ void Terminal::Main::_handle_config() _terminal_size = _text_screen_surface->size(); _root.notify_resized(_terminal_size); _schedule_flush(); - - /* - * Read keyboard layout from config file - */ - - _keymap = Terminal::usenglish_keymap; - _shift = Terminal::usenglish_shift; - _altgr = nullptr; - - if (config.has_sub_node("keyboard")) { - - if (config.sub_node("keyboard").attribute("layout").has_value("de")) { - _keymap = Terminal::german_keymap; - _shift = Terminal::german_shift; - _altgr = Terminal::german_altgr; - } - - if (config.sub_node("keyboard").attribute("layout").has_value("none")) { - _keymap = nullptr; - _shift = nullptr; - _altgr = nullptr; - } - } - - if (!_scancode_tracker.constructed()) - _scancode_tracker.construct(_keymap, _shift, _altgr, Terminal::control); } @@ -242,53 +192,61 @@ void Terminal::Main::_handle_input() { _input.for_each_event([&] (Input::Event const &event) { - if (event.type() == Input::Event::CHARACTER) { - Input::Event::Utf8 const utf8 = event.utf8(); - _read_buffer.add(utf8.b0); - if (utf8.b1) _read_buffer.add(utf8.b1); - if (utf8.b2) _read_buffer.add(utf8.b2); - if (utf8.b3) _read_buffer.add(utf8.b3); + if (event.type() == Input::Event::CHARACTER) { + Input::Event::Utf8 const utf8 = event.utf8(); + + char const sequence[] { (char)utf8.b0, (char)utf8.b1, + (char)utf8.b2, (char)utf8.b3, 0 }; + + /* function-key unicodes */ + enum { + CODEPOINT_UP = 0xf700, CODEPOINT_DOWN = 0xf701, + CODEPOINT_LEFT = 0xf702, CODEPOINT_RIGHT = 0xf703, + CODEPOINT_F1 = 0xf704, CODEPOINT_F2 = 0xf705, + CODEPOINT_F3 = 0xf706, CODEPOINT_F4 = 0xf707, + CODEPOINT_F5 = 0xf708, CODEPOINT_F6 = 0xf709, + CODEPOINT_F7 = 0xf70a, CODEPOINT_F8 = 0xf70b, + CODEPOINT_F9 = 0xf70c, CODEPOINT_F10 = 0xf70d, + CODEPOINT_F11 = 0xf70e, CODEPOINT_F12 = 0xf70f, + CODEPOINT_HOME = 0xf729, CODEPOINT_INSERT = 0xf727, + CODEPOINT_DELETE = 0xf728, CODEPOINT_END = 0xf72b, + CODEPOINT_PAGEUP = 0xf72c, CODEPOINT_PAGEDOWN = 0xf72d, + }; + + Codepoint const codepoint = Utf8_ptr(sequence).codepoint(); + + char const *special_sequence = nullptr; + switch (codepoint.value) { + case CODEPOINT_UP: special_sequence = "\EOA"; break; + case CODEPOINT_DOWN: special_sequence = "\EOB"; break; + case CODEPOINT_LEFT: special_sequence = "\EOD"; break; + case CODEPOINT_RIGHT: special_sequence = "\EOC"; break; + case CODEPOINT_F1: special_sequence = "\EOP"; break; + case CODEPOINT_F2: special_sequence = "\EOQ"; break; + case CODEPOINT_F3: special_sequence = "\EOR"; break; + case CODEPOINT_F4: special_sequence = "\EOS"; break; + case CODEPOINT_F5: special_sequence = "\E[15~"; break; + case CODEPOINT_F6: special_sequence = "\E[17~"; break; + case CODEPOINT_F7: special_sequence = "\E[18~"; break; + case CODEPOINT_F8: special_sequence = "\E[19~"; break; + case CODEPOINT_F9: special_sequence = "\E[20~"; break; + case CODEPOINT_F10: special_sequence = "\E[21~"; break; + case CODEPOINT_F11: special_sequence = "\E[23~"; break; + case CODEPOINT_F12: special_sequence = "\E[24~"; break; + case CODEPOINT_HOME: special_sequence = "\E[1~"; break; + case CODEPOINT_INSERT: special_sequence = "\E[2~"; break; + case CODEPOINT_DELETE: special_sequence = "\E[3~"; break; + case CODEPOINT_END: special_sequence = "\E[4~"; break; + case CODEPOINT_PAGEUP: special_sequence = "\E[5~"; break; + case CODEPOINT_PAGEDOWN: special_sequence = "\E[6~"; break; + }; + + if (special_sequence) + _read_buffer.add(special_sequence); + else + _read_buffer.add(sequence); } - - /* apply the terminal's built-in character map if configured */ - 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); - - if (press) { - _scancode_tracker->emit_current_character(_read_buffer); - - /* setup first key repeat */ - _repeat_next = _repeat_delay; - } - - if (release) - _repeat_next = 0; }); - - if (_repeat_next) - _key_repeat_timeout.schedule(Microseconds{1000*_repeat_next}); -} - - -void Terminal::Main::_handle_key_repeat(Duration) -{ - if (_repeat_next) { - - /* repeat current character or sequence */ - if (_scancode_tracker.constructed()) - _scancode_tracker->emit_current_character(_read_buffer); - - _repeat_next = _repeat_rate; - } - - _handle_input(); } diff --git a/repos/gems/src/server/terminal/session.h b/repos/gems/src/server/terminal/session.h index 547a199b6..3adac9cfb 100644 --- a/repos/gems/src/server/terminal/session.h +++ b/repos/gems/src/server/terminal/session.h @@ -18,6 +18,7 @@ #include #include #include +#include /* local includes */ #include "types.h" diff --git a/repos/os/include/terminal/keymaps.h b/repos/os/include/terminal/keymaps.h deleted file mode 100644 index 1605c8818..000000000 --- a/repos/os/include/terminal/keymaps.h +++ /dev/null @@ -1,127 +0,0 @@ -/* - * \brief Key mappings of scancodes to characters - * \author Norman Feske - * \date 2011-06-06 - */ - -/* - * Copyright (C) 2011-2017 Genode Labs GmbH - * - * This file is part of the Genode OS framework, which is distributed - * under the terms of the GNU Affero General Public License version 3. - */ - -#ifndef _TERMINAL__KEYMAPS_H_ -#define _TERMINAL__KEYMAPS_H_ - -namespace Terminal { - - enum { - BS = 8, - ESC = 27, - TAB = 9, - LF = 10, - UE = 252, /* 'ü' */ - AE = 228, /* 'ä' */ - OE = 246, /* 'ö' */ - PAR = 167, /* '§' */ - DEG = 176, /* '°' */ - SS = 223, /* 'ß' */ - }; - - - static unsigned char usenglish_keymap[128] = { - 0 ,ESC,'1','2','3','4','5','6','7','8','9','0','-','=', BS,TAB, - 'q','w','e','r','t','y','u','i','o','p','[',']', LF, 0 ,'a','s', - 'd','f','g','h','j','k','l',';','\'','`', 0, '\\' ,'z','x','c','v', - 'b','n','m',',','.','/', 0 , 0 , 0 ,' ', 0 , 0 , 0 , 0 , 0 , 0 , - 0 , 0 , 0 , 0 , 0 , 0 , 0 ,'7','8','9','-','4','5','6','+','1', - '2','3','0',',', 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , - LF, 0 ,'/', 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , - }; - - - /** - * Mapping from ASCII value to another ASCII value when shift is pressed - * - * The table does not contain mappings for control characters. The table - * entry 0 corresponds to ASCII value 32. - */ - static unsigned char usenglish_shift[256 - 32] = { - /* 32 */ ' ', 0 , 0, 0 , 0 , 0 , 0 ,'"', 0 , 0 , 0 , 0 ,'<','_','>','?', - /* 48 */ ')','!','@','#','$','%','^','&','*','(', 0 ,':', 0 ,'+', 0 , 0 , - /* 64 */ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , - /* 80 */ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ,'{','|','}', 0 , 0 , - /* 96 */ '~','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O', - /* 112 */ 'P','Q','R','S','T','U','V','W','X','Y','Z', 0 ,'\\', 0 , 0 , 0 , - }; - - - static unsigned char german_keymap[128] = { - 0 ,ESC,'1','2','3','4','5','6','7','8','9','0', SS, 39, BS,TAB, - 'q','w','e','r','t','z','u','i','o','p', UE,'+', LF, 0 ,'a','s', - 'd','f','g','h','j','k','l', OE, AE,'^', 0 ,'#','y','x','c','v', - 'b','n','m',',','.','-', 0 ,'*', 0 ,' ', 0 , 0 , 0 , 0 , 0 , 0 , - 0 , 0 , 0 , 0 , 0 , 0 , 0 ,'7','8','9','-','4','5','6','+','1', - '2','3','0',',', 0 , 0 ,'<', 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , - LF, 0 ,'/', 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , - }; - - - /** - * Mapping from ASCII value to another ASCII value when shift is pressed - * - * The table does not contain mappings for control characters. The table - * entry 0 corresponds to ASCII value 32. - */ - static unsigned char german_shift[256 - 32] = { - /* 32 */ ' ', 0 , 0, 39 , 0 , 0 , 0 ,'`', 0 , 0 , 0 ,'*',';','_',':', 0 , - /* 48 */ '=','!','"',PAR,'$','%','&','/','(',')', 0 , 0 ,'>', 0 , 0 , 0 , - /* 64 */ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , - /* 80 */ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ,DEG, 0 , - /* 96 */ 0 ,'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O', - /* 112 */ 'P','Q','R','S','T','U','V','W','X','Y','Z', 0 , 0 , 0 , 0 , 0 , - /* 128 */ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , - /* 144 */ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , - /* 160 */ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , - /* 176 */ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , - /* 192 */ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , - /* 208 */ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ,'?', - }; - - - /** - * Mapping from ASCII value to another ASCII value when altgr is pressed - */ - static unsigned char german_altgr[256 - 32] = { - /* 32 */ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ,'~', 0 , 0 , 0 , 0 , - /* 48 */'}', 0 ,178,179, 0 , 0 , 0 ,'{','[',']', 0 , 0 ,'|', 0 , 0 , 0 , - /* 64 */ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , - /* 80 */ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , - /* 96 */ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , - /* 112 */ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , - /* 128 */ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , - /* 144 */ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , - /* 160 */ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , - /* 176 */ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , - /* 192 */ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , - /* 208 */ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ,'\\', - }; - - - /** - * Mapping from ASCII value to value reported when control is pressed - * - * The table starts with ASCII value 32. - */ - static unsigned char control[256 - 32] = { - /* 32 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - /* 48 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - /* 64 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - /* 80 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - /* 96 */ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, - /* 112 */ 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 0, 0, 0, 0, 0, 0, - }; -} - -#endif /* _TERMINAL__KEYMAPS_H_ */ diff --git a/repos/os/include/terminal/scancode_tracker.h b/repos/os/include/terminal/scancode_tracker.h deleted file mode 100644 index 998c39c3a..000000000 --- a/repos/os/include/terminal/scancode_tracker.h +++ /dev/null @@ -1,204 +0,0 @@ -/* - * \brief State machine for translating scan codes to characters - * \author Norman Feske - * \date 2011-06-06 - */ - -/* - * Copyright (C) 2011-2017 Genode Labs GmbH - * - * This file is part of the Genode OS framework, which is distributed - * under the terms of the GNU Affero General Public License version 3. - */ - -#ifndef _TERMINAL__SCANCODE_TRACKER_H_ -#define _TERMINAL__SCANCODE_TRACKER_H_ - -#include -#include - -namespace Terminal { class Scancode_tracker; } - - -/** - * State machine that translates keycode sequences to terminal characters - */ -class Terminal::Scancode_tracker -{ - private: - - /** - * Tables containing the scancode-to-character mapping - */ - unsigned char const *_keymap; - unsigned char const *_shift; - unsigned char const *_altgr; - unsigned char const *_control; - - /** - * Current state of modifer keys - */ - bool _mod_shift; - bool _mod_control; - bool _mod_altgr; - - /** - * Currently pressed key, or 0 if no normal key (one that can be - * encoded in a single 'char') is pressed - */ - unsigned char _last_character; - - /** - * Currently pressed special key (a key that corresponds to an escape - * sequence), or no if no special key is pressed - */ - char const *_last_sequence; - - /** - * Convert keycode to terminal character - */ - unsigned char _keycode_to_latin1(int keycode) - { - if (keycode >= 112) return 0; - - unsigned ch = _keymap[keycode]; - - if (ch < 32) - return ch; - - /* all ASCII-to-ASCII table start at index 32 */ - if (_mod_shift || _mod_control || _mod_altgr) { - ch -= 32; - - /* - * 'ch' is guaranteed to be in the range 0..223. So it is safe to - * use it as index into the ASCII-to-ASCII tables. - */ - - if (_mod_shift) - return _shift[ch]; - - if (_mod_control) - return _control[ch]; - - if (_altgr && _mod_altgr) - return _altgr[ch]; - } - - return ch; - } - - public: - - /** - * Constructor - * - * \param keymap table for keycode-to-character mapping - * \param shift table for character-to-character mapping used when - * Shift is pressed - * \param altgr table for character-to-character mapping with AltGr - * is pressed - */ - Scancode_tracker(unsigned char const *keymap, - unsigned char const *shift, - unsigned char const *altgr, - unsigned char const *control) - : - _keymap(keymap), - _shift(shift), - _altgr(altgr), - _control(control), - _mod_shift(false), - _mod_control(false), - _mod_altgr(false), - _last_character(0), - _last_sequence(0) - { } - - /** - * Submit key event to state machine - * - * \param press true on press event, false on release event - */ - void submit(int keycode, bool press) - { - /* track modifier keys */ - switch (keycode) { - case Input::KEY_LEFTSHIFT: - case Input::KEY_RIGHTSHIFT: - _mod_shift = press; - break; - - case Input::KEY_LEFTCTRL: - case Input::KEY_RIGHTCTRL: - _mod_control = press; - break; - - case Input::KEY_RIGHTALT: - _mod_altgr = press; - - default: - break; - } - - /* reset information about the currently pressed key */ - _last_character = 0; - _last_sequence = 0; - - 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 */ - if (!_last_character) { - switch (keycode) { - case Input::KEY_DOWN: _last_sequence = "\EOB"; break; - case Input::KEY_UP: _last_sequence = "\EOA"; break; - case Input::KEY_RIGHT: _last_sequence = "\EOC"; break; - case Input::KEY_LEFT: _last_sequence = "\EOD"; break; - case Input::KEY_HOME: _last_sequence = "\E[1~"; break; - case Input::KEY_INSERT: _last_sequence = "\E[2~"; break; - case Input::KEY_DELETE: _last_sequence = "\E[3~"; break; - case Input::KEY_END: _last_sequence = "\E[4~"; break; - case Input::KEY_PAGEUP: _last_sequence = "\E[5~"; break; - case Input::KEY_PAGEDOWN: _last_sequence = "\E[6~"; break; - case Input::KEY_F1: _last_sequence = "\EOP"; break; - case Input::KEY_F2: _last_sequence = "\EOQ"; break; - case Input::KEY_F3: _last_sequence = "\EOR"; break; - case Input::KEY_F4: _last_sequence = "\EOS"; break; - case Input::KEY_F5: _last_sequence = "\E[15~"; break; - case Input::KEY_F6: _last_sequence = "\E[17~"; break; - case Input::KEY_F7: _last_sequence = "\E[18~"; break; - case Input::KEY_F8: _last_sequence = "\E[19~"; break; - case Input::KEY_F9: _last_sequence = "\E[20~"; break; - case Input::KEY_F10: _last_sequence = "\E[21~"; break; - case Input::KEY_F11: _last_sequence = "\E[23~"; break; - case Input::KEY_F12: _last_sequence = "\E[24~"; break; - } - } - } - - /** - * Output currently pressed key to read buffer - */ - void emit_current_character(Read_buffer &read_buffer) - { - if (_last_character) - read_buffer.add(_last_character); - - if (_last_sequence) - read_buffer.add(_last_sequence); - } - - /** - * Return true if there is a currently pressed key - */ - bool valid() const - { - return (_last_sequence || _last_character); - } -}; - -#endif /* _TERMINAL__SCANCODE_TRACKER_H_ */ diff --git a/repos/os/recipes/raw/drivers_interactive-linux/content.mk b/repos/os/recipes/raw/drivers_interactive-linux/content.mk index 5da5a1bae..a6ef537fc 100644 --- a/repos/os/recipes/raw/drivers_interactive-linux/content.mk +++ b/repos/os/recipes/raw/drivers_interactive-linux/content.mk @@ -1,7 +1,7 @@ -content: drivers.config input_filter.config en_us.chargen +content: drivers.config input_filter.config en_us.chargen special.chargen drivers.config input_filter.config: cp $(REP_DIR)/recipes/raw/drivers_interactive-linux/$@ $@ -en_us.chargen: +en_us.chargen special.chargen: cp $(REP_DIR)/src/server/input_filter/$@ $@ diff --git a/repos/os/recipes/raw/drivers_interactive-linux/input_filter.config b/repos/os/recipes/raw/drivers_interactive-linux/input_filter.config index 561f3dc96..7c5380c69 100644 --- a/repos/os/recipes/raw/drivers_interactive-linux/input_filter.config +++ b/repos/os/recipes/raw/drivers_interactive-linux/input_filter.config @@ -20,6 +20,7 @@ + diff --git a/repos/os/recipes/raw/drivers_interactive-pbxa9/content.mk b/repos/os/recipes/raw/drivers_interactive-pbxa9/content.mk index 087faf7cb..adddfc4e2 100644 --- a/repos/os/recipes/raw/drivers_interactive-pbxa9/content.mk +++ b/repos/os/recipes/raw/drivers_interactive-pbxa9/content.mk @@ -1,7 +1,7 @@ -content: drivers.config input_filter.config en_us.chargen +content: drivers.config input_filter.config en_us.chargen special.chargen drivers.config input_filter.config: cp $(REP_DIR)/recipes/raw/drivers_interactive-pbxa9/$@ $@ -en_us.chargen: +en_us.chargen special.chargen: cp $(REP_DIR)/src/server/input_filter/$@ $@ diff --git a/repos/os/recipes/raw/drivers_interactive-pbxa9/input_filter.config b/repos/os/recipes/raw/drivers_interactive-pbxa9/input_filter.config index 5b055b7c6..056d9fa47 100644 --- a/repos/os/recipes/raw/drivers_interactive-pbxa9/input_filter.config +++ b/repos/os/recipes/raw/drivers_interactive-pbxa9/input_filter.config @@ -20,6 +20,7 @@ + diff --git a/repos/os/recipes/raw/drivers_interactive-pc/content.mk b/repos/os/recipes/raw/drivers_interactive-pc/content.mk index da93739b0..6050a65b2 100644 --- a/repos/os/recipes/raw/drivers_interactive-pc/content.mk +++ b/repos/os/recipes/raw/drivers_interactive-pc/content.mk @@ -1,7 +1,7 @@ -content: drivers.config fb_drv.config input_filter.config en_us.chargen +content: drivers.config fb_drv.config input_filter.config en_us.chargen special.chargen drivers.config fb_drv.config input_filter.config: cp $(REP_DIR)/recipes/raw/drivers_interactive-pc/$@ $@ -en_us.chargen: +en_us.chargen special.chargen: cp $(REP_DIR)/src/server/input_filter/$@ $@ diff --git a/repos/os/recipes/raw/drivers_interactive-pc/input_filter.config b/repos/os/recipes/raw/drivers_interactive-pc/input_filter.config index 220320f29..ca04c44be 100644 --- a/repos/os/recipes/raw/drivers_interactive-pc/input_filter.config +++ b/repos/os/recipes/raw/drivers_interactive-pc/input_filter.config @@ -24,6 +24,7 @@ + diff --git a/repos/os/src/server/input_filter/special.chargen b/repos/os/src/server/input_filter/special.chargen new file mode 100644 index 000000000..521558c30 --- /dev/null +++ b/repos/os/src/server/input_filter/special.chargen @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + +