aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMarcus Fritzsch <marcus_fritzsch@mentor.com>2017-08-31 17:23:32 +0200
committerMarcus Fritzsch <marcus_fritzsch@mentor.com>2017-09-04 16:54:02 +0200
commit74826b4760a3946e3f196a00c6a9f292a810f855 (patch)
treebd703a9bbf0b9d6605405e84bd5b0cb45a787bc5 /src
parent89685c1f1e603d9a45ce0f3407c73e712dd7ad5a (diff)
app: remove add_task/execute_pending support
Signed-off-by: Marcus Fritzsch <marcus_fritzsch@mentor.com>
Diffstat (limited to 'src')
-rw-r--r--src/app.cpp44
-rw-r--r--src/app.hpp5
-rw-r--r--src/controller_hooks.hpp2
-rw-r--r--src/wayland.cpp12
4 files changed, 13 insertions, 50 deletions
diff --git a/src/app.cpp b/src/app.cpp
index ff0c3f0..7ff353f 100644
--- a/src/app.cpp
+++ b/src/app.cpp
@@ -128,7 +128,6 @@ App::App(wl::display *d)
config(),
layouts(),
layers(),
- pending(),
name_mapping(),
id_alloc{},
last_active() {
@@ -212,7 +211,7 @@ int App::dispatch_events() {
this->display->flush();
// execute pending tasks, that is layout changes etc.
- this->execute_pending();
+ //this->execute_pending();
return 0;
}
@@ -412,22 +411,6 @@ char const *App::deactivate_surface(uint32_t surface_id) {
return nullptr;
}
-void App::add_task(char const *name, std::function<void()> &&f) {
- this->pending.emplace_back(std::make_pair(name, f));
-}
-
-void App::execute_pending() {
- if (!this->pending.empty()) {
- for (auto &t : this->pending) {
- logdebug("executing task '%s'", t.first);
- t.second();
- }
- this->pending.clear();
- this->controller->commit_changes();
- this->display->flush();
- }
-}
-
// _ _ _____ _
// _ __ _ __ _____ _(_) ___ __| | | ____|_ _____ _ __ | |_ ___
// | '_ \| '__/ _ \ \/ / |/ _ \/ _` | | _| \ \ / / _ \ '_ \| __/ __|
@@ -439,9 +422,7 @@ void App::surface_created(uint32_t surface_id) {
logdebug("surface_id is %u", surface_id);
- // We need to execute the surface setup after its creation.
- this->add_task("surface_set_layout",
- [surface_id, this] { this->surface_set_layout(surface_id); });
+ this->surface_set_layout(surface_id);
}
void App::surface_removed(uint32_t surface_id) {
@@ -449,17 +430,14 @@ void App::surface_removed(uint32_t surface_id) {
logdebug("surface_id is %u", surface_id);
- this->add_task("remove surface ID",
- [surface_id, this] {
- this->id_alloc.remove_id(surface_id);
+ this->id_alloc.remove_id(surface_id);
- // Also remove from last_active, if found
- auto i = std::find(this->last_active.begin(),
- this->last_active.end(), surface_id);
- if (i != this->last_active.end()) {
- this->last_active.erase(i);
- }
- });
+ // Also remove from last_active, if found
+ auto i = std::find(this->last_active.begin(),
+ this->last_active.end(), surface_id);
+ if (i != this->last_active.end()) {
+ this->last_active.erase(i);
+ }
}
void App::emit_activated(char const *label) {
@@ -639,8 +617,4 @@ void controller_hooks::surface_removed(uint32_t surface_id) {
this->app->surface_removed(surface_id);
}
-void controller_hooks::add_task(char const *name, std::function<void()> &&f) {
- this->app->add_task(name, std::move(f));
-}
-
} // namespace wm
diff --git a/src/app.hpp b/src/app.hpp
index 9df6199..8a5dc2f 100644
--- a/src/app.hpp
+++ b/src/app.hpp
@@ -114,7 +114,6 @@ struct App {
layer_map layers;
typedef std::pair<char const *, std::function<void()>> name_task_pair;
- std::vector<name_task_pair> pending;
typedef std::map<std::string, int> drawing_name_map;
drawing_name_map name_mapping;
@@ -147,10 +146,6 @@ struct App {
char const *activate_surface(char const *drawing_name);
char const *deactivate_surface(char const *drawing_name);
- // add tasks, executed after dispatch_events()
- void add_task(char const *name, std::function<void()> &&f);
- void execute_pending();
-
// Events from the compositor we are interested in
void surface_created(uint32_t surface_id);
void surface_removed(uint32_t surface_id);
diff --git a/src/controller_hooks.hpp b/src/controller_hooks.hpp
index c060b0b..18569aa 100644
--- a/src/controller_hooks.hpp
+++ b/src/controller_hooks.hpp
@@ -31,8 +31,6 @@ struct controller_hooks {
void surface_created(uint32_t surface_id);
void surface_removed(uint32_t surface_id);
-
- void add_task(char const *name, std::function<void()> &&);
};
} // namespace wm
diff --git a/src/wayland.cpp b/src/wayland.cpp
index df601eb..8e089c3 100644
--- a/src/wayland.cpp
+++ b/src/wayland.cpp
@@ -438,10 +438,8 @@ void controller::layer_screen(struct layer * /*l*/, struct wl_output *screen) {
void controller::layer_destroyed(struct layer *l) {
logdebug("genivi::layer %s @ %p", __func__, this->proxy.get());
- this->chooks->add_task("remove layer", [l, this] {
- this->lprops.erase(l->id);
- this->layers.erase(l->id);
- });
+ this->lprops.erase(l->id);
+ this->layers.erase(l->id);
}
// __
@@ -674,10 +672,8 @@ void controller::surface_content(struct surface *s, int32_t content_state) {
if (content_state == IVI_CONTROLLER_SURFACE_CONTENT_STATE_CONTENT_REMOVED) {
// XXX is this the right thing to do?
this->chooks->surface_removed(s->id);
- this->chooks->add_task("remove surface", [this, s] {
- this->sprops.erase(s->id);
- this->surfaces.erase(s->id);
- });
+ this->sprops.erase(s->id);
+ this->surfaces.erase(s->id);
}
}