diff --git a/src/netxs/apps/shop.hpp b/src/netxs/apps/shop.hpp index 55b85fd91..79a2e3521 100644 --- a/src/netxs/apps/shop.hpp +++ b/src/netxs/apps/shop.hpp @@ -224,8 +224,10 @@ namespace netxs::app::shop for (auto& body : appstore_body) items->attach(ui::post::ctor()) ->upload(body) ->active() + ->plugin() ->plugin() - ->plugin(x3, c3, 250ms); + ->shader(cell::shaders::xlight, e2::form::state::hover) + ->shader(cell::shaders::color(c3), e2::form::state::keybd::focus::count); items->attach(ui::post::ctor()) ->upload(desktopio_body) ->plugin(); diff --git a/src/netxs/apps/tile.hpp b/src/netxs/apps/tile.hpp index f4115b3c2..9e5b702e5 100644 --- a/src/netxs/apps/tile.hpp +++ b/src/netxs/apps/tile.hpp @@ -91,20 +91,20 @@ namespace netxs::app::tile ->shader(cell::shaders::xlight, e2::form::state::hover) ->invoke([&](auto& boss) { - auto update_focus = [](auto& boss, auto state) + auto update_focus = [](auto& boss, auto count) { auto highlight_color = skin::color(tone::highlight); auto c3 = highlight_color; auto x3 = cell{ c3 }.alpha(0x00); - boss.base::color(state ? 0xFF00ff00 : x3.fgc(), x3.bgc()); + boss.base::color(count ? 0xFF00ff00 : x3.fgc(), x3.bgc()); }; auto data_shadow = ptr::shadow(data_src_sptr); boss.LISTEN(tier::release, e2::form::upon::vtree::attached, parent, boss.tracker, (data_shadow)) { if (auto data_ptr = data_shadow.lock()) { - data_ptr->RISEUP(tier::request, e2::form::state::keybd::focus::state, state, ()); - update_focus(boss, state); + data_ptr->RISEUP(tier::request, e2::form::state::keybd::focus::count, count, ()); + update_focus(boss, count); parent->resize(); } }; @@ -112,9 +112,9 @@ namespace netxs::app::tile { if (parent) parent->resize(); // Rebuild list. }; - data_src_sptr->LISTEN(tier::release, e2::form::state::keybd::focus::state, state, boss.tracker) + data_src_sptr->LISTEN(tier::release, e2::form::state::keybd::focus::count, count, boss.tracker) { - update_focus(boss, state); + update_focus(boss, count); }; data_src_sptr->LISTEN(tier::release, events::delist, object, boss.tracker) { diff --git a/src/netxs/desktopio/baseui.hpp b/src/netxs/desktopio/baseui.hpp index e76cb68d6..d75a64c47 100644 --- a/src/netxs/desktopio/baseui.hpp +++ b/src/netxs/desktopio/baseui.hpp @@ -471,7 +471,7 @@ namespace netxs::events::userland { EVENT_XS( on , const id_t ), EVENT_XS( off , const id_t ), - EVENT_XS( state , bool ), + EVENT_XS( count , si32 ), }; }; }; diff --git a/src/netxs/desktopio/controls.hpp b/src/netxs/desktopio/controls.hpp index 2c4c48251..46ba20233 100644 --- a/src/netxs/desktopio/controls.hpp +++ b/src/netxs/desktopio/controls.hpp @@ -731,9 +731,9 @@ namespace netxs::ui body{ position, dot_11 }, // Caret is always one cell size (see the term::scrollback definition). step{ freq } { - boss.LISTEN(tier::release, e2::form::state::keybd::focus::state, state, conf) + boss.LISTEN(tier::release, e2::form::state::keybd::focus::count, count, conf) { - down = !state; + down = !count; }; boss.LISTEN(tier::request, e2::config::caret::blink, req_step, conf) { @@ -1236,17 +1236,14 @@ namespace netxs::ui //todo std::list??? std::unordered_map is too expensive std::unordered_map gears; - template void signal_state() { - if constexpr (On == faux) + auto count = 0; + for (auto& [gear_id, route] : gears) { - for (auto& [gear_id, route] : gears) - { - if (gear_id != id_t{} && route.active) return; - } + if (gear_id != id_t{} && route.active) ++count; } - boss.SIGNAL(tier::release, e2::form::state::keybd::focus::state, On); + boss.SIGNAL(tier::release, e2::form::state::keybd::focus::count, count); } auto add_route(id_t gear_id, config cfg = { .active = faux, .focused = faux }) { @@ -1267,7 +1264,7 @@ namespace netxs::ui route.active = faux; gears[id_t{}] = std::move(route); boss.SIGNAL(tier::release, e2::form::state::keybd::focus::off, gear.id); - signal_state(); + signal_state(); } boss.SIGNAL(tier::release, hids::events::die, gear); gears.erase(iter); @@ -1425,7 +1422,7 @@ namespace netxs::ui { route.active = faux; boss.SIGNAL(tier::release, e2::form::state::keybd::focus::off, seed.id); - signal_state(); + signal_state(); } //if constexpr (debugmode) log(prompt::foci, text(seed.deep * 4, ' '), "bus::off gear:", seed.id, " hub:", boss.id); }; @@ -1562,14 +1559,13 @@ namespace netxs::ui if (gear_id != id_t{} && route.active) gear_id_list.push_back(gear_id); } }; - boss.LISTEN(tier::request, e2::form::state::keybd::focus::state, state, memo) + boss.LISTEN(tier::request, e2::form::state::keybd::focus::count, count, memo) { //todo revise: same as e2::form::state::keybd::check - state = faux; + count = 0; for (auto& [gear_id, route] : gears) { - state |= gear_id != id_t{} && route.active; - if (state) return; + if (gear_id != id_t{} && route.active) ++count; } }; boss.LISTEN(tier::request, e2::form::state::keybd::find, gear_test, memo) diff --git a/src/netxs/desktopio/terminal.hpp b/src/netxs/desktopio/terminal.hpp index 5f65794a2..9e1f1f0aa 100644 --- a/src/netxs/desktopio/terminal.hpp +++ b/src/netxs/desktopio/terminal.hpp @@ -384,11 +384,12 @@ namespace netxs::ui : owner{ owner }, encod{ prot::w32 } { - owner.LISTEN(tier::release, e2::form::state::keybd::focus::state, s, token) + owner.LISTEN(tier::release, e2::form::state::keybd::focus::count, count, token) { - if (state(s)) + auto focused = !!count; + if (state(focused)) { - owner.ipccon.focus(s, encod); + owner.ipccon.focus(focused, encod); } }; owner.SIGNAL(tier::request, e2::form::state::keybd::check, state.last);