X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=src%2Fapp.cpp;h=4feeb03056b2aacac0de9de17a7634d56720fa6a;hb=9b397b09fe6eef8936ad41763e4908e99ce274d6;hp=246b629a5258fc2eb8db747877fe784376b8a2a4;hpb=ef6f72786ab7c7791a0dce9b63412b04b9351ddb;p=staging%2Fwindowmanager.git diff --git a/src/app.cpp b/src/app.cpp index 246b629..4feeb03 100644 --- a/src/app.cpp +++ b/src/app.cpp @@ -80,7 +80,6 @@ App::App(wl::display *d) controller{}, outputs(), config(), - layouts(), layers(), id_alloc{}, pending_events(false), @@ -230,7 +229,6 @@ int App::init_layers() { 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()); - this->layouts[l->id] = LayoutState{}; } // Add layers to screen (XXX: are they sorted correctly?) @@ -413,9 +411,6 @@ char const *App::api_activate_surface(char const *drawing_name) { return "Surface already active"; } - // This should involve a policy check, but as we do not (yet) have - // such a thing, we will just switch to this surface. - // XXX: input focus missing!!1 if (state.main == -1) { this->try_layout( @@ -431,7 +426,6 @@ char const *App::api_activate_surface(char const *drawing_name) { } else { bool can_split = this->can_split(state, *surface_id); - if (state.sub == -1) { if (can_split) { this->try_layout( state, @@ -442,6 +436,9 @@ char const *App::api_activate_surface(char const *drawing_name) { this->surface_set_layout(state.main, surface_id); this->activate(*surface_id); + if (state.sub != -1) { + this->deactivate(state.sub); + } state = nl; this->layout_commit(); @@ -456,7 +453,9 @@ char const *App::api_activate_surface(char const *drawing_name) { this->surface_set_layout(*surface_id); this->deactivate(state.main); this->activate(*surface_id); - this->deactivate(state.sub); + if (state.sub != -1) { + this->deactivate(state.sub); + } state = nl; this->layout_commit(); @@ -464,7 +463,6 @@ char const *App::api_activate_surface(char const *drawing_name) { this->enqueue_flushdraw(state.main); }); } - } } // no error @@ -520,6 +518,7 @@ char const *App::api_deactivate_surface(char const *drawing_name) { this->try_layout(state, LayoutState{-1, -1}, [&] (LayoutState const &nl) { this->deactivate(*surface_id); state = nl; + this->layout_commit(); }); } } else if (state.sub == *surface_id) { @@ -679,7 +678,8 @@ result App::api_request_surface(char const *drawing_name) { } void App::activate(int id) { - if (this->controller->sprops[id].visibility == 0) { + auto ip = this->controller->sprops.find(id); + if (ip != this->controller->sprops.end() && ip->second.visibility == 0) { this->controller->surfaces[id]->set_visibility(1); char const *label = this->lookup_name(id).value_or("unknown-name").c_str(); @@ -689,7 +689,8 @@ void App::activate(int id) { } void App::deactivate(int id) { - if (this->controller->sprops[id].visibility != 0) { + auto ip = this->controller->sprops.find(id); + if (ip != this->controller->sprops.end() && ip->second.visibility != 0) { this->controller->surfaces[id]->set_visibility(0); char const *label = this->lookup_name(id).value_or("unknown-name").c_str();