Skip to content

Commit

Permalink
directvt#396 Filter mouse events with modifiers (ignore Num/Caps/Scrll)
Browse files Browse the repository at this point in the history
  • Loading branch information
o-sdn-o committed Sep 16, 2023
1 parent 62d7c90 commit 28b3d4d
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 36 deletions.
41 changes: 5 additions & 36 deletions src/netxs/apps/desk.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,9 @@ namespace netxs::app::desk
{
auto highlight_color = skin::globals().highlight;
auto inactive_color = skin::globals().inactive;
auto selected_color = skin::globals().selected;
auto c3 = highlight_color;
auto c9 = selected_color;
auto x3 = cell{ c3 }.alpha(0x00);
auto cA = inactive_color;

Expand Down Expand Up @@ -206,7 +208,7 @@ namespace netxs::app::desk
{
static auto offset = dot_00;

if (gear.meta()) // Not supported with any modifier.
if (gear.meta(hids::anyCtrl | hids::anyAlt | hids::anyShift | hids::anyWin)) // Not supported with any modifier.
{
gear.dismiss();
return;
Expand All @@ -221,39 +223,6 @@ namespace netxs::app::desk
boss.RISEUP(tier::request, e2::form::proceed::createby, gear);
gear.dismiss();
};
//auto& world = *data_src;
//boss.LISTEN(tier::release, hids::events::mouse::scroll::any, gear, -, (inst_id))
//{
// //if (auto data_src = data_src_shadow.lock())
// {
// sptr<desk::apps> registry_ptr;
// //data_src->SIGNAL(tier::request, desk::events::apps, registry_ptr);
// world.SIGNAL(tier::request, desk::events::apps, registry_ptr);
// auto& app_list = (*registry_ptr)[inst_id];
// if (app_list.size())
// {
// auto deed = boss.bell::protos<tier::release>();
// if (deed == hids::events::mouse::scroll::down.id) // Rotate list forward.
// {
// app_list.push_back(app_list.front());
// app_list.pop_front();
// }
// else // Rotate list backward.
// {
// app_list.push_front(app_list.back());
// app_list.pop_back();
// }
// // Expose window.
// auto& inst = *app_list.back();
// inst.RISEUP(tier::preview, e2::form::layout::expose, inst);
// auto center = inst.base::center();
// gear.owner.SIGNAL(tier::release, e2::form::layout::shift, center); // Goto to the window.
// gear.kb_offer_3(app_list.back());//pass_kb_focus(inst);
// pro::focus::set(app_list.back(), gear.id, pro::focus::solo::on, pro::focus::flip::off);
// gear.dismiss();
// }
// }
//};
});
if (!state) item_area->depend_on_collection(inst_ptr_list); // Remove not pinned apps, like Info.
auto block = item_area->attach(ui::fork::ctor(axis::Y));
Expand All @@ -262,10 +231,10 @@ namespace netxs::app::desk
->invoke([&](auto& boss)
{
auto boss_shadow = ptr::shadow(boss.This());
boss.LISTEN(tier::anycast, events::ui::selected, data, -, (inst_id, obj_desc))
boss.LISTEN(tier::anycast, events::ui::selected, data, -, (inst_id, obj_desc, c9))
{
auto selected = inst_id == data;
boss.set(ansi::fgx(selected ? 0xFF00ff00 : 0x00000000).add(obj_desc));
boss.set(ansi::fgx(selected ? c9.fgc() : 0x00000000).add(obj_desc));
boss.deface();
};
});
Expand Down
2 changes: 2 additions & 0 deletions src/netxs/desktopio/baseui.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -468,6 +468,7 @@ namespace netxs::ui
cell action;
cell label;
cell inactive;
cell selected;
cell menu_white;
cell menu_black;

Expand Down Expand Up @@ -512,6 +513,7 @@ namespace netxs::ui
case tone::prop::shadow: return g.shadow;
case tone::prop::selector: return g.selector;
case tone::prop::highlight: return g.highlight;
case tone::prop::selected: return g.selected;
case tone::prop::warning: return g.warning;
case tone::prop::danger: return g.danger;
case tone::prop::action: return g.action;
Expand Down
1 change: 1 addition & 0 deletions src/netxs/desktopio/console.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3659,6 +3659,7 @@ namespace netxs::ui
g.shadow = config.take("shadow" , cell{});//180);//5);
g.selector = config.take("selector" , cell{});//48);
g.highlight = config.take("highlight" , cell{});
g.selected = config.take("selected" , cell{});
g.warning = config.take("warning" , cell{});
g.danger = config.take("danger" , cell{});
g.action = config.take("action" , cell{});
Expand Down
1 change: 1 addition & 0 deletions src/netxs/desktopio/richtext.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2082,6 +2082,7 @@ namespace netxs::ui
X(warning , "Warning color") \
X(danger , "Danger color") \
X(action , "Action color") \
X(selected , "Selected item color") \
X(label , "Static label color") \
X(inactive , "Inactive label color") \
X(menu_white, "Light menu color") \
Expand Down
4 changes: 4 additions & 0 deletions src/vtm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ R"==(
<shadow bgc=0xB4202020 /> <!-- Light Darklighter. -->
<selector bgc=0x30ffffff txt=" " /> <!-- Selection overlay. -->
<highlight fgc=purewhite bgc=bluelt />
<selected fgc=puregreen />
<warning fgc=whitelt bgc=yellowdk />
<danger fgc=whitelt bgc=redlt />
<action fgc=whitelt bgc=greenlt />
Expand Down Expand Up @@ -216,6 +217,9 @@ R"==(
<whitelt = 0xFFf3f3f3 />
<pureblack = 0xFF000000 />
<purewhite = 0xFFffffff />
<purered = 0xFF0000ff />
<puregreen = 0xFF00ff00 />
<pureblue = 0xFFff0000 />
<nocolor = 0x00000000 />
<transparent = nocolor />
</set>
Expand Down

0 comments on commit 28b3d4d

Please sign in to comment.