diff options
author | emersion <contact@emersion.fr> | 2019-02-16 17:32:01 +0100 |
---|---|---|
committer | emersion <contact@emersion.fr> | 2019-02-17 12:01:15 +0100 |
commit | 943e918a965e7cb07d84913170032784c31ff5d4 (patch) | |
tree | 1385f031d8023c620f14152fdb69950e5ebfa944 /rootston | |
parent | 3c9f791d0e0a0f0b3437b0b26ea606ce3344cfe2 (diff) |
subsurface: add map/unmap events
Fixes https://github.com/swaywm/wlroots/issues/1414
Diffstat (limited to 'rootston')
-rw-r--r-- | rootston/desktop.c | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/rootston/desktop.c b/rootston/desktop.c index fcb530cf..a38f4045 100644 --- a/rootston/desktop.c +++ b/rootston/desktop.c @@ -420,6 +420,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); } @@ -428,7 +430,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, @@ -443,7 +463,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; } |