X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?p=staging%2Fwindowmanager.git;a=blobdiff_plain;f=src%2Fapp.cpp;h=cf7b6bee7dbc74ed91dadc8fe406a47122c668c0;hp=e58c85d6a75e17f56acead1b470d7b4bc29064ba;hb=78d6f15eadfdc6d2d4a166e0e559ebad0a34723e;hpb=6a10feaafbe80f7c3738535dfd7ca97f00e1f405 diff --git a/src/app.cpp b/src/app.cpp index e58c85d..cf7b6be 100644 --- a/src/app.cpp +++ b/src/app.cpp @@ -169,6 +169,23 @@ int App::dispatch_pending_events() { return -1; } +bool App::pop_pending_events() { + bool x{true}; + return this->pending_events.compare_exchange_strong( + x, false, std::memory_order_consume); +} + +void App::set_pending_events() { + this->pending_events.store(true, std::memory_order_release); +} + +optional App::lookup_id(char const *name) { + return this->id_alloc.lookup(std::string(name)); +} +optional App::lookup_name(int id) { + return this->id_alloc.lookup(id); +} + // _ _ _ _ _ ____ // (_)_ __ (_) |_ | | __ _ _ _ ___ _ _| |_ / /\ \ // | | '_ \| | __| | |/ _` | | | |/ _ \| | | | __| | | | @@ -587,6 +604,10 @@ char const *App::api_enddraw(char const *drawing_name) { return "No EndDraw pending for surface"; } +void App::api_ping() { + this->dispatch_pending_events(); +} + // _ _ _____ _ // _ __ _ __ _____ _(_) ___ __| | | ____|_ _____ _ __ | |_ ___ // | '_ \| '__/ _ \ \/ / |/ _ \/ _` | | _| \ \ / / _ \ '_ \| __/ __|