aboutsummaryrefslogtreecommitdiffstats
path: root/sway/desktop
diff options
context:
space:
mode:
authorLibravatar Drew DeVault <sir@cmpwn.com>2017-11-25 16:30:15 -0500
committerLibravatar Drew DeVault <sir@cmpwn.com>2017-11-25 16:30:15 -0500
commit8caabe59c2e6f6174678e6c28be3381a7dabff10 (patch)
tree5425efb1f3b68e9b275d8429bba70a2b132b72c9 /sway/desktop
parentFix rendering issues, wire up some xdg listeners (diff)
downloadsway-8caabe59c2e6f6174678e6c28be3381a7dabff10.tar.gz
sway-8caabe59c2e6f6174678e6c28be3381a7dabff10.tar.zst
sway-8caabe59c2e6f6174678e6c28be3381a7dabff10.zip
Handle view destruction properly
Diffstat (limited to 'sway/desktop')
-rw-r--r--sway/desktop/xdg_shell_v6.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/sway/desktop/xdg_shell_v6.c b/sway/desktop/xdg_shell_v6.c
index 94682fcd..45e443fc 100644
--- a/sway/desktop/xdg_shell_v6.c
+++ b/sway/desktop/xdg_shell_v6.c
@@ -44,11 +44,22 @@ static void handle_commit(struct wl_listener *listener, void *data) {
44 sway_log(L_DEBUG, "xdg surface commit %dx%d", 44 sway_log(L_DEBUG, "xdg surface commit %dx%d",
45 sway_surface->pending_width, sway_surface->pending_height); 45 sway_surface->pending_width, sway_surface->pending_height);
46 // NOTE: We intentionally discard the view's desired width here 46 // NOTE: We intentionally discard the view's desired width here
47 // TODO: Don't do that for floating views 47 // TODO: Let floating views do whatever
48 view->width = sway_surface->pending_width; 48 view->width = sway_surface->pending_width;
49 view->height = sway_surface->pending_height; 49 view->height = sway_surface->pending_height;
50} 50}
51 51
52static void handle_destroy(struct wl_listener *listener, void *data) {
53 struct sway_xdg_surface_v6 *sway_xdg_surface =
54 wl_container_of(listener, sway_xdg_surface, destroy);
55 wl_list_remove(&sway_xdg_surface->commit.link);
56 wl_list_remove(&sway_xdg_surface->destroy.link);
57 swayc_t *parent = destroy_view(sway_xdg_surface->view->swayc);
58 free(sway_xdg_surface->view);
59 free(sway_xdg_surface);
60 arrange_windows(parent, -1, -1);
61}
62
52void handle_xdg_shell_v6_surface(struct wl_listener *listener, void *data) { 63void handle_xdg_shell_v6_surface(struct wl_listener *listener, void *data) {
53 struct sway_server *server = wl_container_of( 64 struct sway_server *server = wl_container_of(
54 listener, server, xdg_shell_v6_surface); 65 listener, server, xdg_shell_v6_surface);
@@ -90,6 +101,8 @@ void handle_xdg_shell_v6_surface(struct wl_listener *listener, void *data) {
90 101
91 sway_surface->commit.notify = handle_commit; 102 sway_surface->commit.notify = handle_commit;
92 wl_signal_add(&xdg_surface->events.commit, &sway_surface->commit); 103 wl_signal_add(&xdg_surface->events.commit, &sway_surface->commit);
104 sway_surface->destroy.notify = handle_destroy;
105 wl_signal_add(&xdg_surface->events.destroy, &sway_surface->destroy);
93 106
94 // TODO: actual focus semantics 107 // TODO: actual focus semantics
95 swayc_t *parent = root_container.children->items[0]; 108 swayc_t *parent = root_container.children->items[0];