diff --git a/doc/architecture.md b/doc/architecture.md index c221f36fff..10633ddf34 100644 --- a/doc/architecture.md +++ b/doc/architecture.md @@ -413,7 +413,7 @@ Notes: vtm ``` -Note: You can explicitly specify running vtm inside the terminal (run `vtm --tui`) or in its own GUI window (run `vtm --gui`). GUI mode is only available on Windows for now. +Note: You can explicitly specify running vtm inside the terminal (run `vtm --tui`) or in its own GUI window (run `vtm --gui`). ### Run Teletype Console diff --git a/doc/settings.md b/doc/settings.md index 4a6490b35a..b35b33832c 100644 --- a/doc/settings.md +++ b/doc/settings.md @@ -842,7 +842,7 @@ Notes - + diff --git a/src/netxs/desktopio/application.hpp b/src/netxs/desktopio/application.hpp index 353bcb335c..3318ee9bfa 100644 --- a/src/netxs/desktopio/application.hpp +++ b/src/netxs/desktopio/application.hpp @@ -21,7 +21,7 @@ namespace netxs::app namespace netxs::app::shared { - static const auto version = "v2026.09.23"; + static const auto version = "v2026.09.24"; static const auto repository = "https://github.com/directvt/vtm"; static const auto usr_config = "~/.config/vtm/settings.xml"s; static const auto sys_config = "/etc/vtm/settings.xml"s; diff --git a/src/netxs/desktopio/gui.hpp b/src/netxs/desktopio/gui.hpp index 3e1240a6c4..388b0dfa4f 100644 --- a/src/netxs/desktopio/gui.hpp +++ b/src/netxs/desktopio/gui.hpp @@ -5642,9 +5642,9 @@ namespace netxs::gui } return !!(vkstat[virtcod] & 0x80); } - bool keybd_test_pressed_ex(si32 virtcod, si32 keycode = 0) + bool keybd_test_pressed_ex(si32 ext_virtcod, si32 keycode = 0) { - return keybd_test_pressed(virtcod, keycode); + return keybd_test_pressed(ext_virtcod & 0xFF, keycode); // Fliter extflag on win32. } bool keybd_read_pressed(si32 virtcod) { @@ -6692,7 +6692,7 @@ namespace netxs::gui modifier_map_t modifier_map{}; // window: Dynamic modifier bit bindings for compose processing. std::array keycode_to_vkey{}; // window: Latin keycodes to vkey lut. std::array vkey_to_keycode{}; // window: vkey to national keycodes lut. - std::array extvkey_to_keycode{}; // window: vkey+extflag to keycodes lut. 512: 8bit + extflag. + std::array key_all_to_keycode{}; // window: key ALL to keycodes lut. x11::compose compose{ modifier_map }; // window: POSIX Compose state machine. std::unordered_map timer_threads; // window: Timer threads. @@ -7473,6 +7473,8 @@ namespace netxs::gui gear.xlayout = xlayout; gear.cluster = cluster; if constexpr (debugmode) log("shifted='%%' unshift='%%'", utf::debase(gear.shifted), utf::debase(gear.unshift)); + //if constexpr (debugmode) log("key_all=%% virtcod=0x%% scancod=0x%% extflag=%%", key_all, utf::to_hex(virtcod), utf::to_hex(scancod), extflag); + //todo switch to r/lshift, r/lctrl, r/lalt auto repeat_ctrl = keystat == input::key::repeated && (virtcod == vkey::shift || virtcod == vkey::ctrl || virtcod == vkey::alt || virtcod == vkey::capslock || virtcod == vkey::numlock || virtcod == vkey::scrllock || virtcod == vkey::lsuper || virtcod == vkey::rsuper || virtcod == vkey::altgr); @@ -7488,9 +7490,9 @@ namespace netxs::gui { return netxs::get_bit(vkstat, vkey_to_keycode[virtcod]); } - bool keybd_test_pressed_ex(si32 ext_virtcod, si32 /*keycode*/ = 0) + bool keybd_test_pressed_ex(si32 /*ext_virtcod*/, si32 key_all) { - return netxs::get_bit(vkstat, extvkey_to_keycode[ext_virtcod & 0x1FF]); // 0x1FF: 8bit + extflag. + return netxs::get_bit(vkstat, key_all_to_keycode[key_all]); } bool keybd_test_toggled(si32 virtcod) { @@ -7585,18 +7587,24 @@ namespace netxs::gui { latin_changed = std::exchange(hkl_latin, _keybd_find_latin_layout()) != hkl_latin; } - // Refill extvkey_to_keycode[virtcode] lookup table. + // Refill key_all_to_keycode[key_all] lookup table. if (latin_changed) { - extvkey_to_keycode = {}; + key_all_to_keycode = {}; for (auto keycode = 0; keycode < 256; keycode++) { if (auto latin_keysym = _get_keysym(keycode, hkl_latin)) if (auto latin_keyall = input::key::xkb_to_all(latin_keysym)) { - auto& keyrec = input::key::map::data(latin_keyall); - auto virtcod = keyrec.vkey & 0x1FF; // 0x1FF: 8bit + extflag. - extvkey_to_keycode[virtcod] = keycode; + auto& keycode_ref = key_all_to_keycode[latin_keyall]; + if (!keycode_ref) // Don't override. + { + keycode_ref = keycode; + } + else + { + if constexpr (debugmode) log("duplicates: latin_keyall1(%%)=keycode1(0x%%) latin_keyall2(%%)=keycode2(0x%%)", latin_keyall, utf::to_hex(keycode_ref), latin_keyall, utf::to_hex(keycode)); + } } } } diff --git a/src/netxs/desktopio/input.hpp b/src/netxs/desktopio/input.hpp index 7ec9348651..9a00b6adf4 100644 --- a/src/netxs/desktopio/input.hpp +++ b/src/netxs/desktopio/input.hpp @@ -2433,8 +2433,11 @@ namespace netxs::input //log("\tcheck keyid=%%", input::key::map::data(keyid).name); auto is_released = test_if_key_released(val.vcode, keyid); // Check if it is still pressed. auto same = k.keycode == keyid - && k.scancod == val.scode - && k.virtcod == val.vcode; + && k.virtcod == val.vcode + && k.scancod == (val.scode & 0xFF) + && k.extflag == !!(val.scode & 0x100); + //log("k.keycode=%% k.virtcod=0x%% k.scancod=0x%% k.extflag=%% same=%%", k.keycode, utf::to_hex(k.virtcod), utf::to_hex(k.scancod), k.extflag, same); + //log("val.vcode=0x%% val.scode=0x%% is_released=%%", utf::to_hex(val.vcode), utf::to_hex(val.scode), is_released); if (!is_released) { if (same && k.keystat == input::key::pressed) // The same key was pressed twice without releasing. @@ -2479,7 +2482,7 @@ namespace netxs::input if (k.keystat == input::key::pressed && (vk_valid || sc_valid)) // Filter IME/pasted clusters in chords (sc=0 vk=0). { auto& key = pushed[k.keycode]; - key.scode = k.scancod | (k.extflag ? 0x100 : 0); // Store the scan code of a pressed key. + key.scode = k.scancod | (k.extflag << 8); // Store the scan code of a pressed key. key.vcode = k.virtcod; // Store the virtual code to check later that it is still pressed. key.stamp = datetime::now(); } diff --git a/src/vtm.xml b/src/vtm.xml index 6c825db451..058a2b49c7 100644 --- a/src/vtm.xml +++ b/src/vtm.xml @@ -4,7 +4,7 @@ R"==( - +