aboutsummaryrefslogtreecommitdiff
path: root/rootston/desktop.c
diff options
context:
space:
mode:
Diffstat (limited to 'rootston/desktop.c')
-rw-r--r--rootston/desktop.c27
1 files changed, 25 insertions, 2 deletions
diff --git a/rootston/desktop.c b/rootston/desktop.c
index ff9544d5..6f76b97e 100644
--- a/rootston/desktop.c
+++ b/rootston/desktop.c
@@ -421,6 +421,8 @@ static void subsurface_destroy(struct roots_view_child *child) {
return;
}
wl_list_remove(&subsurface->destroy.link);
+ wl_list_remove(&subsurface->map.link);
+ wl_list_remove(&subsurface->unmap.link);
view_child_finish(&subsurface->view_child);
free(subsurface);
}
@@ -429,7 +431,25 @@ static void subsurface_handle_destroy(struct wl_listener *listener,
void *data) {
struct roots_subsurface *subsurface =
wl_container_of(listener, subsurface, destroy);
- subsurface_destroy((struct roots_view_child *)subsurface);
+ subsurface_destroy(&subsurface->view_child);
+}
+
+static void subsurface_handle_map(struct wl_listener *listener,
+ void *data) {
+ struct roots_subsurface *subsurface =
+ wl_container_of(listener, subsurface, map);
+ struct roots_view *view = subsurface->view_child.view;
+ view_damage_whole(view);
+ input_update_cursor_focus(view->desktop->server->input);
+}
+
+static void subsurface_handle_unmap(struct wl_listener *listener,
+ void *data) {
+ struct roots_subsurface *subsurface =
+ wl_container_of(listener, subsurface, unmap);
+ struct roots_view *view = subsurface->view_child.view;
+ view_damage_whole(view);
+ input_update_cursor_focus(view->desktop->server->input);
}
struct roots_subsurface *subsurface_create(struct roots_view *view,
@@ -444,7 +464,10 @@ struct roots_subsurface *subsurface_create(struct roots_view *view,
view_child_init(&subsurface->view_child, view, wlr_subsurface->surface);
subsurface->destroy.notify = subsurface_handle_destroy;
wl_signal_add(&wlr_subsurface->events.destroy, &subsurface->destroy);
- input_update_cursor_focus(view->desktop->server->input);
+ subsurface->map.notify = subsurface_handle_map;
+ wl_signal_add(&wlr_subsurface->events.map, &subsurface->map);
+ subsurface->unmap.notify = subsurface_handle_unmap;
+ wl_signal_add(&wlr_subsurface->events.unmap, &subsurface->unmap);
return subsurface;
}