aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar emersion <contact@emersion.fr>2019-03-11 11:45:01 +0100
committerLibravatar Brian Ashworth <bosrsf04@gmail.com>2019-03-11 12:43:01 -0400
commit076257a978ce5f93b9b1613e43a067e602b5b041 (patch)
treef87dcb88bee0097cbf741df180f17d06299087cf
parentFix size_t temporary underflow in log_loaded_themes (diff)
downloadsway-076257a978ce5f93b9b1613e43a067e602b5b041.tar.gz
sway-076257a978ce5f93b9b1613e43a067e602b5b041.tar.zst
sway-076257a978ce5f93b9b1613e43a067e602b5b041.zip
Stop using wlr_output->{lx,ly}
Also fixes sway_output->{lx,ly,width,height} not being updated. Also fixes output_get_in_direction adding buffer coords to layout coords.
-rw-r--r--include/sway/output.h6
-rw-r--r--sway/config/output.c8
-rw-r--r--sway/desktop/desktop.c6
-rw-r--r--sway/desktop/output.c24
-rw-r--r--sway/desktop/render.c53
-rw-r--r--sway/input/seatop_move_tiling.c2
-rw-r--r--sway/tree/arrange.c4
-rw-r--r--sway/tree/output.c11
8 files changed, 61 insertions, 53 deletions
diff --git a/include/sway/output.h b/include/sway/output.h
index ea7a2174..32ed1e28 100644
--- a/include/sway/output.h
+++ b/include/sway/output.h
@@ -29,8 +29,8 @@ struct sway_output {
29 struct timespec last_frame; 29 struct timespec last_frame;
30 struct wlr_output_damage *damage; 30 struct wlr_output_damage *damage;
31 31
32 int lx, ly; 32 int lx, ly; // layout coords
33 int width, height; 33 int width, height; // transformed buffer size
34 34
35 bool enabled, configured; 35 bool enabled, configured;
36 list_t *workspaces; 36 list_t *workspaces;
@@ -144,7 +144,7 @@ void output_get_box(struct sway_output *output, struct wlr_box *box);
144enum sway_container_layout output_get_default_layout( 144enum sway_container_layout output_get_default_layout(
145 struct sway_output *output); 145 struct sway_output *output);
146 146
147void render_rect(struct wlr_output *wlr_output, 147void render_rect(struct sway_output *output,
148 pixman_region32_t *output_damage, const struct wlr_box *_box, 148 pixman_region32_t *output_damage, const struct wlr_box *_box,
149 float color[static 4]); 149 float color[static 4]);
150 150
diff --git a/sway/config/output.c b/sway/config/output.c
index 3a36ed18..1f55fd6a 100644
--- a/sway/config/output.c
+++ b/sway/config/output.c
@@ -319,6 +319,14 @@ bool apply_output_config(struct output_config *oc, struct sway_output *output) {
319 wlr_output_layout_add_auto(root->output_layout, wlr_output); 319 wlr_output_layout_add_auto(root->output_layout, wlr_output);
320 } 320 }
321 321
322 // Update output->{lx, ly, width, height}
323 struct wlr_box *output_box =
324 wlr_output_layout_get_box(root->output_layout, wlr_output);
325 output->lx = output_box->x;
326 output->ly = output_box->y;
327 wlr_output_transformed_resolution(wlr_output,
328 &output->width, &output->height);
329
322 if (output->swaybg_client != NULL) { 330 if (output->swaybg_client != NULL) {
323 wl_client_destroy(output->swaybg_client); 331 wl_client_destroy(output->swaybg_client);
324 } 332 }
diff --git a/sway/desktop/desktop.c b/sway/desktop/desktop.c
index d8dd0240..ec45d80a 100644
--- a/sway/desktop/desktop.c
+++ b/sway/desktop/desktop.c
@@ -6,8 +6,10 @@ void desktop_damage_surface(struct wlr_surface *surface, double lx, double ly,
6 bool whole) { 6 bool whole) {
7 for (int i = 0; i < root->outputs->length; ++i) { 7 for (int i = 0; i < root->outputs->length; ++i) {
8 struct sway_output *output = root->outputs->items[i]; 8 struct sway_output *output = root->outputs->items[i];
9 output_damage_surface(output, lx - output->wlr_output->lx, 9 struct wlr_box *output_box = wlr_output_layout_get_box(
10 ly - output->wlr_output->ly, surface, whole); 10 root->output_layout, output->wlr_output);
11 output_damage_surface(output, lx - output_box->x,
12 ly - output_box->y, surface, whole);
11 } 13 }
12} 14}
13 15
diff --git a/sway/desktop/output.c b/sway/desktop/output.c
index 3ff4d726..1d9abbfd 100644
--- a/sway/desktop/output.c
+++ b/sway/desktop/output.c
@@ -150,9 +150,9 @@ void output_view_for_each_surface(struct sway_output *output,
150 .user_iterator = iterator, 150 .user_iterator = iterator,
151 .user_data = user_data, 151 .user_data = user_data,
152 .output = output, 152 .output = output,
153 .ox = view->container->current.content_x - output->wlr_output->lx 153 .ox = view->container->current.content_x - output->lx
154 - view->geometry.x, 154 - view->geometry.x,
155 .oy = view->container->current.content_y - output->wlr_output->ly 155 .oy = view->container->current.content_y - output->ly
156 - view->geometry.y, 156 - view->geometry.y,
157 .width = view->container->current.content_width, 157 .width = view->container->current.content_width,
158 .height = view->container->current.content_height, 158 .height = view->container->current.content_height,
@@ -169,9 +169,9 @@ void output_view_for_each_popup(struct sway_output *output,
169 .user_iterator = iterator, 169 .user_iterator = iterator,
170 .user_data = user_data, 170 .user_data = user_data,
171 .output = output, 171 .output = output,
172 .ox = view->container->current.content_x - output->wlr_output->lx 172 .ox = view->container->current.content_x - output->lx
173 - view->geometry.x, 173 - view->geometry.x,
174 .oy = view->container->current.content_y - output->wlr_output->ly 174 .oy = view->container->current.content_y - output->ly
175 - view->geometry.y, 175 - view->geometry.y,
176 .width = view->container->current.content_width, 176 .width = view->container->current.content_width,
177 .height = view->container->current.content_height, 177 .height = view->container->current.content_height,
@@ -202,8 +202,8 @@ void output_unmanaged_for_each_surface(struct sway_output *output,
202 wl_list_for_each(unmanaged_surface, unmanaged, link) { 202 wl_list_for_each(unmanaged_surface, unmanaged, link) {
203 struct wlr_xwayland_surface *xsurface = 203 struct wlr_xwayland_surface *xsurface =
204 unmanaged_surface->wlr_xwayland_surface; 204 unmanaged_surface->wlr_xwayland_surface;
205 double ox = unmanaged_surface->lx - output->wlr_output->lx; 205 double ox = unmanaged_surface->lx - output->lx;
206 double oy = unmanaged_surface->ly - output->wlr_output->ly; 206 double oy = unmanaged_surface->ly - output->ly;
207 207
208 output_surface_for_each_surface(output, xsurface->surface, ox, oy, 208 output_surface_for_each_surface(output, xsurface->surface, ox, oy,
209 iterator, user_data); 209 iterator, user_data);
@@ -216,8 +216,8 @@ void output_drag_icons_for_each_surface(struct sway_output *output,
216 void *user_data) { 216 void *user_data) {
217 struct sway_drag_icon *drag_icon; 217 struct sway_drag_icon *drag_icon;
218 wl_list_for_each(drag_icon, drag_icons, link) { 218 wl_list_for_each(drag_icon, drag_icons, link) {
219 double ox = drag_icon->x - output->wlr_output->lx; 219 double ox = drag_icon->x - output->lx;
220 double oy = drag_icon->y - output->wlr_output->ly; 220 double oy = drag_icon->y - output->ly;
221 221
222 if (drag_icon->wlr_drag_icon->mapped) { 222 if (drag_icon->wlr_drag_icon->mapped) {
223 output_surface_for_each_surface(output, 223 output_surface_for_each_surface(output,
@@ -463,8 +463,8 @@ void output_damage_from_view(struct sway_output *output,
463void output_damage_box(struct sway_output *output, struct wlr_box *_box) { 463void output_damage_box(struct sway_output *output, struct wlr_box *_box) {
464 struct wlr_box box; 464 struct wlr_box box;
465 memcpy(&box, _box, sizeof(struct wlr_box)); 465 memcpy(&box, _box, sizeof(struct wlr_box));
466 box.x -= output->wlr_output->lx; 466 box.x -= output->lx;
467 box.y -= output->wlr_output->ly; 467 box.y -= output->ly;
468 scale_box(&box, output->wlr_output->scale); 468 scale_box(&box, output->wlr_output->scale);
469 wlr_output_damage_add_box(output->damage, &box); 469 wlr_output_damage_add_box(output->damage, &box);
470} 470}
@@ -484,8 +484,8 @@ void output_damage_whole_container(struct sway_output *output,
484 struct sway_container *con) { 484 struct sway_container *con) {
485 // Pad the box by 1px, because the width is a double and might be a fraction 485 // Pad the box by 1px, because the width is a double and might be a fraction
486 struct wlr_box box = { 486 struct wlr_box box = {
487 .x = con->current.x - output->wlr_output->lx - 1, 487 .x = con->current.x - output->lx - 1,
488 .y = con->current.y - output->wlr_output->ly - 1, 488 .y = con->current.y - output->ly - 1,
489 .width = con->current.width + 2, 489 .width = con->current.width + 2,
490 .height = con->current.height + 2, 490 .height = con->current.height + 2,
491 }; 491 };
diff --git a/sway/desktop/render.c b/sway/desktop/render.c
index 4b36a9c2..9e936bb5 100644
--- a/sway/desktop/render.c
+++ b/sway/desktop/render.c
@@ -157,16 +157,17 @@ static void render_drag_icons(struct sway_output *output,
157 157
158// _box.x and .y are expected to be layout-local 158// _box.x and .y are expected to be layout-local
159// _box.width and .height are expected to be output-buffer-local 159// _box.width and .height are expected to be output-buffer-local
160void render_rect(struct wlr_output *wlr_output, 160void render_rect(struct sway_output *output,
161 pixman_region32_t *output_damage, const struct wlr_box *_box, 161 pixman_region32_t *output_damage, const struct wlr_box *_box,
162 float color[static 4]) { 162 float color[static 4]) {
163 struct wlr_output *wlr_output = output->wlr_output;
163 struct wlr_renderer *renderer = 164 struct wlr_renderer *renderer =
164 wlr_backend_get_renderer(wlr_output->backend); 165 wlr_backend_get_renderer(wlr_output->backend);
165 166
166 struct wlr_box box; 167 struct wlr_box box;
167 memcpy(&box, _box, sizeof(struct wlr_box)); 168 memcpy(&box, _box, sizeof(struct wlr_box));
168 box.x -= wlr_output->lx * wlr_output->scale; 169 box.x -= output->lx * wlr_output->scale;
169 box.y -= wlr_output->ly * wlr_output->scale; 170 box.y -= output->ly * wlr_output->scale;
170 171
171 pixman_region32_t damage; 172 pixman_region32_t damage;
172 pixman_region32_init(&damage); 173 pixman_region32_init(&damage);
@@ -205,9 +206,9 @@ static void render_view_toplevels(struct sway_view *view,
205 }; 206 };
206 // Render all toplevels without descending into popups 207 // Render all toplevels without descending into popups
207 double ox = view->container->surface_x - 208 double ox = view->container->surface_x -
208 output->wlr_output->lx - view->geometry.x; 209 output->lx - view->geometry.x;
209 double oy = view->container->surface_y - 210 double oy = view->container->surface_y -
210 output->wlr_output->ly - view->geometry.y; 211 output->ly - view->geometry.y;
211 output_surface_for_each_surface(output, view->surface, ox, oy, 212 output_surface_for_each_surface(output, view->surface, ox, oy,
212 render_surface_iterator, &data); 213 render_surface_iterator, &data);
213} 214}
@@ -240,9 +241,9 @@ static void render_saved_view(struct sway_view *view,
240 return; 241 return;
241 } 242 }
242 struct wlr_box box = { 243 struct wlr_box box = {
243 .x = view->container->surface_x - output->wlr_output->lx - 244 .x = view->container->surface_x - output->lx -
244 view->saved_geometry.x, 245 view->saved_geometry.x,
245 .y = view->container->surface_y - output->wlr_output->ly - 246 .y = view->container->surface_y - output->ly -
246 view->saved_geometry.y, 247 view->saved_geometry.y,
247 .width = view->saved_buffer_width, 248 .width = view->saved_buffer_width,
248 .height = view->saved_buffer_height, 249 .height = view->saved_buffer_height,
@@ -298,7 +299,7 @@ static void render_view(struct sway_output *output, pixman_region32_t *damage,
298 box.width = state->border_thickness; 299 box.width = state->border_thickness;
299 box.height = state->content_height; 300 box.height = state->content_height;
300 scale_box(&box, output_scale); 301 scale_box(&box, output_scale);
301 render_rect(output->wlr_output, damage, &box, color); 302 render_rect(output, damage, &box, color);
302 } 303 }
303 304
304 list_t *siblings = container_get_current_siblings(con); 305 list_t *siblings = container_get_current_siblings(con);
@@ -317,7 +318,7 @@ static void render_view(struct sway_output *output, pixman_region32_t *damage,
317 box.width = state->border_thickness; 318 box.width = state->border_thickness;
318 box.height = state->content_height; 319 box.height = state->content_height;
319 scale_box(&box, output_scale); 320 scale_box(&box, output_scale);
320 render_rect(output->wlr_output, damage, &box, color); 321 render_rect(output, damage, &box, color);
321 } 322 }
322 323
323 if (state->border_bottom) { 324 if (state->border_bottom) {
@@ -332,7 +333,7 @@ static void render_view(struct sway_output *output, pixman_region32_t *damage,
332 box.width = state->width; 333 box.width = state->width;
333 box.height = state->border_thickness; 334 box.height = state->border_thickness;
334 scale_box(&box, output_scale); 335 scale_box(&box, output_scale);
335 render_rect(output->wlr_output, damage, &box, color); 336 render_rect(output, damage, &box, color);
336 } 337 }
337} 338}
338 339
@@ -359,8 +360,8 @@ static void render_titlebar(struct sway_output *output,
359 list_t *children = container_get_current_siblings(con); 360 list_t *children = container_get_current_siblings(con);
360 bool is_last_child = children->length == 0 || 361 bool is_last_child = children->length == 0 ||
361 children->items[children->length - 1] == con; 362 children->items[children->length - 1] == con;
362 double output_x = output->wlr_output->lx; 363 double output_x = output->lx;
363 double output_y = output->wlr_output->ly; 364 double output_y = output->ly;
364 int titlebar_border_thickness = config->titlebar_border_thickness; 365 int titlebar_border_thickness = config->titlebar_border_thickness;
365 int titlebar_h_padding = config->titlebar_h_padding; 366 int titlebar_h_padding = config->titlebar_h_padding;
366 int titlebar_v_padding = config->titlebar_v_padding; 367 int titlebar_v_padding = config->titlebar_v_padding;
@@ -374,7 +375,7 @@ static void render_titlebar(struct sway_output *output,
374 box.width = width; 375 box.width = width;
375 box.height = titlebar_border_thickness; 376 box.height = titlebar_border_thickness;
376 scale_box(&box, output_scale); 377 scale_box(&box, output_scale);
377 render_rect(output->wlr_output, output_damage, &box, color); 378 render_rect(output, output_damage, &box, color);
378 379
379 // Single pixel bar below title 380 // Single pixel bar below title
380 size_t left_offset = 0, right_offset = 0; 381 size_t left_offset = 0, right_offset = 0;
@@ -392,7 +393,7 @@ static void render_titlebar(struct sway_output *output,
392 box.width = width - left_offset - right_offset; 393 box.width = width - left_offset - right_offset;
393 box.height = titlebar_border_thickness; 394 box.height = titlebar_border_thickness;
394 scale_box(&box, output_scale); 395 scale_box(&box, output_scale);
395 render_rect(output->wlr_output, output_damage, &box, color); 396 render_rect(output, output_damage, &box, color);
396 397
397 if (layout == L_TABBED) { 398 if (layout == L_TABBED) {
398 // Single pixel left edge 399 // Single pixel left edge
@@ -402,7 +403,7 @@ static void render_titlebar(struct sway_output *output,
402 box.height = 403 box.height =
403 container_titlebar_height() - titlebar_border_thickness * 2; 404 container_titlebar_height() - titlebar_border_thickness * 2;
404 scale_box(&box, output_scale); 405 scale_box(&box, output_scale);
405 render_rect(output->wlr_output, output_damage, &box, color); 406 render_rect(output, output_damage, &box, color);
406 407
407 // Single pixel right edge 408 // Single pixel right edge
408 box.x = x + width - titlebar_border_thickness; 409 box.x = x + width - titlebar_border_thickness;
@@ -411,7 +412,7 @@ static void render_titlebar(struct sway_output *output,
411 box.height = 412 box.height =
412 container_titlebar_height() - titlebar_border_thickness * 2; 413 container_titlebar_height() - titlebar_border_thickness * 2;
413 scale_box(&box, output_scale); 414 scale_box(&box, output_scale);
414 render_rect(output->wlr_output, output_damage, &box, color); 415 render_rect(output, output_damage, &box, color);
415 } 416 }
416 417
417 int inner_x = x - output_x + titlebar_h_padding; 418 int inner_x = x - output_x + titlebar_h_padding;
@@ -470,12 +471,12 @@ static void render_titlebar(struct sway_output *output,
470 box.y = round((y + titlebar_border_thickness) * output_scale); 471 box.y = round((y + titlebar_border_thickness) * output_scale);
471 box.width = texture_box.width; 472 box.width = texture_box.width;
472 box.height = ob_padding_above; 473 box.height = ob_padding_above;
473 render_rect(output->wlr_output, output_damage, &box, color); 474 render_rect(output, output_damage, &box, color);
474 475
475 // Padding below 476 // Padding below
476 box.y += ob_padding_above + texture_box.height; 477 box.y += ob_padding_above + texture_box.height;
477 box.height = ob_padding_below; 478 box.height = ob_padding_below;
478 render_rect(output->wlr_output, output_damage, &box, color); 479 render_rect(output, output_damage, &box, color);
479 } 480 }
480 481
481 // Title text 482 // Title text
@@ -538,12 +539,12 @@ static void render_titlebar(struct sway_output *output,
538 box.y = round((y + titlebar_border_thickness) * output_scale); 539 box.y = round((y + titlebar_border_thickness) * output_scale);
539 box.width = texture_box.width; 540 box.width = texture_box.width;
540 box.height = ob_padding_above; 541 box.height = ob_padding_above;
541 render_rect(output->wlr_output, output_damage, &box, color); 542 render_rect(output, output_damage, &box, color);
542 543
543 // Padding below 544 // Padding below
544 box.y += ob_padding_above + texture_box.height; 545 box.y += ob_padding_above + texture_box.height;
545 box.height = ob_padding_below; 546 box.height = ob_padding_below;
546 render_rect(output->wlr_output, output_damage, &box, color); 547 render_rect(output, output_damage, &box, color);
547 } 548 }
548 549
549 // Determine the left + right extends of the textures (output-buffer local) 550 // Determine the left + right extends of the textures (output-buffer local)
@@ -577,7 +578,7 @@ static void render_titlebar(struct sway_output *output,
577 box.x = ob_left_x + ob_left_width + round(output_x * output_scale); 578 box.x = ob_left_x + ob_left_width + round(output_x * output_scale);
578 box.y = round(bg_y * output_scale); 579 box.y = round(bg_y * output_scale);
579 box.height = ob_bg_height; 580 box.height = ob_bg_height;
580 render_rect(output->wlr_output, output_damage, &box, color); 581 render_rect(output, output_damage, &box, color);
581 } 582 }
582 583
583 // Padding on left side 584 // Padding on left side
@@ -592,7 +593,7 @@ static void render_titlebar(struct sway_output *output,
592 if (box.x + box.width < left_x) { 593 if (box.x + box.width < left_x) {
593 box.width += left_x - box.x - box.width; 594 box.width += left_x - box.x - box.width;
594 } 595 }
595 render_rect(output->wlr_output, output_damage, &box, color); 596 render_rect(output, output_damage, &box, color);
596 597
597 // Padding on right side 598 // Padding on right side
598 right_offset = (layout == L_TABBED) * titlebar_border_thickness; 599 right_offset = (layout == L_TABBED) * titlebar_border_thickness;
@@ -607,7 +608,7 @@ static void render_titlebar(struct sway_output *output,
607 box.width += box.x - right_rx; 608 box.width += box.x - right_rx;
608 box.x = right_rx; 609 box.x = right_rx;
609 } 610 }
610 render_rect(output->wlr_output, output_damage, &box, color); 611 render_rect(output, output_damage, &box, color);
611 612
612 if (connects_sides) { 613 if (connects_sides) {
613 // Left pixel in line with bottom bar 614 // Left pixel in line with bottom bar
@@ -616,7 +617,7 @@ static void render_titlebar(struct sway_output *output,
616 box.width = state->border_thickness * state->border_left; 617 box.width = state->border_thickness * state->border_left;
617 box.height = titlebar_border_thickness; 618 box.height = titlebar_border_thickness;
618 scale_box(&box, output_scale); 619 scale_box(&box, output_scale);
619 render_rect(output->wlr_output, output_damage, &box, color); 620 render_rect(output, output_damage, &box, color);
620 621
621 // Right pixel in line with bottom bar 622 // Right pixel in line with bottom bar
622 box.x = x + width - state->border_thickness * state->border_right; 623 box.x = x + width - state->border_thickness * state->border_right;
@@ -624,7 +625,7 @@ static void render_titlebar(struct sway_output *output,
624 box.width = state->border_thickness * state->border_right; 625 box.width = state->border_thickness * state->border_right;
625 box.height = titlebar_border_thickness; 626 box.height = titlebar_border_thickness;
626 scale_box(&box, output_scale); 627 scale_box(&box, output_scale);
627 render_rect(output->wlr_output, output_damage, &box, color); 628 render_rect(output, output_damage, &box, color);
628 } 629 }
629} 630}
630 631
@@ -650,7 +651,7 @@ static void render_top_border(struct sway_output *output,
650 box.width = state->width; 651 box.width = state->width;
651 box.height = state->border_thickness; 652 box.height = state->border_thickness;
652 scale_box(&box, output_scale); 653 scale_box(&box, output_scale);
653 render_rect(output->wlr_output, output_damage, &box, color); 654 render_rect(output, output_damage, &box, color);
654} 655}
655 656
656struct parent_data { 657struct parent_data {
diff --git a/sway/input/seatop_move_tiling.c b/sway/input/seatop_move_tiling.c
index 4b5aa81e..2904792b 100644
--- a/sway/input/seatop_move_tiling.c
+++ b/sway/input/seatop_move_tiling.c
@@ -37,7 +37,7 @@ static void handle_render(struct sway_seat *seat,
37 struct wlr_box box; 37 struct wlr_box box;
38 memcpy(&box, &e->drop_box, sizeof(struct wlr_box)); 38 memcpy(&box, &e->drop_box, sizeof(struct wlr_box));
39 scale_box(&box, output->wlr_output->scale); 39 scale_box(&box, output->wlr_output->scale);
40 render_rect(output->wlr_output, damage, &box, color); 40 render_rect(output, damage, &box, color);
41 } 41 }
42} 42}
43 43
diff --git a/sway/tree/arrange.c b/sway/tree/arrange.c
index 438a2133..8583c53e 100644
--- a/sway/tree/arrange.c
+++ b/sway/tree/arrange.c
@@ -195,8 +195,8 @@ void arrange_workspace(struct sway_workspace *workspace) {
195 double prev_y = workspace->y; 195 double prev_y = workspace->y;
196 workspace->width = area->width; 196 workspace->width = area->width;
197 workspace->height = area->height; 197 workspace->height = area->height;
198 workspace->x = output->wlr_output->lx + area->x; 198 workspace->x = output->lx + area->x;
199 workspace->y = output->wlr_output->ly + area->y; 199 workspace->y = output->ly + area->y;
200 200
201 // Adjust any floating containers 201 // Adjust any floating containers
202 double diff_x = workspace->x - prev_x; 202 double diff_x = workspace->x - prev_x;
diff --git a/sway/tree/output.c b/sway/tree/output.c
index e0a66e0b..227d487c 100644
--- a/sway/tree/output.c
+++ b/sway/tree/output.c
@@ -101,11 +101,6 @@ void output_enable(struct sway_output *output, struct output_config *oc) {
101 output->configured = true; 101 output->configured = true;
102 list_add(root->outputs, output); 102 list_add(root->outputs, output);
103 103
104 output->lx = wlr_output->lx;
105 output->ly = wlr_output->ly;
106 wlr_output_transformed_resolution(wlr_output,
107 &output->width, &output->height);
108
109 restore_workspaces(output); 104 restore_workspaces(output);
110 105
111 struct sway_workspace *ws = NULL; 106 struct sway_workspace *ws = NULL;
@@ -311,8 +306,10 @@ struct sway_output *output_get_in_direction(struct sway_output *reference,
311 if (!sway_assert(direction, "got invalid direction: %d", direction)) { 306 if (!sway_assert(direction, "got invalid direction: %d", direction)) {
312 return NULL; 307 return NULL;
313 } 308 }
314 int lx = reference->wlr_output->lx + reference->width / 2; 309 struct wlr_box *output_box =
315 int ly = reference->wlr_output->ly + reference->height / 2; 310 wlr_output_layout_get_box(root->output_layout, reference->wlr_output);
311 int lx = output_box->x + output_box->width / 2;
312 int ly = output_box->y + output_box->height / 2;
316 struct wlr_output *wlr_adjacent = wlr_output_layout_adjacent_output( 313 struct wlr_output *wlr_adjacent = wlr_output_layout_adjacent_output(
317 root->output_layout, direction, reference->wlr_output, lx, ly); 314 root->output_layout, direction, reference->wlr_output, lx, ly);
318 if (!wlr_adjacent) { 315 if (!wlr_adjacent) {