From 793166f301c058503c37553204c4d4c2b106ff23 Mon Sep 17 00:00:00 2001 From: Marcus Fritzsch Date: Tue, 12 Sep 2017 11:29:27 +0200 Subject: app/main: dispatch wayland events using ping(), WIP on split layout * Dispatch ayland events with ping() API call, after having read events from wayland fd - in order to prevent indefinite-poll on wrongly read+ dispatch from multiple threads (dispatcher and API call). * Add scope trace to all API call thunks. * Split layout advancements, still broken AF though. * Add App1 example split layout to App layer. Signed-off-by: Marcus Fritzsch --- src/app.hpp | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) (limited to 'src/app.hpp') diff --git a/src/app.hpp b/src/app.hpp index 37122ef..00a2ba2 100644 --- a/src/app.hpp +++ b/src/app.hpp @@ -18,10 +18,12 @@ #define TMCAGLWM_APP_HPP #include + +#include #include #include #include -#include +#include #include "afb_binding_api.hpp" #include "config.hpp" @@ -41,6 +43,8 @@ struct controller; namespace wm { +using std::experimental::optional; + struct id_allocator { constexpr static const unsigned id_shift = 22; constexpr static const unsigned id_mask = (1 << id_shift) - 1; @@ -100,13 +104,21 @@ struct id_allocator { struct LayoutState { enum States { + LayoutNone, // Not useful... LayoutSingle, LayoutSplit, }; - enum States state; - int main; - int sub; + 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 { @@ -121,7 +133,8 @@ struct App { struct config config; - layouts_type layouts; + // track current layouts separately + std::map layouts; layer_map layers; // ID allocation and proxy methods for lookup @@ -135,6 +148,8 @@ struct App { struct LayoutState state; + std::atomic pending_events; + explicit App(wl::display *d); ~App(); @@ -148,7 +163,8 @@ struct App { int dispatch_events(); - void surface_init_layout(uint32_t surface_id); + 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); -- cgit 1.2.3-korg