aboutsummaryrefslogtreecommitdiffstats
path: root/sway/desktop/xwayland.c
diff options
context:
space:
mode:
authorLibravatar emersion <contact@emersion.fr>2018-04-02 14:35:43 -0400
committerLibravatar emersion <contact@emersion.fr>2018-04-02 14:35:43 -0400
commit2f64ce86c47efb2ee4c0e3a3c2b31307d21404d9 (patch)
tree5342d958ece5bf77338d1b1015763e65073fc4f1 /sway/desktop/xwayland.c
parentAddress review comments (diff)
downloadsway-2f64ce86c47efb2ee4c0e3a3c2b31307d21404d9.tar.gz
sway-2f64ce86c47efb2ee4c0e3a3c2b31307d21404d9.tar.zst
sway-2f64ce86c47efb2ee4c0e3a3c2b31307d21404d9.zip
Xwayland unmanaged views aren't views anymore
Diffstat (limited to 'sway/desktop/xwayland.c')
-rw-r--r--sway/desktop/xwayland.c47
1 files changed, 38 insertions, 9 deletions
diff --git a/sway/desktop/xwayland.c b/sway/desktop/xwayland.c
index 39076fab..bfef68cf 100644
--- a/sway/desktop/xwayland.c
+++ b/sway/desktop/xwayland.c
@@ -14,6 +14,33 @@
14#include "sway/input/input-manager.h" 14#include "sway/input/input-manager.h"
15#include "log.h" 15#include "log.h"
16 16
17static void unmanaged_handle_destroy(struct wl_listener *listener, void *data) {
18 struct sway_xwayland_unmanaged *sway_surface =
19 wl_container_of(listener, sway_surface, destroy);
20 wl_list_remove(&sway_surface->destroy.link);
21 wl_list_remove(&sway_surface->link);
22 free(sway_surface);
23}
24
25static void create_unmanaged(struct wlr_xwayland_surface *xsurface) {
26 struct sway_xwayland_unmanaged *sway_surface =
27 calloc(1, sizeof(struct sway_xwayland_unmanaged));
28 if (!sway_assert(sway_surface, "Failed to allocate surface")) {
29 return;
30 }
31
32 sway_surface->wlr_xwayland_surface = xsurface;
33
34 wl_signal_add(&xsurface->events.destroy, &sway_surface->destroy);
35 sway_surface->destroy.notify = unmanaged_handle_destroy;
36
37 wl_list_insert(&root_container.sway_root->xwayland_unmanaged,
38 &sway_surface->link);
39
40 // TODO: damage tracking
41}
42
43
17static bool assert_xwayland(struct sway_view *view) { 44static bool assert_xwayland(struct sway_view *view) {
18 return sway_assert(view->type == SWAY_XWAYLAND_VIEW, 45 return sway_assert(view->type == SWAY_XWAYLAND_VIEW,
19 "Expected xwayland view!"); 46 "Expected xwayland view!");
@@ -121,13 +148,8 @@ static void handle_map(struct wl_listener *listener, void *data) {
121 struct sway_view *view = sway_surface->view; 148 struct sway_view *view = sway_surface->view;
122 149
123 // put it back into the tree 150 // put it back into the tree
124 if (wlr_xwayland_surface_is_unmanaged(xsurface) || 151 wlr_xwayland_surface_set_maximized(xsurface, true);
125 xsurface->override_redirect) { 152 view_map(view, xsurface->surface);
126 view_map_unmanaged(view, xsurface->surface);
127 } else {
128 wlr_xwayland_surface_set_maximized(xsurface, true);
129 view_map(view, xsurface->surface);
130 }
131} 153}
132 154
133static void handle_request_configure(struct wl_listener *listener, void *data) { 155static void handle_request_configure(struct wl_listener *listener, void *data) {
@@ -147,12 +169,19 @@ void handle_xwayland_surface(struct wl_listener *listener, void *data) {
147 listener, server, xwayland_surface); 169 listener, server, xwayland_surface);
148 struct wlr_xwayland_surface *xsurface = data; 170 struct wlr_xwayland_surface *xsurface = data;
149 171
172 if (wlr_xwayland_surface_is_unmanaged(xsurface) ||
173 xsurface->override_redirect) {
174 wlr_log(L_DEBUG, "New xwayland unmanaged surface");
175 create_unmanaged(xsurface);
176 return;
177 }
178
150 wlr_log(L_DEBUG, "New xwayland surface title='%s' class='%s'", 179 wlr_log(L_DEBUG, "New xwayland surface title='%s' class='%s'",
151 xsurface->title, xsurface->class); 180 xsurface->title, xsurface->class);
152 181
153 struct sway_xwayland_surface *sway_surface = 182 struct sway_xwayland_surface *sway_surface =
154 calloc(1, sizeof(struct sway_xwayland_surface)); 183 calloc(1, sizeof(struct sway_xwayland_surface));
155 if (!sway_assert(sway_surface, "Failed to allocate surface!")) { 184 if (!sway_assert(sway_surface, "Failed to allocate surface")) {
156 return; 185 return;
157 } 186 }
158 187