diff options
author | Marcus Fritzsch <marcus_fritzsch@mentor.com> | 2017-09-12 11:29:27 +0200 |
---|---|---|
committer | Marcus Fritzsch <marcus_fritzsch@mentor.com> | 2017-09-12 11:29:27 +0200 |
commit | 793166f301c058503c37553204c4d4c2b106ff23 (patch) | |
tree | b83acb7446554328e9d070681ea7ac0a8def45b9 /src/app.hpp | |
parent | 6b648180458e9625e1f700962537c3d4e501f6cc (diff) |
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 <marcus_fritzsch@mentor.com>
Diffstat (limited to 'src/app.hpp')
-rw-r--r-- | src/app.hpp | 28 |
1 files changed, 22 insertions, 6 deletions
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 <json-c/json.h> + +#include <atomic> #include <memory> #include <unordered_map> #include <unordered_set> -#include <deque> +#include <experimental/optional> #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<int, struct LayoutState> layouts; layer_map layers; // ID allocation and proxy methods for lookup @@ -135,6 +148,8 @@ struct App { struct LayoutState state; + std::atomic<bool> 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<int> request_surface(char const *drawing_name); |