aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Kirill Primak <vyivel@eclair.cafe>2022-01-29 23:11:54 +0300
committerLibravatar Simon Ser <contact@emersion.fr>2022-01-31 11:44:03 +0100
commitee7668c1f2b5ba31420d972161d6d43fc1c84bb4 (patch)
treedb2d114113e60cfa4f5a1c87813c53868e0bf9f1
parentxwayland: listen to `request_activate` event (diff)
downloadsway-ee7668c1f2b5ba31420d972161d6d43fc1c84bb4.tar.gz
sway-ee7668c1f2b5ba31420d972161d6d43fc1c84bb4.tar.zst
sway-ee7668c1f2b5ba31420d972161d6d43fc1c84bb4.zip
chore: chase wlr_output_layout_get_box() update
https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/3439
-rw-r--r--sway/commands/move.c16
-rw-r--r--sway/config/output.c12
-rw-r--r--sway/desktop/desktop.c9
-rw-r--r--sway/desktop/output.c11
-rw-r--r--sway/tree/arrange.c25
-rw-r--r--sway/tree/container.c21
-rw-r--r--sway/tree/output.c8
7 files changed, 53 insertions, 49 deletions
diff --git a/sway/commands/move.c b/sway/commands/move.c
index 1a05a7a6..0d0d9727 100644
--- a/sway/commands/move.c
+++ b/sway/commands/move.c
@@ -788,15 +788,15 @@ static struct cmd_results *cmd_move_to_position_pointer(
788 struct wlr_output *output = wlr_output_layout_output_at( 788 struct wlr_output *output = wlr_output_layout_output_at(
789 root->output_layout, cursor->x, cursor->y); 789 root->output_layout, cursor->x, cursor->y);
790 if (output) { 790 if (output) {
791 struct wlr_box *box = 791 struct wlr_box box;
792 wlr_output_layout_get_box(root->output_layout, output); 792 wlr_output_layout_get_box(root->output_layout, output, &box);
793 lx = fmax(lx, box->x); 793 lx = fmax(lx, box.x);
794 ly = fmax(ly, box->y); 794 ly = fmax(ly, box.y);
795 if (lx + container->pending.width > box->x + box->width) { 795 if (lx + container->pending.width > box.x + box.width) {
796 lx = box->x + box->width - container->pending.width; 796 lx = box.x + box.width - container->pending.width;
797 } 797 }
798 if (ly + container->pending.height > box->y + box->height) { 798 if (ly + container->pending.height > box.y + box.height) {
799 ly = box->y + box->height - container->pending.height; 799 ly = box.y + box.height - container->pending.height;
800 } 800 }
801 } 801 }
802 802
diff --git a/sway/config/output.c b/sway/config/output.c
index fa509252..88514ac0 100644
--- a/sway/config/output.c
+++ b/sway/config/output.c
@@ -546,12 +546,12 @@ bool apply_output_config(struct output_config *oc, struct sway_output *output) {
546 } 546 }
547 547
548 // Update output->{lx, ly, width, height} 548 // Update output->{lx, ly, width, height}
549 struct wlr_box *output_box = 549 struct wlr_box output_box;
550 wlr_output_layout_get_box(root->output_layout, wlr_output); 550 wlr_output_layout_get_box(root->output_layout, wlr_output, &output_box);
551 output->lx = output_box->x; 551 output->lx = output_box.x;
552 output->ly = output_box->y; 552 output->ly = output_box.y;
553 output->width = output_box->width; 553 output->width = output_box.width;
554 output->height = output_box->height; 554 output->height = output_box.height;
555 555
556 if (!output->enabled) { 556 if (!output->enabled) {
557 output_enable(output); 557 output_enable(output);
diff --git a/sway/desktop/desktop.c b/sway/desktop/desktop.c
index ec45d80a..c8d4502c 100644
--- a/sway/desktop/desktop.c
+++ b/sway/desktop/desktop.c
@@ -6,10 +6,11 @@ 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 struct wlr_box *output_box = wlr_output_layout_get_box( 9 struct wlr_box output_box;
10 root->output_layout, output->wlr_output); 10 wlr_output_layout_get_box(root->output_layout,
11 output_damage_surface(output, lx - output_box->x, 11 output->wlr_output, &output_box);
12 ly - output_box->y, surface, whole); 12 output_damage_surface(output, lx - output_box.x,
13 ly - output_box.y, surface, whole);
13 } 14 }
14} 15}
15 16
diff --git a/sway/desktop/output.c b/sway/desktop/output.c
index 852671d2..dd2eaf08 100644
--- a/sway/desktop/output.c
+++ b/sway/desktop/output.c
@@ -737,14 +737,15 @@ static void update_output_manager_config(struct sway_server *server) {
737 } 737 }
738 struct wlr_output_configuration_head_v1 *config_head = 738 struct wlr_output_configuration_head_v1 *config_head =
739 wlr_output_configuration_head_v1_create(config, output->wlr_output); 739 wlr_output_configuration_head_v1_create(config, output->wlr_output);
740 struct wlr_box *output_box = wlr_output_layout_get_box( 740 struct wlr_box output_box;
741 root->output_layout, output->wlr_output); 741 wlr_output_layout_get_box(root->output_layout,
742 output->wlr_output, &output_box);
742 // We mark the output enabled even if it is switched off by DPMS 743 // We mark the output enabled even if it is switched off by DPMS
743 config_head->state.enabled = output->current_mode != NULL && output->enabled; 744 config_head->state.enabled = output->current_mode != NULL && output->enabled;
744 config_head->state.mode = output->current_mode; 745 config_head->state.mode = output->current_mode;
745 if (output_box) { 746 if (!wlr_box_empty(&output_box)) {
746 config_head->state.x = output_box->x; 747 config_head->state.x = output_box.x;
747 config_head->state.y = output_box->y; 748 config_head->state.y = output_box.y;
748 } 749 }
749 } 750 }
750 751
diff --git a/sway/tree/arrange.c b/sway/tree/arrange.c
index 4aa82c35..9c1a11e5 100644
--- a/sway/tree/arrange.c
+++ b/sway/tree/arrange.c
@@ -311,12 +311,13 @@ void arrange_output(struct sway_output *output) {
311 if (config->reloading) { 311 if (config->reloading) {
312 return; 312 return;
313 } 313 }
314 const struct wlr_box *output_box = wlr_output_layout_get_box( 314 struct wlr_box output_box;
315 root->output_layout, output->wlr_output); 315 wlr_output_layout_get_box(root->output_layout,
316 output->lx = output_box->x; 316 output->wlr_output, &output_box);
317 output->ly = output_box->y; 317 output->lx = output_box.x;
318 output->width = output_box->width; 318 output->ly = output_box.y;
319 output->height = output_box->height; 319 output->width = output_box.width;
320 output->height = output_box.height;
320 321
321 for (int i = 0; i < output->workspaces->length; ++i) { 322 for (int i = 0; i < output->workspaces->length; ++i) {
322 struct sway_workspace *workspace = output->workspaces->items[i]; 323 struct sway_workspace *workspace = output->workspaces->items[i];
@@ -328,12 +329,12 @@ void arrange_root(void) {
328 if (config->reloading) { 329 if (config->reloading) {
329 return; 330 return;
330 } 331 }
331 const struct wlr_box *layout_box = 332 struct wlr_box layout_box;
332 wlr_output_layout_get_box(root->output_layout, NULL); 333 wlr_output_layout_get_box(root->output_layout, NULL, &layout_box);
333 root->x = layout_box->x; 334 root->x = layout_box.x;
334 root->y = layout_box->y; 335 root->y = layout_box.y;
335 root->width = layout_box->width; 336 root->width = layout_box.width;
336 root->height = layout_box->height; 337 root->height = layout_box.height;
337 338
338 if (root->fullscreen_global) { 339 if (root->fullscreen_global) {
339 struct sway_container *fs = root->fullscreen_global; 340 struct sway_container *fs = root->fullscreen_global;
diff --git a/sway/tree/container.c b/sway/tree/container.c
index 4756028c..bcac36b1 100644
--- a/sway/tree/container.c
+++ b/sway/tree/container.c
@@ -695,12 +695,13 @@ void floating_calculate_constraints(int *min_width, int *max_width,
695 *min_height = config->floating_minimum_height; 695 *min_height = config->floating_minimum_height;
696 } 696 }
697 697
698 struct wlr_box *box = wlr_output_layout_get_box(root->output_layout, NULL); 698 struct wlr_box box;
699 wlr_output_layout_get_box(root->output_layout, NULL, &box);
699 700
700 if (config->floating_maximum_width == -1) { // no maximum 701 if (config->floating_maximum_width == -1) { // no maximum
701 *max_width = INT_MAX; 702 *max_width = INT_MAX;
702 } else if (config->floating_maximum_width == 0) { // automatic 703 } else if (config->floating_maximum_width == 0) { // automatic
703 *max_width = box->width; 704 *max_width = box.width;
704 } else { 705 } else {
705 *max_width = config->floating_maximum_width; 706 *max_width = config->floating_maximum_width;
706 } 707 }
@@ -708,7 +709,7 @@ void floating_calculate_constraints(int *min_width, int *max_width,
708 if (config->floating_maximum_height == -1) { // no maximum 709 if (config->floating_maximum_height == -1) { // no maximum
709 *max_height = INT_MAX; 710 *max_height = INT_MAX;
710 } else if (config->floating_maximum_height == 0) { // automatic 711 } else if (config->floating_maximum_height == 0) { // automatic
711 *max_height = box->height; 712 *max_height = box.height;
712 } else { 713 } else {
713 *max_height = config->floating_maximum_height; 714 *max_height = config->floating_maximum_height;
714 } 715 }
@@ -740,9 +741,9 @@ void container_floating_resize_and_center(struct sway_container *con) {
740 return; 741 return;
741 } 742 }
742 743
743 struct wlr_box *ob = wlr_output_layout_get_box(root->output_layout, 744 struct wlr_box ob;
744 ws->output->wlr_output); 745 wlr_output_layout_get_box(root->output_layout, ws->output->wlr_output, &ob);
745 if (!ob) { 746 if (wlr_box_empty(&ob)) {
746 // On NOOP output. Will be called again when moved to an output 747 // On NOOP output. Will be called again when moved to an output
747 con->pending.x = 0; 748 con->pending.x = 0;
748 con->pending.y = 0; 749 con->pending.y = 0;
@@ -754,8 +755,8 @@ void container_floating_resize_and_center(struct sway_container *con) {
754 floating_natural_resize(con); 755 floating_natural_resize(con);
755 if (!con->view) { 756 if (!con->view) {
756 if (con->pending.width > ws->width || con->pending.height > ws->height) { 757 if (con->pending.width > ws->width || con->pending.height > ws->height) {
757 con->pending.x = ob->x + (ob->width - con->pending.width) / 2; 758 con->pending.x = ob.x + (ob.width - con->pending.width) / 2;
758 con->pending.y = ob->y + (ob->height - con->pending.height) / 2; 759 con->pending.y = ob.y + (ob.height - con->pending.height) / 2;
759 } else { 760 } else {
760 con->pending.x = ws->x + (ws->width - con->pending.width) / 2; 761 con->pending.x = ws->x + (ws->width - con->pending.width) / 2;
761 con->pending.y = ws->y + (ws->height - con->pending.height) / 2; 762 con->pending.y = ws->y + (ws->height - con->pending.height) / 2;
@@ -763,8 +764,8 @@ void container_floating_resize_and_center(struct sway_container *con) {
763 } else { 764 } else {
764 if (con->pending.content_width > ws->width 765 if (con->pending.content_width > ws->width
765 || con->pending.content_height > ws->height) { 766 || con->pending.content_height > ws->height) {
766 con->pending.content_x = ob->x + (ob->width - con->pending.content_width) / 2; 767 con->pending.content_x = ob.x + (ob.width - con->pending.content_width) / 2;
767 con->pending.content_y = ob->y + (ob->height - con->pending.content_height) / 2; 768 con->pending.content_y = ob.y + (ob.height - con->pending.content_height) / 2;
768 } else { 769 } else {
769 con->pending.content_x = ws->x + (ws->width - con->pending.content_width) / 2; 770 con->pending.content_x = ws->x + (ws->width - con->pending.content_width) / 2;
770 con->pending.content_y = ws->y + (ws->height - con->pending.content_height) / 2; 771 con->pending.content_y = ws->y + (ws->height - con->pending.content_height) / 2;
diff --git a/sway/tree/output.c b/sway/tree/output.c
index ad8d2482..52826c91 100644
--- a/sway/tree/output.c
+++ b/sway/tree/output.c
@@ -301,10 +301,10 @@ struct sway_output *output_get_in_direction(struct sway_output *reference,
301 if (!sway_assert(direction, "got invalid direction: %d", direction)) { 301 if (!sway_assert(direction, "got invalid direction: %d", direction)) {
302 return NULL; 302 return NULL;
303 } 303 }
304 struct wlr_box *output_box = 304 struct wlr_box output_box;
305 wlr_output_layout_get_box(root->output_layout, reference->wlr_output); 305 wlr_output_layout_get_box(root->output_layout, reference->wlr_output, &output_box);
306 int lx = output_box->x + output_box->width / 2; 306 int lx = output_box.x + output_box.width / 2;
307 int ly = output_box->y + output_box->height / 2; 307 int ly = output_box.y + output_box.height / 2;
308 struct wlr_output *wlr_adjacent = wlr_output_layout_adjacent_output( 308 struct wlr_output *wlr_adjacent = wlr_output_layout_adjacent_output(
309 root->output_layout, direction, reference->wlr_output, lx, ly); 309 root->output_layout, direction, reference->wlr_output, lx, ly);
310 if (!wlr_adjacent) { 310 if (!wlr_adjacent) {