Skip to content

Commit

Permalink
Pull apart mouse hover and keybd focus
Browse files Browse the repository at this point in the history
Merge pull request #445 from o-sdn-o/vt-input-mode
  • Loading branch information
o-sdn-o authored Oct 25, 2023
2 parents 808abe7 + 3c750fb commit 7f9fcf0
Show file tree
Hide file tree
Showing 20 changed files with 231 additions and 226 deletions.
1 change: 0 additions & 1 deletion doc/settings.md
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,6 @@ Note: The full defaut config is at [src/vtm.xml](../src/vtm.xml).
<viewport coor=0,0 />
<mouse dblclick=500ms />
<tooltips timeout=2000ms enabled=true fgc=pureblack bgc=purewhite />
<glowfx=true /> <!-- Show glow effect around selected item. -->
<debug overlay=off toggle="🐞" /> <!-- Display console debug info. -->
<regions enabled=0 /> <!-- Highlight UI objects boundaries. -->
</client>
Expand Down
5 changes: 3 additions & 2 deletions doc/vt-input-mode.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,15 @@ Anyone who wants to:
- Distinguish between Left and Right physical keys.
- Get consistent output regardless of terminal window resize.
- Track mouse outside the terminal window (getting negative coordinates).
- Take advantage of high-resolution wheel scrolling.
- Track scrollback text manipulation.
- Track application closing and system shutdown.
- Be independent of operating system and third party libraries.

Existing approaches have the following drawbacks:
- There is no uniform way to receive keyboard events.
- Window size tracking requires platform-specific calls with no way to synchronize the output.
- Mouse tracking modes lack support for negative coordinates and have a limited set of buttons.
- Mouse tracking modes lack support for negative coordinates, high-resolution wheel scrolling, and have a limited set of buttons.
- Bracketed paste mode does not support the transfer of binary data and data containing sequences of bracketed paste mode itself.

## Conventions
Expand Down Expand Up @@ -351,7 +352,7 @@ Attribute | Description
`kbmods=<KeyMods>` | Keyboard modifiers (see Keyboard event).
`coord=<X>,<Y>` | Mouse pointer coorinates.
`buttons=<ButtonState>` | Mouse button state.
`wheel=<DeltaY>,<DeltaX>` | Vertical and horizontal wheel delta.
`wheel=<DeltaY>,<DeltaX>` | Vertical and horizontal wheel high-resolution delta.

In response to the activation of `mouse` tracking, the application receives a vt-sequence containing current mouse state:
```
Expand Down
5 changes: 4 additions & 1 deletion src/netxs/apps.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ namespace netxs::app::shared
auto window = ui::cake::ctor();
auto strob = window->plugin<pro::focus>(pro::focus::mode::focused)
->plugin<pro::notes>(" Left+Right click to close ")
->active()
->invoke([](auto& boss)
{
//boss.keybd.accept(true);
Expand Down Expand Up @@ -96,6 +97,7 @@ namespace netxs::app::shared
->plugin<pro::cache>()
->plugin<pro::notes>(" Left+Right click to close ")
->attach(ui::stem_rate<tier::preview, decltype(e2::config::fps)>::ctor("Set frame rate limit", 1, 200, "fps"))
->active()
->colors(0xFFFFFFFF, bluedk)
->invoke([&](auto& boss)
{
Expand Down Expand Up @@ -130,7 +132,7 @@ namespace netxs::app::shared
};
});
auto object = window->attach(ui::mock::ctor())
->colors(0,0); //todo mouse tracking
->active();
return window;
};
auto build_Region = [](text cwd, text v, xmls& config, text patch)
Expand Down Expand Up @@ -312,6 +314,7 @@ namespace netxs::app::shared
auto test_stat_area = object->attach(slot::_2, ui::fork::ctor(axis::Y));
auto layers = test_stat_area->attach(slot::_1, ui::cake::ctor());
auto scroll = layers->attach(ui::rail::ctor())
->active()
->colors(whitelt, reddk);
scroll->attach(ui::post::ctor())
->upload(truecolor);
Expand Down
5 changes: 5 additions & 0 deletions src/netxs/apps/calc.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -360,10 +360,12 @@ namespace netxs::app::calc
auto func_line = func_body->attach(slot::_1, ui::fork::ctor());
auto fx_sum = func_line->attach(slot::_1, ui::fork::ctor());
auto fx = fx_sum->attach(slot::_1, ui::post::ctor())
->active()
->plugin<pro::fader>(c7, c3, fader)
->limits({ 3,-1 }, { 4,-1 })
->upload(ansi::wrp(wrap::off).add(" Fx "));
auto ellipsis = func_line->attach(slot::_2, ui::post::ctor())
->active()
->plugin<pro::fader>(c7, c3, fader)
->limits({ -1,1 }, { 3,-1 })
->upload(ansi::wrp(wrap::off).add(""));
Expand All @@ -375,8 +377,10 @@ namespace netxs::app::calc
auto rows_body = body_area->attach(slot::_2, ui::fork::ctor());
auto layers = rows_body->attach(slot::_2, ui::cake::ctor());
auto scroll = layers->attach(ui::rail::ctor())
->active()
->limits({ -1,1 }, { -1,-1 });
auto grid = scroll->attach(ui::post::ctor())
->active()
->colors(0xFF000000, 0xFFffffff)
->plugin<pro::cell_highlight>()
->upload(cellatix_text);
Expand Down Expand Up @@ -411,6 +415,7 @@ namespace netxs::app::calc
.bgc(whitelt).fgc(blackdk).add(" Sheet1 "));
auto plus_pad = sheet_plus->attach(slot::_2, ui::fork::ctor());
auto plus = plus_pad->attach(slot::_1, ui::post::ctor())
->active()
->plugin<pro::fader>(c7, c3, fader)
->limits({ 3,-1 }, { 3,-1 })
->upload(ansi::wrp(wrap::off).add(" + "));
Expand Down
1 change: 0 additions & 1 deletion src/netxs/apps/calc.xml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ R"==(
<viewport coor=0,0/>
<mouse dblclick=500ms/>
<tooltips timeout=2000ms enabled=true fgc=pureblack bgc=purewhite/>
<glowfx=true/> <!-- Show glow effect around selected item. -->
<debug overlay=0 toggle="🐞"/> <!-- Display console debug info. -->
<regions enabled=0/> <!-- Highlight UI objects boundaries. -->
</client>
Expand Down
Loading

0 comments on commit 7f9fcf0

Please sign in to comment.