X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=src%2Fapp.hpp;h=5ef7ab4ac8434cd64db6293857fc70ca5ce6f612;hb=6a10feaafbe80f7c3738535dfd7ca97f00e1f405;hp=00a2ba260ba7cdcafffc0c48410043a2999c2154;hpb=793166f301c058503c37553204c4d4c2b106ff23;p=staging%2Fwindowmanager.git diff --git a/src/app.hpp b/src/app.hpp index 00a2ba2..5ef7ab4 100644 --- a/src/app.hpp +++ b/src/app.hpp @@ -102,25 +102,6 @@ struct id_allocator { } }; -struct LayoutState { - enum States { - LayoutNone, // Not useful... - LayoutSingle, - LayoutSplit, - }; - - enum States state{LayoutSingle}; - int main{-1}; - int sub{-1}; - - bool operator==(const LayoutState &b) const { - return state == b.state && main == b.main && sub == b.sub; - } - bool operator!=(const LayoutState &b) const { - return !(*this == b); - } -}; - struct App { struct binding_api api; struct controller_hooks chooks; @@ -139,16 +120,27 @@ struct App { // ID allocation and proxy methods for lookup struct id_allocator id_alloc; - optional lookup_id(char const *name) { + optional lookup_id(char const *name) { return this->id_alloc.lookup(std::string(name)); } - optional lookup_name(unsigned id) { + optional lookup_name(int id) { return this->id_alloc.lookup(id); } - struct LayoutState state; - + // Set by AFB API when wayland events need to be dispatched std::atomic pending_events; + void set_pending_events() { + this->pending_events.store(true, std::memory_order_release); + } + bool pop_pending_events() { + bool x{true}; + return this->pending_events.compare_exchange_strong( + x, false, std::memory_order_consume); + } + + std::vector pending_end_draw; + void enqueue_flushdraw(int surface_id); + void check_flushdraw(int surface_id); explicit App(wl::display *d); ~App(); @@ -162,16 +154,18 @@ struct App { int init_layers(); int dispatch_events(); + int dispatch_pending_events(); void surface_set_layout_full(uint32_t surface_id); void surface_set_layout_split(uint32_t surface_id, uint32_t sub_surface_id); // Allocate a surface ID for this role - result request_surface(char const *drawing_name); + result api_request_surface(char const *drawing_name); // Activate (i.e. make visible, if allowed!) a surface - char const *activate_surface(char const *drawing_name); - char const *deactivate_surface(char const *drawing_name); + char const *api_activate_surface(char const *drawing_name); + char const *api_deactivate_surface(char const *drawing_name); + char const *api_enddraw(char const *drawing_name); // Events from the compositor we are interested in void surface_created(uint32_t surface_id); @@ -186,10 +180,10 @@ struct App { void emit_invisible(char const *label); void emit_visible(char const *label); - void activate(unsigned id); - void deactivate(unsigned id); + void activate(int id); + void deactivate(int id); - bool can_split(unsigned new_id); + bool can_split(struct LayoutState const &state, int new_id); }; } // namespace wm