diff --git a/doc/apps.md b/doc/apps.md index 7961730ee7..d16b2a9435 100644 --- a/doc/apps.md +++ b/doc/apps.md @@ -67,9 +67,9 @@ Note: It is possible to combine multiple command into a single sequence using a ### Custom menu configuration -Terminal window menu can be composed from scratch by specifying a list of menu items in the `` configuration file section. +Terminal window menu can be composed from scratch by specifying a list of menu items in the `` configuration file section. -### Attributes for the `` object +### Attributes for the `` object Attribute | Description -----------|------------ @@ -79,7 +79,7 @@ tooltip | Tooltip text. action | The function name which called on item activation. Inherited by the label attribute. data | Textual parameter for function call. Inherited by the label attribute. -### Attributes for the `` sub-object +### Attributes for the `` sub-object Attribute | Description -----------------|------------ @@ -105,7 +105,7 @@ Value | Arguments (`data=`) | Description Noop | | Ignore all events for the specified key combination. No further processing. DropAutoRepeat | | Ignore `Key Repeat` events for the specified key combination. This binding should be specified before the main action for the key combination. SwitchHotkeyScheme | _`Scheme name`_ | Switch the hotkey scheme to the specified one. -TerminalCwdSync | | Current working directory sync toggle. The command to send for synchronization is configurable via the `` setting's option. Where `$P` is a variable containing current path received via OSC 9;9 notification.
To enable OSC9;9 shell notifications:
- Windows Command Prompt:
`setx PROMPT $e]9;9;$P$e\$P$G`
- PowerShell:
`function prompt{ $e=[char]27; "$e]9;9;$(Convert-Path $pwd)$e\PS $pwd$('>' * ($nestedPromptLevel + 1)) " }`
- Bash:
`export PS1='\[\033]9;9;\w\033\\\]${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '` +TerminalCwdSync | | Current working directory sync toggle. The command to send for synchronization is configurable via the `` setting's option. Where `$P` is a variable containing current path received via OSC 9;9 notification.
To enable OSC9;9 shell notifications:
- Windows Command Prompt:
`setx PROMPT $e]9;9;$P$e\$P$G`
- PowerShell:
`function prompt{ $e=[char]27; "$e]9;9;$(Convert-Path $pwd)$e\PS $pwd$('>' * ($nestedPromptLevel + 1)) " }`
- Bash:
`export PS1='\[\033]9;9;\w\033\\\]${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '` TerminalWrapMode | `on` \| `off` | Set terminal scrollback lines wrapping mode. Applied to the active selection if it is. TerminalAlignMode | `left` \| `right` \| `center` | Set terminal scrollback lines aligning mode. Applied to the active selection if it is. TerminalFindNext | | Highlight next match of selected text fragment. Clipboard content is used if no active selection. @@ -174,7 +174,7 @@ Hotkey | Description #### Terminal configuration example ```xml - + @@ -304,14 +304,14 @@ Hotkey | Description - + - + @@ -339,7 +339,7 @@ Hotkey | Description - + @@ -350,7 +350,7 @@ Hotkey | Description - + ``` diff --git a/doc/architecture.md b/doc/architecture.md index 7137509f0a..4316fd3f89 100644 --- a/doc/architecture.md +++ b/doc/architecture.md @@ -512,8 +512,8 @@ echo "vtm.del()" | vtm ``` # Add new menu items echo "vtm.set(id=Term label='Terminal' type=dtvt cmd='vtm -r term')" | vtm -echo "vtm.set(id=White label='White Terminal' type=dtvt cmd='vtm -r term' cfg='')" | vtm -echo "vtm.set(id=Huge label='Huge Terminal' type=dtvt cmd='vtm -r term' cfg='')" | vtm +echo "vtm.set(id=White label='White Terminal' type=dtvt cmd='vtm -r term' cfg='')" | vtm +echo "vtm.set(id=Huge label='Huge Terminal' type=dtvt cmd='vtm -r term' cfg='')" | vtm echo "vtm.set(id=Tile label='Three Terminals' type=tile cmd='v(h(Term, White), Huge)')" | vtm echo "vtm.set(id=cmd label='Remote cmd over SSH' type=dtty cmd='ssh user@server vtm cmd')" | vtm ``` diff --git a/doc/command-line-options.md b/doc/command-line-options.md index dc79210373..e9780356ab 100644 --- a/doc/command-line-options.md +++ b/doc/command-line-options.md @@ -41,12 +41,12 @@ Option | Description The plain xml-data could be specified in place of `` in `--config ` option: - `command-line`: ```cmd - vtm -c "" -r term + vtm -c "" -r term ``` or (using compact syntax) - `command-line`: ```cmd - vtm -c "" -r term + vtm -c "" -r term ``` ### Desktop Applets diff --git a/doc/settings.md b/doc/settings.md index 55f39d13b8..b5302587cb 100644 --- a/doc/settings.md +++ b/doc/settings.md @@ -229,9 +229,9 @@ The following declarations have the same meaning: ... - + ... - + @@ -251,12 +251,12 @@ The following declarations have the same meaning: ... - + ... - + ``` @@ -599,7 +599,7 @@ Notes " RightClick to set as default " - + @@ -607,14 +607,14 @@ Notes - + - + @@ -668,7 +668,7 @@ Notes - + @@ -707,7 +707,7 @@ Notes - + @@ -774,8 +774,7 @@ Notes " Left+RightClick to clear clipboard " - - + " Toggle hotkey scheme \n" @@ -827,7 +826,7 @@ Notes close: Always close. restart: Restart session. retry: Restart session if exit code != 0. --> - + @@ -871,7 +870,7 @@ Notes - + @@ -911,7 +910,7 @@ Notes - + ``` diff --git a/src/netxs/apps.hpp b/src/netxs/apps.hpp index 1b3a844f97..10f7b115a3 100644 --- a/src/netxs/apps.hpp +++ b/src/netxs/apps.hpp @@ -392,7 +392,7 @@ namespace netxs::app::shared ->active(window_clr); auto dtvt = ui::dtvt::ctor(); auto scrl = term->attach(ui::rail::ctor()); - auto defclr = config.take("/config/term/colors/default", cell{}.fgc(whitelt).bgc(blackdk)); + auto defclr = config.take("/config/terminal/colors/default", cell{}.fgc(whitelt).bgc(blackdk)); auto inst = scrl->attach(ui::term::ctor(config)) ->plugin(pro::focus::mode::focused) ->colors(defclr.fgc(), defclr.bgc()) diff --git a/src/netxs/apps/term.hpp b/src/netxs/apps/term.hpp index b486cb95c8..f2504f6271 100644 --- a/src/netxs/apps/term.hpp +++ b/src/netxs/apps/term.hpp @@ -92,9 +92,9 @@ namespace netxs::app::terminal namespace attr { - static constexpr auto cwdsync = "/config/term/cwdsync"; - static constexpr auto borders = "/config/term/border"; - static constexpr auto menuitems = "/config/term/menu/item"; + static constexpr auto cwdsync = "/config/terminal/cwdsync"; + static constexpr auto borders = "/config/terminal/border"; + static constexpr auto menuitems = "/config/terminal/menu/item"; } using events = netxs::events::userland::terminal; @@ -642,7 +642,7 @@ namespace netxs::app::terminal }; list.push_back({ item, setup }); } - config.cd("/config/term", "/config/defapp"); + config.cd("/config/terminal", "/config/defapp"); return menu::create(config, list); } } @@ -760,7 +760,7 @@ namespace netxs::app::terminal window//->plugin() //->plugin() ->plugin(); - auto defclr = config.take("/config/term/colors/default", cell{}.fgc(whitelt).bgc(blackdk)); + auto defclr = config.take("/config/terminal/colors/default", cell{}.fgc(whitelt).bgc(blackdk)); auto layers = window->attach(ui::cake::ctor()) ->colors(window_clr) ->limits(dot_11); diff --git a/src/netxs/desktopio/application.hpp b/src/netxs/desktopio/application.hpp index 9ab42be61b..38efe65d16 100644 --- a/src/netxs/desktopio/application.hpp +++ b/src/netxs/desktopio/application.hpp @@ -24,7 +24,7 @@ namespace netxs::app namespace netxs::app::shared { - static const auto version = "v0.9.99.51"; + static const auto version = "v0.9.99.52"; 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/console.hpp b/src/netxs/desktopio/console.hpp index f173407bac..3a16e913e4 100644 --- a/src/netxs/desktopio/console.hpp +++ b/src/netxs/desktopio/console.hpp @@ -111,6 +111,7 @@ namespace netxs::ui pipe& canal; // link: Data highway. gate& owner; // link: Link owner. flag alive; // link: sysclose isn't sent. + wptr owner_wptr; // link: . // link: Send data outside. void run() @@ -134,20 +135,27 @@ namespace netxs::ui canal{ canal }, owner{ owner }, alive{ true } - { } + { + auto oneshot = ptr::shared(hook{}); + owner.LISTEN(tier::anycast, e2::form::upon::started, root, *oneshot, (oneshot)) + { + owner_wptr = owner.This(); + oneshot->reset(); + }; + } // link: Send an event message to the link owner. template void notify(E, T&& data, si32 Tier = tier::release) { - owner.bell::enqueue(owner.This(), [Tier, d = data](auto& boss) mutable + owner.bell::enqueue(owner_wptr, [Tier, d = data](auto& boss) mutable { boss.bell::signal(Tier, E::id, d); }); } void handle(s11n::xs::req_input_fields lock) { - owner.bell::enqueue(owner.This(), [&, item = lock.thing](auto& /*boss*/) mutable + owner.bell::enqueue(owner_wptr, [&, item = lock.thing](auto& /*boss*/) mutable { auto ext_gear_id = item.gear_id; auto int_gear_id = owner.get_int_gear_id(ext_gear_id); diff --git a/src/netxs/desktopio/gui.hpp b/src/netxs/desktopio/gui.hpp index 611bdc138b..91c64634ea 100644 --- a/src/netxs/desktopio/gui.hpp +++ b/src/netxs/desktopio/gui.hpp @@ -1761,7 +1761,7 @@ namespace netxs::gui { auto copy = lock.thing; //todo implement - //owner.bell::enqueue(owner.This(), [tooltips = std::move(copy)](auto& boss) mutable + //owner.bell::enqueue(owner_wptr, [tooltips = std::move(copy)](auto& boss) mutable //{ // for (auto& tooltip : tooltips) // { @@ -1792,16 +1792,17 @@ namespace netxs::gui void handle(s11n::xs::expose /*lock*/) { owner.window_post_command(ipc::expose_win); - //owner.bell::enqueue(owner.This(), [&](auto& /*boss*/) + //owner.bell::enqueue(owner_wptr, [&](auto& /*boss*/) //{ // owner.base::riseup(tier::preview, e2::form::layout::expose); //}); } void handle(s11n::xs::sysfocus lock) { + auto f = lock.thing; + lock.unlock(); auto guard = owner.sync(); // Guard the owner.This() call. auto owner_ptr = owner.This(); - auto& f = lock.thing; if (f.state) { if (owner.mfocus.focused()) // We are the focus tree endpoint. @@ -1821,7 +1822,8 @@ namespace netxs::gui } void handle(s11n::xs::hotkey_scheme lock) { - auto& k = lock.thing; + auto k = lock.thing; + lock.unlock(); auto guard = owner.sync(); if (auto gear_ptr = owner.bell::getref(k.gear_id)) { @@ -1831,16 +1833,20 @@ namespace netxs::gui } void handle(s11n::xs::syskeybd lock) { + auto keybd = lock.thing; + lock.unlock(); + auto guard = owner.sync(); auto& gear = *gears; - auto& keybd = lock.thing; gear.alive = true; keybd.syncto(gear); owner.bell::signal(tier::release, hids::events::keybd::key::post, gear); }; void handle(s11n::xs::mouse_event lock) { + auto mouse = lock.thing; + lock.unlock(); + auto guard = owner.sync(); auto& gear = *gears; - auto& mouse = lock.thing; auto basis = gear.owner.base::coor(); owner.global(basis); gear.replay(mouse.cause, mouse.coord - basis, mouse.click - basis, mouse.delta, mouse.buttons, mouse.ctlstat, mouse.whlfp, mouse.whlsi, mouse.hzwhl); @@ -1848,13 +1854,15 @@ namespace netxs::gui } void handle(s11n::xs::warping lock) { - auto& warp = lock.thing; + auto warp = lock.thing; + lock.unlock(); + auto guard = owner.sync(); owner.warp_window(warp.warpdata); } void handle(s11n::xs::fps /*lock*/) { //todo revise - //owner.bell::enqueue(owner.This(), [&, fps = lock.thing.frame_rate](auto& /*boss*/) mutable + //owner.bell::enqueue(owner_wptr, [&, fps = lock.thing.frame_rate](auto& /*boss*/) mutable //{ // owner.bell::signal(tier::general, e2::config::fps, fps); //}); @@ -1866,7 +1874,7 @@ namespace netxs::gui void handle(s11n::xs::fatal /*lock*/) { //todo revise - //owner.bell::enqueue(owner.This(), [&, utf8 = lock.thing.err_msg](auto& /*boss*/) + //owner.bell::enqueue(owner_wptr, [&, utf8 = lock.thing.err_msg](auto& /*boss*/) //{ // owner.errmsg = owner.genmsg(utf8); // owner.deface(); @@ -1882,7 +1890,7 @@ namespace netxs::gui void handle(s11n::xs::sysstart /*lock*/) { //todo revise - //owner.bell::enqueue(owner.This(), [&](auto& /*boss*/) + //owner.bell::enqueue(owner_wptr, [&](auto& /*boss*/) //{ // owner.base::riseup(tier::release, e2::form::global::sysstart, 1); //}); @@ -1890,7 +1898,7 @@ namespace netxs::gui void handle(s11n::xs::cwd /*lock*/) { //todo revise - //owner.bell::enqueue(owner.This(), [&, path = lock.thing.path](auto& /*boss*/) + //owner.bell::enqueue(owner_wptr, [&, path = lock.thing.path](auto& /*boss*/) //{ // owner.base::riseup(tier::preview, e2::form::prop::cwd, path); //}); diff --git a/src/netxs/desktopio/scripting.hpp b/src/netxs/desktopio/scripting.hpp index eb594d2acd..c85b1b8df2 100644 --- a/src/netxs/desktopio/scripting.hpp +++ b/src/netxs/desktopio/scripting.hpp @@ -121,7 +121,7 @@ namespace netxs::scripting { //todo initiate global shutdown - //owner.bell::enqueue(owner.This(), [&, code](auto& boss) mutable + //owner.bell::enqueue(owner_wptr, [&, code](auto& boss) mutable //{ // if (code) log(ansi::bgc(reddk).fgc(whitelt).add('\n', prompt::repl, "Exit code ", utf::to_hex_0x(code), ' ').nil()); // else log(prompt::repl, "Exit code 0"); diff --git a/src/netxs/desktopio/terminal.hpp b/src/netxs/desktopio/terminal.hpp index a49f9161ec..61d0492fad 100644 --- a/src/netxs/desktopio/terminal.hpp +++ b/src/netxs/desktopio/terminal.hpp @@ -205,53 +205,53 @@ namespace netxs::ui { "invert", commands::fx::invert }, { "reverse", commands::fx::reverse }}; - send_input = config.take("/config/term/sendinput", text{}); - def_mxline = std::max(1, config.take("/config/term/scrollback/maxline", si32{ 65535 })); - def_length = std::max(1, config.take("/config/term/scrollback/size", si32{ 40000 })); - def_growdt = std::max(0, config.take("/config/term/scrollback/growstep", si32{ 0 } )); - def_growmx = std::max(0, config.take("/config/term/scrollback/growlimit", si32{ 0 } )); + send_input = config.take("/config/terminal/sendinput", text{}); + def_mxline = std::max(1, config.take("/config/terminal/scrollback/maxline", si32{ 65535 })); + def_length = std::max(1, config.take("/config/terminal/scrollback/size", si32{ 40000 })); + def_growdt = std::max(0, config.take("/config/terminal/scrollback/growstep", si32{ 0 } )); + def_growmx = std::max(0, config.take("/config/terminal/scrollback/growlimit", si32{ 0 } )); recalc_buffer_metrics(def_length, def_growdt, def_growmx); - def_wrpmod = config.take("/config/term/scrollback/wrap", deco::defwrp == wrap::on) ? wrap::on : wrap::off; - resetonkey = config.take("/config/term/scrollback/reset/onkey", true); - resetonout = config.take("/config/term/scrollback/reset/onoutput", faux); - def_alt_on = config.take("/config/term/scrollback/altscroll", true); - def_lucent = std::max(0, config.take("/config/term/scrollback/oversize/opacity",si32{ 0xC0 } )); - def_margin = std::max(0, config.take("/config/term/scrollback/oversize", si32{ 0 } )); - def_tablen = std::max(1, config.take("/config/term/tablen", si32{ 8 } )); - def_border = std::max(0, config.take("/config/term/border", si32{ 0 } )); - def_selmod = config.take("/config/term/selection/mode", mime::textonly, xml::options::format); - def_selalt = config.take("/config/term/selection/rect", faux); + def_wrpmod = config.take("/config/terminal/scrollback/wrap", deco::defwrp == wrap::on) ? wrap::on : wrap::off; + resetonkey = config.take("/config/terminal/scrollback/reset/onkey", true); + resetonout = config.take("/config/terminal/scrollback/reset/onoutput", faux); + def_alt_on = config.take("/config/terminal/scrollback/altscroll", true); + def_lucent = std::max(0, config.take("/config/terminal/scrollback/oversize/opacity",si32{ 0xC0 } )); + def_margin = std::max(0, config.take("/config/terminal/scrollback/oversize", si32{ 0 } )); + def_tablen = std::max(1, config.take("/config/terminal/tablen", si32{ 8 } )); + def_border = std::max(0, config.take("/config/terminal/border", si32{ 0 } )); + def_selmod = config.take("/config/terminal/selection/mode", mime::textonly, xml::options::format); + def_selalt = config.take("/config/terminal/selection/rect", faux); def_cur_on = config.take("/config/cursor/show", true); def_cursor = config.take("/config/cursor/style", text_cursor::I_bar, xml::options::cursor); def_curclr = config.take("/config/cursor/color", cell{}); def_period = config.take("/config/cursor/blink", span{ skin::globals().blink_period }); def_io_log = config.take("/config/debug/logs", faux); allow_logs = true; // Disallowed for dtty. - def_atexit = config.take("/config/term/atexit", commands::atexit::smart, atexit_options); - def_fcolor = config.take("/config/term/colors/default/fgc", argb{ whitelt }); - def_bcolor = config.take("/config/term/colors/default/bgc", argb{ blackdk }); - def_filler = config.take("/config/term/colors/bground", argb{ argb::default_color }); - - def_safe_c = config.take("/config/term/colors/selection/protected", cell{}.bgc(bluelt) .fgc(whitelt)); - def_ansi_c = config.take("/config/term/colors/selection/ansi", cell{}.bgc(bluelt) .fgc(whitelt)); - def_rich_c = config.take("/config/term/colors/selection/rich", cell{}.bgc(bluelt) .fgc(whitelt)); - def_html_c = config.take("/config/term/colors/selection/html", cell{}.bgc(bluelt) .fgc(whitelt)); - def_text_c = config.take("/config/term/colors/selection/text", cell{}.bgc(bluelt) .fgc(whitelt)); - def_none_c = config.take("/config/term/colors/selection/none", cell{}.bgc(blacklt) .fgc(whitedk)); - def_find_c = config.take("/config/term/colors/match", cell{}.bgc(0xFF007F00).fgc(whitelt)); - - def_safe_f = config.take("/config/term/colors/selection/protected/fx", commands::fx::color, fx_options); - def_ansi_f = config.take("/config/term/colors/selection/ansi/fx", commands::fx::xlight, fx_options); - def_rich_f = config.take("/config/term/colors/selection/rich/fx", commands::fx::xlight, fx_options); - def_html_f = config.take("/config/term/colors/selection/html/fx", commands::fx::xlight, fx_options); - def_text_f = config.take("/config/term/colors/selection/text/fx", commands::fx::color, fx_options); - def_none_f = config.take("/config/term/colors/selection/none/fx", commands::fx::color, fx_options); - def_find_f = config.take("/config/term/colors/match/fx", commands::fx::color, fx_options); + def_atexit = config.take("/config/terminal/atexit", commands::atexit::smart, atexit_options); + def_fcolor = config.take("/config/terminal/colors/default/fgc", argb{ whitelt }); + def_bcolor = config.take("/config/terminal/colors/default/bgc", argb{ blackdk }); + def_filler = config.take("/config/terminal/colors/bground", argb{ argb::default_color }); + + def_safe_c = config.take("/config/terminal/colors/selection/protected", cell{}.bgc(bluelt) .fgc(whitelt)); + def_ansi_c = config.take("/config/terminal/colors/selection/ansi", cell{}.bgc(bluelt) .fgc(whitelt)); + def_rich_c = config.take("/config/terminal/colors/selection/rich", cell{}.bgc(bluelt) .fgc(whitelt)); + def_html_c = config.take("/config/terminal/colors/selection/html", cell{}.bgc(bluelt) .fgc(whitelt)); + def_text_c = config.take("/config/terminal/colors/selection/text", cell{}.bgc(bluelt) .fgc(whitelt)); + def_none_c = config.take("/config/terminal/colors/selection/none", cell{}.bgc(blacklt) .fgc(whitedk)); + def_find_c = config.take("/config/terminal/colors/match", cell{}.bgc(0xFF007F00).fgc(whitelt)); + + def_safe_f = config.take("/config/terminal/colors/selection/protected/fx", commands::fx::color, fx_options); + def_ansi_f = config.take("/config/terminal/colors/selection/ansi/fx", commands::fx::xlight, fx_options); + def_rich_f = config.take("/config/terminal/colors/selection/rich/fx", commands::fx::xlight, fx_options); + def_html_f = config.take("/config/terminal/colors/selection/html/fx", commands::fx::xlight, fx_options); + def_text_f = config.take("/config/terminal/colors/selection/text/fx", commands::fx::color, fx_options); + def_none_f = config.take("/config/terminal/colors/selection/none/fx", commands::fx::color, fx_options); + def_find_f = config.take("/config/terminal/colors/match/fx", commands::fx::color, fx_options); std::copy(std::begin(argb::vt256), std::end(argb::vt256), std::begin(def_colors)); for (auto i = 0; i < 16; i++) { - def_colors[i] = config.take("/config/term/colors/color" + std::to_string(i), def_colors[i]); + def_colors[i] = config.take("/config/terminal/colors/color" + std::to_string(i), def_colors[i]); } } }; @@ -7760,7 +7760,7 @@ namespace netxs::ui chords.proc("TerminalOutput", [&](hids& gear, txts& args){ gear.set_handled(); if (args.size()) data_in(args.front()); }); chords.proc("TerminalAlignMode", [&](hids& gear, txts& args){ gear.set_handled(); if (args.empty()) exec_cmd(commands::ui::togglejet); else set_align((si32)netxs::get_or(xml::options::align, args.front(), bias::none)); }); chords.proc("TerminalWrapMode", [&](hids& gear, txts& args){ gear.set_handled(); if (args.empty()) exec_cmd(commands::ui::togglewrp); else set_wrapln(1 + (si32)!xml::take_or(args.front(), true)); }); - auto bindings = chords.load(xml_config, "term"); + auto bindings = chords.load(xml_config, "terminal"); for (auto& r : bindings) { chords.bind(r.chord, r.scheme, r.actions); @@ -7974,10 +7974,11 @@ namespace netxs::ui using input_fields_handler::handle; dtvt& owner; // evnt: Terminal object reference. + wptr owner_wptr; void handle(s11n::xs::bitmap_dtvt /*lock*/) { - owner.bell::enqueue(owner.This(), [&](auto& /*boss*/) mutable + owner.bell::enqueue(owner_wptr, [&](auto& /*boss*/) mutable { owner.base::deface(); }); @@ -7985,15 +7986,14 @@ namespace netxs::ui void handle(s11n::xs::jgc_list lock) { s11n::receive_jgc(lock); - owner.bell::enqueue(owner.This(), [&](auto& /*boss*/) mutable + owner.bell::enqueue(owner_wptr, [&](auto& /*boss*/) mutable { owner.base::deface(); }); } void handle(s11n::xs::tooltips lock) { - auto copy = lock.thing; - owner.bell::enqueue(owner.This(), [tooltips = std::move(copy)](auto& boss) mutable + owner.bell::enqueue(owner_wptr, [tooltips = lock.thing](auto& boss) mutable { for (auto& tooltip : tooltips) { @@ -8006,7 +8006,8 @@ namespace netxs::ui } void handle(s11n::xs::fullscrn lock) { - auto& m = lock.thing; + auto m = lock.thing; + lock.unlock(); if (owner.active) { auto guard = owner.sync(); @@ -8021,7 +8022,8 @@ namespace netxs::ui } void handle(s11n::xs::maximize lock) { - auto& m = lock.thing; + auto m = lock.thing; + lock.unlock(); if (owner.active) { auto guard = owner.sync(); @@ -8036,11 +8038,12 @@ namespace netxs::ui } void handle(s11n::xs::sysfocus lock) { + auto f = lock.thing; + lock.unlock(); if (owner.active) { auto guard = owner.sync(); // Guard the owner.This() call. auto owner_ptr = owner.This(); - auto& f = lock.thing; if (f.state) { pro::focus::set(owner_ptr, f.gear_id, f.focus_type); @@ -8053,7 +8056,8 @@ namespace netxs::ui } void handle(s11n::xs::hotkey_scheme lock) { - auto& k = lock.thing; + auto k = lock.thing; + lock.unlock(); if (owner.active) { auto guard = owner.sync(); @@ -8065,7 +8069,8 @@ namespace netxs::ui } void handle(s11n::xs::syskeybd lock) { - auto& k = lock.thing; + auto k = lock.thing; + lock.unlock(); if (owner.active) { auto guard = owner.sync(); @@ -8087,7 +8092,8 @@ namespace netxs::ui }; void handle(s11n::xs::mouse_event lock) { - auto& m = lock.thing; + auto m = lock.thing; + lock.unlock(); if (owner.active) { auto guard = owner.sync(); @@ -8105,8 +8111,7 @@ namespace netxs::ui } void handle(s11n::xs::minimize lock) { - auto& m = lock.thing; - owner.bell::enqueue(owner.This(), [&](auto& /*boss*/) + owner.bell::enqueue(owner_wptr, [&, m = lock.thing](auto& /*boss*/) { if (auto gear_ptr = owner.bell::getref(m.gear_id)) { @@ -8117,14 +8122,15 @@ namespace netxs::ui } void handle(s11n::xs::expose /*lock*/) { - owner.bell::enqueue(owner.This(), [&](auto& /*boss*/) + owner.bell::enqueue(owner_wptr, [&](auto& /*boss*/) { owner.base::riseup(tier::preview, e2::form::layout::expose); }); } void handle(s11n::xs::clipdata lock) { - auto& c = lock.thing; + auto c = lock.thing; + lock.unlock(); if (owner.active) { auto guard = owner.sync(); @@ -8136,7 +8142,8 @@ namespace netxs::ui } void handle(s11n::xs::clipdata_request lock) { - auto& c = lock.thing; + auto c = lock.thing; + lock.unlock(); if (owner.active) { auto guard = owner.sync(); @@ -8157,23 +8164,22 @@ namespace netxs::ui } void handle(s11n::xs::header lock) { - auto& h = lock.thing; - owner.bell::enqueue(owner.This(), [&, /*id = h.window_id,*/ header = h.utf8](auto& /*boss*/) mutable + owner.bell::enqueue(owner_wptr, [&, /*id = h.window_id,*/ header = lock.thing.utf8](auto& /*boss*/) mutable { owner.base::riseup(tier::preview, e2::form::prop::ui::header, header); }); } void handle(s11n::xs::footer lock) { - auto& f = lock.thing; - owner.bell::enqueue(owner.This(), [&, /*id = f.window_id,*/ footer = f.utf8](auto& /*boss*/) mutable + owner.bell::enqueue(owner_wptr, [&, /*id = f.window_id,*/ footer = lock.thing.utf8](auto& /*boss*/) mutable { owner.base::riseup(tier::preview, e2::form::prop::ui::footer, footer); }); } void handle(s11n::xs::header_request lock) { - auto& c = lock.thing; + auto c = lock.thing; + lock.unlock(); if (owner.active) { //todo use window_id @@ -8184,7 +8190,8 @@ namespace netxs::ui } void handle(s11n::xs::footer_request lock) { - auto& c = lock.thing; + auto c = lock.thing; + lock.unlock(); if (owner.active) { //todo use window_id @@ -8195,8 +8202,7 @@ namespace netxs::ui } void handle(s11n::xs::warping lock) { - auto& w = lock.thing; - owner.bell::enqueue(owner.This(), [&, /*id = w.window_id,*/ warp = w.warpdata](auto& /*boss*/) + owner.bell::enqueue(owner_wptr, [&, /*id = w.window_id,*/ warp = lock.thing.warpdata](auto& /*boss*/) { //todo use window_id owner.base::riseup(tier::preview, e2::form::layout::swarp, warp); @@ -8204,7 +8210,7 @@ namespace netxs::ui } void handle(s11n::xs::fps lock) { - owner.bell::enqueue(owner.This(), [&, fps = lock.thing.frame_rate](auto& /*boss*/) mutable + owner.bell::enqueue(owner_wptr, [&, fps = lock.thing.frame_rate](auto& /*boss*/) mutable { owner.bell::signal(tier::general, e2::config::fps, fps); }); @@ -8215,27 +8221,29 @@ namespace netxs::ui } void handle(s11n::xs::fatal lock) { - owner.bell::enqueue(owner.This(), [&, utf8 = lock.thing.err_msg](auto& /*boss*/) + owner.bell::enqueue(owner_wptr, [&, utf8 = lock.thing.err_msg](auto& /*boss*/) { owner.errmsg = owner.genmsg(utf8); owner.deface(); }); } - void handle(s11n::xs::sysclose /*lock*/) + void handle(s11n::xs::sysclose lock) { + lock.unlock(); + auto guard = owner.sync(); owner.active.exchange(faux); owner.stop(true); } void handle(s11n::xs::sysstart /*lock*/) { - owner.bell::enqueue(owner.This(), [&](auto& /*boss*/) + owner.bell::enqueue(owner_wptr, [&](auto& /*boss*/) { owner.base::riseup(tier::release, e2::form::global::sysstart, 1); }); } void handle(s11n::xs::cwd lock) { - owner.bell::enqueue(owner.This(), [&, path = lock.thing.path](auto& /*boss*/) + owner.bell::enqueue(owner_wptr, [&, path = lock.thing.path](auto& /*boss*/) { owner.base::riseup(tier::preview, e2::form::prop::cwd, path); }); @@ -8245,7 +8253,14 @@ namespace netxs::ui : s11n{ *this, owner.id }, input_fields_handler{ owner }, owner{ owner } - { } + { + auto oneshot = ptr::shared(hook{}); + owner.LISTEN(tier::anycast, e2::form::upon::started, root, *oneshot, (oneshot)) + { + owner_wptr = owner.This(); + oneshot->reset(); + }; + } }; struct msgs diff --git a/src/vtm.cpp b/src/vtm.cpp index 3f2d637eeb..ee5d6a1359 100644 --- a/src/vtm.cpp +++ b/src/vtm.cpp @@ -187,9 +187,9 @@ int main(int argc, char* argv[]) "\n Plain xml-data can be specified in place of in the '--config ' option," "\n as well as in the $VTM_CONFIG environment variable:" "\n" - "\n vtm -c \"\" -r term" + "\n vtm -c \"\" -r term" "\n or (using compact syntax)" - "\n vtm -c \"\" -r term" + "\n vtm -c \"\" -r term" "\n"); return 0; } diff --git a/src/vtm.xml b/src/vtm.xml index f5b2150248..1947ffca04 100644 --- a/src/vtm.xml +++ b/src/vtm.xml @@ -141,7 +141,7 @@ R"==( " RightClick to set as default " - + @@ -149,14 +149,14 @@ R"==( - + - + @@ -214,7 +214,7 @@ R"==( )==" R"==( - +
@@ -255,7 +255,7 @@ R"==( )==" // MSVC2022: C2026 String too big, trailing characters truncated. R"==( - + @@ -354,9 +354,9 @@ R"==( - - - + + + @@ -376,7 +376,7 @@ R"==( retry: Restart session if exit code != 0. --> )==" // MSVC2022: C2026 String too big, trailing characters truncated. R"==( - + @@ -431,7 +431,7 @@ R"==( - + @@ -471,6 +471,6 @@ R"==( - + )==" \ No newline at end of file