aboutsummaryrefslogtreecommitdiffstats
path: root/sway/desktop/xwayland.c
diff options
context:
space:
mode:
authorLibravatar emersion <contact@emersion.fr>2018-03-30 11:22:12 -0400
committerLibravatar emersion <contact@emersion.fr>2018-03-30 11:22:12 -0400
commit681f38c8783c14723a8cf88114e5af824d4952b8 (patch)
treef34b62658ec9e6e789c7eed75ad2bb713531e856 /sway/desktop/xwayland.c
parentUnify initial xwayland view mapping with map handler (diff)
downloadsway-681f38c8783c14723a8cf88114e5af824d4952b8.tar.gz
sway-681f38c8783c14723a8cf88114e5af824d4952b8.tar.zst
sway-681f38c8783c14723a8cf88114e5af824d4952b8.zip
Fix segfault on xwayland unmanaged view unmap
Diffstat (limited to 'sway/desktop/xwayland.c')
-rw-r--r--sway/desktop/xwayland.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/sway/desktop/xwayland.c b/sway/desktop/xwayland.c
index c3697b4c..d608c8b6 100644
--- a/sway/desktop/xwayland.c
+++ b/sway/desktop/xwayland.c
@@ -104,14 +104,11 @@ static void handle_commit(struct wl_listener *listener, void *data) {
104static void handle_destroy(struct wl_listener *listener, void *data) { 104static void handle_destroy(struct wl_listener *listener, void *data) {
105 struct sway_xwayland_surface *sway_surface = 105 struct sway_xwayland_surface *sway_surface =
106 wl_container_of(listener, sway_surface, destroy); 106 wl_container_of(listener, sway_surface, destroy);
107 struct wlr_xwayland_surface *xsurface = data; 107
108 wl_list_remove(&sway_surface->commit.link); 108 wl_list_remove(&sway_surface->commit.link);
109 wl_list_remove(&sway_surface->destroy.link); 109 wl_list_remove(&sway_surface->destroy.link);
110 wl_list_remove(&sway_surface->request_configure.link); 110 wl_list_remove(&sway_surface->request_configure.link);
111 if (xsurface->override_redirect && xsurface->mapped) { 111 wl_list_remove(&sway_surface->view->unmanaged_view_link);
112 wl_list_remove(&sway_surface->view->unmanaged_view_link);
113 wl_list_init(&sway_surface->view->unmanaged_view_link);
114 }
115 112
116 struct sway_container *parent = container_view_destroy(sway_surface->view->swayc); 113 struct sway_container *parent = container_view_destroy(sway_surface->view->swayc);
117 if (parent) { 114 if (parent) {
@@ -125,11 +122,9 @@ static void handle_destroy(struct wl_listener *listener, void *data) {
125static void handle_unmap_notify(struct wl_listener *listener, void *data) { 122static void handle_unmap_notify(struct wl_listener *listener, void *data) {
126 struct sway_xwayland_surface *sway_surface = 123 struct sway_xwayland_surface *sway_surface =
127 wl_container_of(listener, sway_surface, unmap_notify); 124 wl_container_of(listener, sway_surface, unmap_notify);
128 struct wlr_xwayland_surface *xsurface = data; 125
129 if (xsurface->override_redirect && xsurface->mapped) { 126 wl_list_remove(&sway_surface->view->unmanaged_view_link);
130 wl_list_remove(&sway_surface->view->unmanaged_view_link); 127 wl_list_init(&sway_surface->view->unmanaged_view_link);
131 wl_list_init(&sway_surface->view->unmanaged_view_link);
132 }
133 128
134 // take it out of the tree 129 // take it out of the tree
135 struct sway_container *parent = container_view_destroy(sway_surface->view->swayc); 130 struct sway_container *parent = container_view_destroy(sway_surface->view->swayc);
@@ -152,6 +147,7 @@ static void handle_map_notify(struct wl_listener *listener, void *data) {
152 // put it back into the tree 147 // put it back into the tree
153 if (wlr_xwayland_surface_is_unmanaged(xsurface) || 148 if (wlr_xwayland_surface_is_unmanaged(xsurface) ||
154 xsurface->override_redirect) { 149 xsurface->override_redirect) {
150 wl_list_remove(&sway_surface->view->unmanaged_view_link);
155 wl_list_insert(&root_container.sway_root->unmanaged_views, 151 wl_list_insert(&root_container.sway_root->unmanaged_views,
156 &sway_surface->view->unmanaged_view_link); 152 &sway_surface->view->unmanaged_view_link);
157 } else { 153 } else {
@@ -210,6 +206,8 @@ void handle_xwayland_surface(struct wl_listener *listener, void *data) {
210 sway_view->surface = xsurface->surface; 206 sway_view->surface = xsurface->surface;
211 sway_surface->view = sway_view; 207 sway_surface->view = sway_view;
212 208
209 wl_list_init(&sway_view->unmanaged_view_link);
210
213 // TODO: 211 // TODO:
214 // - Look up pid and open on appropriate workspace 212 // - Look up pid and open on appropriate workspace
215 // - Set new view to maximized so it behaves nicely 213 // - Set new view to maximized so it behaves nicely