Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion doc/architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion doc/settings.md
Original file line number Diff line number Diff line change
Expand Up @@ -842,7 +842,7 @@ Notes

<!-- Application configuration. -->
<config=/Colors | /Scripting | /Macro> <!-- Include additional namespaces: "/Colors", "/Scripting", and "/Macro". -->
<gui> <!-- GUI-specific settings (currently win32 platform only). -->
<gui> <!-- GUI-specific settings. -->
<antialiasing=on/> <!-- Glyph antialiasing. Note: Multi-layered color glyphs (e.g., emojis) are always antialiased. -->
<cellheight=21/> <!-- Text cell height in physical pixels. Note: Cell width is determined by the primary font (the first in the list). -->
<gridsize=""/> <!-- Initial window grid size as "width,height" in text cells. If empty or "0,0", the OS window manager determines the size. -->
Expand Down
2 changes: 1 addition & 1 deletion src/netxs/desktopio/application.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
28 changes: 18 additions & 10 deletions src/netxs/desktopio/gui.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down Expand Up @@ -6692,7 +6692,7 @@ namespace netxs::gui
modifier_map_t modifier_map{}; // window: Dynamic modifier bit bindings for compose processing.
std::array<byte, 256> keycode_to_vkey{}; // window: Latin keycodes to vkey lut.
std::array<byte, 256> vkey_to_keycode{}; // window: vkey to national keycodes lut.
std::array<byte, 512> extvkey_to_keycode{}; // window: vkey+extflag to keycodes lut. 512: 8bit + extflag.
std::array<byte, input::key::lastKey> key_all_to_keycode{}; // window: key ALL to keycodes lut.
x11::compose compose{ modifier_map }; // window: POSIX Compose state machine.

std::unordered_map<ui32, std::jthread> timer_threads; // window: Timer threads.
Expand Down Expand Up @@ -7473,6 +7473,8 @@ namespace netxs::gui
gear.xlayout = xlayout;
gear.cluster = cluster;
if constexpr (debugmode) log("shifted='%%' unshift='%%'", utf::debase<faux, faux>(gear.shifted), utf::debase<faux, faux>(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);
Expand All @@ -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)
{
Expand Down Expand Up @@ -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));
}
}
}
}
Expand Down
9 changes: 6 additions & 3 deletions src/netxs/desktopio/input.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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();
}
Expand Down
2 changes: 1 addition & 1 deletion src/vtm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ R"==(<include*/> <!-- Ordered list of <include="/path/to/settings.xml"/>. Clear

<!-- Application configuration. -->
<config=/Colors | /Scripting | /Macro> <!-- Include additional namespaces: "/Colors", "/Scripting", and "/Macro". -->
<gui> <!-- GUI-specific settings (currently win32 platform only). -->
<gui> <!-- GUI-specific settings. -->
<antialiasing=on/> <!-- Glyph antialiasing. Note: Multi-layered color glyphs (e.g., emojis) are always antialiased. -->
<cellheight=21/> <!-- Text cell height in physical pixels. Note: Cell width is determined by the primary font (the first in the list). -->
<gridsize=""/> <!-- Initial window grid size as "width,height" in text cells. If empty or "0,0", the OS window manager determines the size. -->
Expand Down