Skip to content

Commit

Permalink
directvt#400 WIP: Try to sync UI thread
Browse files Browse the repository at this point in the history
  • Loading branch information
o-sdn-o committed Sep 12, 2023
1 parent a0cef03 commit 3462b12
Show file tree
Hide file tree
Showing 15 changed files with 493 additions and 530 deletions.
1 change: 0 additions & 1 deletion src/netxs/apps.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,6 @@ namespace netxs::app::shared
boss.LISTEN(tier::preview, e2::form::proceed::quit::one, fast)
{
boss.stop(fast);
//boss.RISEUP(tier::release, e2::form::proceed::quit::one, fast); // Detach base window.
};
});
};
Expand Down
1 change: 0 additions & 1 deletion src/netxs/apps/tile.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,6 @@ namespace netxs::app::tile
{
if (client)
{
auto lock = netxs::events::sync{};
client->SIGNAL(tier::release, e2::form::upon::vtree::detached, empty, ());
}
}
Expand Down
3 changes: 1 addition & 2 deletions src/netxs/desktopio/application.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -546,8 +546,7 @@ namespace netxs::app::shared
auto direct = os::dtvt::active;
auto applet = app::shared::builder(aclass)("", (direct ? "" : "!") + params, config, /*patch*/(direct ? ""s : "<config isolated=1/>"s)); // ! - means simple (i.e. w/o plugins)
domain->invite(server, applet, vtmode, winsz);
events::dequeue();
domain->shutdown();
domain->stop();
server->shut();
thread.join();
}
Expand Down
1 change: 0 additions & 1 deletion src/netxs/desktopio/baseui.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,6 @@ namespace netxs::events::userland
{
EVENT_XS( create , rect ), // return coordinates of the new object placeholder.
EVENT_XS( createby , input::hids ), // return gear with coordinates of the new object placeholder gear::slot.
EVENT_XS( destroy , ui::base ), // ??? bool return reference to the parent.
EVENT_XS( render , bool ), // ask children to render itself to the parent canvas, arg is the world is damaged or not.
EVENT_XS( attach , sptr<ui::base> ), // order to attach a child, arg is a parent base_sptr.
EVENT_XS( detach , sptr<ui::base> ), // order to detach a child, tier::release - kill itself, tier::preview - detach the child specified in args, arg is a child sptr.
Expand Down
38 changes: 16 additions & 22 deletions src/netxs/desktopio/console.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3675,7 +3675,6 @@ namespace netxs::ui
public:
using tick = datetime::quartz<events::reactor<>, hint>;
using list = std::vector<rect>;
using gptr = sptr<gate>;
using repl = scripting::repl<host>;

//pro::keybd keybd{*this }; // host: Keyboard controller.
Expand All @@ -3686,18 +3685,12 @@ namespace netxs::ui
si32 maxfps; // host: Frame rate.
list debris; // host: Wrecked regions.
xmls config; // host: Running configuration.
gptr client; // host: Standalone app.
subs tokens; // host: Subscription tokens.
flag active; // host: Host is available for connections.
repl engine; // host: Scripting engine.

std::vector<bool> user_numbering; // host: .

virtual void nextframe(bool damaged)
{
if (client) client->rebuild_scene(*this, damaged);
}

host(sptr<pipe> server, xmls config, pro::focus::mode m = pro::focus::mode::hub)
: focus{ *this, m, faux },
quartz{ bell::router<tier::general>(), e2::timer::tick.id },
Expand Down Expand Up @@ -3746,12 +3739,6 @@ namespace netxs::ui
maxfps = config.take("fps");
if (maxfps <= 0) maxfps = 60;

LISTEN(tier::general, e2::timer::any, timestamp, tokens)
{
auto damaged = !debris.empty();
debris.clear();
nextframe(damaged);
};
LISTEN(tier::request, e2::config::creator, world_ptr, tokens)
{
world_ptr = base::This();
Expand All @@ -3769,7 +3756,7 @@ namespace netxs::ui
}
else
{
quartz.cancel();
quartz.stop();
}
};
LISTEN(tier::general, e2::cleanup, counter, tokens)
Expand Down Expand Up @@ -3823,17 +3810,24 @@ namespace netxs::ui
auto invite(sptr<pipe> uplink, sptr<base>& applet, si32 vtmode, twod winsz)
{
auto lock = events::unique_lock();
client = base::create<gate>(uplink, vtmode, host::config);
client->SIGNAL(tier::release, e2::form::upon::vtree::attached, base::This());
client->attach(applet);
client->base::resize(winsz);
auto portal = base::create<gate>(uplink, vtmode, host::config);
portal->SIGNAL(tier::release, e2::form::upon::vtree::attached, base::This());
portal->attach(applet);
portal->base::resize(winsz);
auto& screen = *portal;
LISTEN(tier::general, e2::timer::any, timestamp)
{
auto damaged = !debris.empty();
debris.clear();
screen.rebuild_scene(*this, damaged);
};
lock.unlock();
client->launch();
lock.lock();
client.reset();
portal->launch();
netxs::events::dequeue();
quartz.stop();
}
// host: Shutdown.
void shutdown()
void stop()
{
auto lock = events::sync{};
mouse.reset();
Expand Down
Loading

0 comments on commit 3462b12

Please sign in to comment.