aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--client/pool-buffer.c2
-rw-r--r--sway/desktop/layer_shell.c5
-rw-r--r--sway/desktop/output.c25
-rw-r--r--sway/desktop/xwayland.c18
-rw-r--r--sway/input/cursor.c32
-rw-r--r--sway/tree/layout.c2
6 files changed, 49 insertions, 35 deletions
diff --git a/client/pool-buffer.c b/client/pool-buffer.c
index 93cfcfc5..b5ed9c98 100644
--- a/client/pool-buffer.c
+++ b/client/pool-buffer.c
@@ -57,7 +57,7 @@ static struct pool_buffer *create_buffer(struct wl_shm *shm,
57 57
58 char *name; 58 char *name;
59 int fd = create_pool_file(size, &name); 59 int fd = create_pool_file(size, &name);
60 assert(fd); 60 assert(fd != -1);
61 void *data = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); 61 void *data = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
62 struct wl_shm_pool *pool = wl_shm_create_pool(shm, fd, size); 62 struct wl_shm_pool *pool = wl_shm_create_pool(shm, fd, size);
63 buf->buffer = wl_shm_pool_create_buffer(pool, 0, 63 buf->buffer = wl_shm_pool_create_buffer(pool, 0,
diff --git a/sway/desktop/layer_shell.c b/sway/desktop/layer_shell.c
index 5c96659a..c18f51c7 100644
--- a/sway/desktop/layer_shell.c
+++ b/sway/desktop/layer_shell.c
@@ -238,11 +238,12 @@ static void handle_destroy(struct wl_listener *listener, void *data) {
238 wl_list_remove(&sway_layer->unmap.link); 238 wl_list_remove(&sway_layer->unmap.link);
239 wl_list_remove(&sway_layer->surface_commit.link); 239 wl_list_remove(&sway_layer->surface_commit.link);
240 if (sway_layer->layer_surface->output != NULL) { 240 if (sway_layer->layer_surface->output != NULL) {
241 struct sway_output *output = sway_layer->layer_surface->output->data;
242 arrange_layers(output);
243
241 wl_list_remove(&sway_layer->output_destroy.link); 244 wl_list_remove(&sway_layer->output_destroy.link);
242 } 245 }
243 struct sway_output *output = sway_layer->layer_surface->output->data;
244 free(sway_layer); 246 free(sway_layer);
245 arrange_layers(output);
246} 247}
247 248
248static void handle_map(struct wl_listener *listener, void *data) { 249static void handle_map(struct wl_listener *listener, void *data) {
diff --git a/sway/desktop/output.c b/sway/desktop/output.c
index c248b29e..0d706c52 100644
--- a/sway/desktop/output.c
+++ b/sway/desktop/output.c
@@ -243,14 +243,25 @@ static void render_output(struct sway_output *output, struct timespec *when,
243 struct sway_view *view; 243 struct sway_view *view;
244 wl_list_for_each(view, &root_container.sway_root->unmanaged_views, 244 wl_list_for_each(view, &root_container.sway_root->unmanaged_views,
245 unmanaged_view_link) { 245 unmanaged_view_link) {
246 if (view->type == SWAY_XWAYLAND_VIEW) { 246 if (view->type != SWAY_XWAYLAND_VIEW) {
247 // the only kind of unamanged view right now is xwayland override 247 continue;
248 // redirect
249 int view_x = view->wlr_xwayland_surface->x;
250 int view_y = view->wlr_xwayland_surface->y;
251 render_surface(view->surface, wlr_output, &output->last_frame,
252 view_x, view_y, 0);
253 } 248 }
249
250 struct wlr_xwayland_surface *xsurface = view->wlr_xwayland_surface;
251
252 const struct wlr_box view_box = {
253 .x = xsurface->x,
254 .y = xsurface->y,
255 .width = xsurface->width,
256 .height = xsurface->height,
257 };
258 struct wlr_box intersection;
259 if (!wlr_box_intersection(&view_box, output_box, &intersection)) {
260 continue;
261 }
262
263 render_surface(view->surface, wlr_output, &output->last_frame,
264 view_box.x - output_box->x, view_box.y - output_box->y, 0);
254 } 265 }
255 266
256 // TODO: Consider revising this when fullscreen windows are supported 267 // TODO: Consider revising this when fullscreen windows are supported
diff --git a/sway/desktop/xwayland.c b/sway/desktop/xwayland.c
index 01c993b3..273ca2bf 100644
--- a/sway/desktop/xwayland.c
+++ b/sway/desktop/xwayland.c
@@ -41,7 +41,7 @@ static void set_size(struct sway_view *view, int width, int height) {
41 view->sway_xwayland_surface->pending_height = height; 41 view->sway_xwayland_surface->pending_height = height;
42 42
43 struct wlr_xwayland_surface *xsurface = view->wlr_xwayland_surface; 43 struct wlr_xwayland_surface *xsurface = view->wlr_xwayland_surface;
44 wlr_xwayland_surface_configure(xsurface, view->swayc->x, view->swayc->y, 44 wlr_xwayland_surface_configure(xsurface, xsurface->x, xsurface->y,
45 width, height); 45 width, height);
46} 46}
47 47
@@ -67,13 +67,10 @@ static void set_position(struct sway_view *view, double ox, double oy) {
67 view->swayc->x = ox; 67 view->swayc->x = ox;
68 view->swayc->y = oy; 68 view->swayc->y = oy;
69 69
70 if (view->width == 0 || view->height == 0) {
71 return;
72 }
73
74 wlr_xwayland_surface_configure(view->wlr_xwayland_surface, 70 wlr_xwayland_surface_configure(view->wlr_xwayland_surface,
75 ox + loutput->x, oy + loutput->y, 71 ox + loutput->x, oy + loutput->y,
76 view->width, view->height); 72 view->wlr_xwayland_surface->width,
73 view->wlr_xwayland_surface->height);
77} 74}
78 75
79static void set_activated(struct sway_view *view, bool activated) { 76static void set_activated(struct sway_view *view, bool activated) {
@@ -143,8 +140,11 @@ static void handle_map(struct wl_listener *listener, void *data) {
143 struct sway_view *view = sway_surface->view; 140 struct sway_view *view = sway_surface->view;
144 container_view_destroy(view->swayc); 141 container_view_destroy(view->swayc);
145 142
143 wlr_xwayland_surface_set_maximized(xsurface, true);
144
146 struct sway_seat *seat = input_manager_current_seat(input_manager); 145 struct sway_seat *seat = input_manager_current_seat(input_manager);
147 struct sway_container *focus = sway_seat_get_focus_inactive(seat, &root_container); 146 struct sway_container *focus = sway_seat_get_focus_inactive(seat,
147 &root_container);
148 struct sway_container *cont = container_view_create(focus, view); 148 struct sway_container *cont = container_view_create(focus, view);
149 view->swayc = cont; 149 view->swayc = cont;
150 arrange_windows(cont->parent, -1, -1); 150 arrange_windows(cont->parent, -1, -1);
@@ -154,7 +154,7 @@ static void handle_map(struct wl_listener *listener, void *data) {
154 view_damage_whole(sway_surface->view); 154 view_damage_whole(sway_surface->view);
155} 155}
156 156
157static void handle_configure_request(struct wl_listener *listener, void *data) { 157static void handle_request_configure(struct wl_listener *listener, void *data) {
158 struct sway_xwayland_surface *sway_surface = 158 struct sway_xwayland_surface *sway_surface =
159 wl_container_of(listener, sway_surface, request_configure); 159 wl_container_of(listener, sway_surface, request_configure);
160 struct wlr_xwayland_surface_configure_event *ev = data; 160 struct wlr_xwayland_surface_configure_event *ev = data;
@@ -209,7 +209,7 @@ void handle_xwayland_surface(struct wl_listener *listener, void *data) {
209 209
210 wl_signal_add(&xsurface->events.request_configure, 210 wl_signal_add(&xsurface->events.request_configure,
211 &sway_surface->request_configure); 211 &sway_surface->request_configure);
212 sway_surface->request_configure.notify = handle_configure_request; 212 sway_surface->request_configure.notify = handle_request_configure;
213 213
214 wl_signal_add(&xsurface->events.unmap, &sway_surface->unmap); 214 wl_signal_add(&xsurface->events.unmap, &sway_surface->unmap);
215 sway_surface->unmap.notify = handle_unmap; 215 sway_surface->unmap.notify = handle_unmap;
diff --git a/sway/input/cursor.c b/sway/input/cursor.c
index 4a3f558d..d608a9cf 100644
--- a/sway/input/cursor.c
+++ b/sway/input/cursor.c
@@ -50,21 +50,23 @@ static struct sway_container *container_at_cursor(struct sway_cursor *cursor,
50 struct wl_list *unmanaged = &root_container.sway_root->unmanaged_views; 50 struct wl_list *unmanaged = &root_container.sway_root->unmanaged_views;
51 struct sway_view *view; 51 struct sway_view *view;
52 wl_list_for_each_reverse(view, unmanaged, unmanaged_view_link) { 52 wl_list_for_each_reverse(view, unmanaged, unmanaged_view_link) {
53 if (view->type == SWAY_XWAYLAND_VIEW) { 53 if (view->type != SWAY_XWAYLAND_VIEW) {
54 struct wlr_xwayland_surface *xsurface = view->wlr_xwayland_surface; 54 continue;
55 struct wlr_box box = { 55 }
56 .x = xsurface->x, 56
57 .y = xsurface->y, 57 struct wlr_xwayland_surface *xsurface = view->wlr_xwayland_surface;
58 .width = xsurface->width, 58 struct wlr_box box = {
59 .height = xsurface->height, 59 .x = xsurface->x,
60 }; 60 .y = xsurface->y,
61 61 .width = xsurface->width,
62 if (wlr_box_contains_point(&box, cursor->x, cursor->y)) { 62 .height = xsurface->height,
63 *surface = xsurface->surface; 63 };
64 *sx = cursor->x - box.x; 64
65 *sy = cursor->y - box.y; 65 if (wlr_box_contains_point(&box, cursor->x, cursor->y)) {
66 return NULL; 66 *surface = xsurface->surface;
67 } 67 *sx = cursor->x - box.x;
68 *sy = cursor->y - box.y;
69 return NULL;
68 } 70 }
69 } 71 }
70 72
diff --git a/sway/tree/layout.c b/sway/tree/layout.c
index 588ceb2d..ce0682dc 100644
--- a/sway/tree/layout.c
+++ b/sway/tree/layout.c
@@ -107,7 +107,7 @@ struct sway_container *container_reap_empty(struct sway_container *container) {
107 return NULL; 107 return NULL;
108 } 108 }
109 wlr_log(L_DEBUG, "reaping %p %s", container, container->name); 109 wlr_log(L_DEBUG, "reaping %p %s", container, container->name);
110 while (container->children->length == 0) { 110 while (container != &root_container && container->children->length == 0) {
111 if (container->type == C_WORKSPACE) { 111 if (container->type == C_WORKSPACE) {
112 if (!workspace_is_visible(container)) { 112 if (!workspace_is_visible(container)) {
113 struct sway_container *parent = container->parent; 113 struct sway_container *parent = container->parent;