namespace wm {
namespace {
-App *g_app;
using nlohmann::json;
id_alloc{},
pending_events(false),
policy{} {
- assert(g_app == nullptr);
- g_app = this;
-
try {
{
auto l = load_layer_map(
}
}
-App::~App() { g_app = nullptr; }
-
int App::init() {
if (!this->display->ok()) {
return -1;
// XXX: This likely needs to be sorted by order (note, we don't (yet?)
// do any zorder arrangement).
for (auto const &i : this->layers.mapping) {
- c->layer_create(i.layer_id, o->width, o->height);
- auto &l = layers[i.layer_id];
+ c->layer_create(i.second.layer_id, o->width, o->height);
+ auto &l = layers[i.second.layer_id];
l->set_destination_rectangle(0, 0, o->width, o->height);
l->set_visibility(1);
- logdebug(
- "Setting up layer %s (%d) for surfaces %d-%d and role match \"%s\"",
- i.name.c_str(), i.layer_id, i.id_min, i.id_max, i.role.c_str());
+ logdebug("Setting up layer %s (%d) for surface role match \"%s\"",
+ i.second.name.c_str(), i.second.layer_id, i.second.role.c_str());
}
// Add layers to screen (XXX: are they sorted correctly?)
auto o_state = *this->layers.get_layout_state(*surface_id);
- if (!o_state) {
+ if (o_state == nullptr) {
return "Could not find layer for surface";
}
// disable layers that are above our current layer
for (auto const &l : this->layers.mapping) {
- if (l.layer_id <= *layer_id) {
+ if (l.second.layer_id <= *layer_id) {
continue;
}
bool flush = false;
- if (l.state.main != -1) {
- this->deactivate(l.state.main);
- l.state.main = -1;
+ if (l.second.state.main != -1) {
+ this->deactivate(l.second.state.main);
+ l.second.state.main = -1;
flush = true;
}
- if (l.state.sub != -1) {
- this->deactivate(l.state.sub);
- l.state.sub = -1;
+ if (l.second.state.sub != -1) {
+ this->deactivate(l.second.state.sub);
+ l.second.state.sub = -1;
flush = true;
}
auto o_state = *this->layers.get_layout_state(*surface_id);
- if (!o_state) {
+ if (o_state == nullptr) {
return "Could not find layer for surface";
}
}
void App::emit_activated(char const *label) {
- this->api.send_event("activated", label);
+ this->api.send_event("active", label);
}
void App::emit_deactivated(char const *label) {
- this->api.send_event("deactivated", label);
+ this->api.send_event("inactive", label);
}
void App::emit_syncdraw(char const *label) {
return false;
}
-void App::try_layout(struct LayoutState &state,
+void App::try_layout(struct LayoutState & /*state*/,
struct LayoutState const &new_layout,
std::function<void(LayoutState const &nl)> apply) {
if (this->policy.layout_is_valid(new_layout)) {
this->app->surface_removed(surface_id);
}
+void controller_hooks::surface_visibility(uint32_t /*surface_id*/,
+ uint32_t /*v*/) {}
+
+void controller_hooks::surface_destination_rectangle(uint32_t /*surface_id*/,
+ uint32_t /*x*/,
+ uint32_t /*y*/,
+ uint32_t /*w*/,
+ uint32_t /*h*/) {}
+
} // namespace wm