#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"
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;
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 {
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
struct LayoutState state;
+ std::atomic<bool> pending_events;
+
explicit App(wl::display *d);
~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);