s->set_destination_rectangle(x, y, w, h);
// XXX: The main_surface will be visible regardless
- s->set_visibility(
- surface_id == static_cast<unsigned>(this->layers.main_surface) ? 1 : 0);
+ //s->set_visibility(
+ // surface_id == static_cast<unsigned>(this->layers.main_surface) ? 1 : 0);
this->controller->layers[layer_id]->add_surface(s.get());
+ if (surface_id == static_cast<unsigned>(this->layers.main_surface)) {
+ logdebug("Activating main_surface (%d)", surface_id);
+ this->activate_surface(surface_id);
+ }
+
logdebug("Surface %u now on layer %u with rect { %d, %d, %d, %d }",
surface_id, layer_id, x, y, w, h);
}
/// // XXX: I am not sure I even need 5 elements...
/// this->last_active.resize(std::min(int(this->last_active.size()), 5));
-
// no error
return nullptr;
}
// | .__/|_| \___/_/\_\_|\___|\__,_| |_____| \_/ \___|_| |_|\__|___/
// |_|
void App::surface_created(uint32_t surface_id) {
- surface_id &= id_allocator::id_mask;
+ //surface_id >>= id_allocator::id_shift;
logdebug("surface_id is %u", surface_id);
}
void App::surface_removed(uint32_t surface_id) {
- surface_id &= id_allocator::id_mask;
+ //surface_id >>= id_allocator::id_shift;
logdebug("surface_id is %u", surface_id);
});
}
+void App::emit_activated(char const *label) {
+ this->api.send_event("activated", json_object_new_string(label));
+}
+
+void App::emit_deactivated(char const *label) {
+ this->api.send_event("deactivated", json_object_new_string(label));
+}
+
+void App::emit_syncdraw(char const *label) {
+ this->api.send_event("syncdraw", json_object_new_string(label));
+}
+
+void App::emit_visible(char const *label, bool is_visible) {
+ this->api.send_event(is_visible ? "visible" : "invisible", json_object_new_string(label));
+}
+
result<int> App::request_surface(char const *drawing_name) {
auto lid = this->layers.get_layer_id(std::string(drawing_name));
if (!lid) {
if (osid) {
logdebug("ativate surface with name %s and id %u", drawing_name,
osid.value());
- return this->activate_surface(osid.value());
+ auto ret = this->activate_surface(osid.value());
+ if (!ret) {
+ this->emit_activated(drawing_name);
+ }
+ return ret;
}
logerror("surface %s unknown", drawing_name);