aboutsummaryrefslogtreecommitdiffstats
path: root/sway/tree/layout.c
diff options
context:
space:
mode:
authorLibravatar Ryan Dwyer <ryandwyer1@gmail.com>2018-05-27 09:46:40 +1000
committerLibravatar Ryan Dwyer <ryandwyer1@gmail.com>2018-06-01 23:14:58 +1000
commit40af5d81a1da972cdd59ecb0372ee756433aba26 (patch)
tree497a12188ecfd21f4c1a3eecf61ced340bac2449 /sway/tree/layout.c
parentRemove unfinished wants_floating implementation for xwayland (diff)
downloadsway-40af5d81a1da972cdd59ecb0372ee756433aba26.tar.gz
sway-40af5d81a1da972cdd59ecb0372ee756433aba26.tar.zst
sway-40af5d81a1da972cdd59ecb0372ee756433aba26.zip
Fix getting adjacent output
Diffstat (limited to 'sway/tree/layout.c')
-rw-r--r--sway/tree/layout.c24
1 files changed, 2 insertions, 22 deletions
diff --git a/sway/tree/layout.c b/sway/tree/layout.c
index 28775253..d88948dc 100644
--- a/sway/tree/layout.c
+++ b/sway/tree/layout.c
@@ -680,26 +680,6 @@ static struct sway_container *get_swayc_in_output_direction(
680 return ws; 680 return ws;
681} 681}
682 682
683static void get_layout_center_position(struct sway_container *container,
684 int *x, int *y) {
685 // FIXME view coords are inconsistently referred to in layout/output systems
686 if (container->type == C_OUTPUT) {
687 *x = container->x + container->width/2;
688 *y = container->y + container->height/2;
689 } else {
690 struct sway_container *output = container_parent(container, C_OUTPUT);
691 if (container->type == C_WORKSPACE) {
692 // Workspace coordinates are actually wrong/arbitrary, but should
693 // be same as output.
694 *x = output->x;
695 *y = output->y;
696 } else {
697 *x = output->x + container->x;
698 *y = output->y + container->y;
699 }
700 }
701}
702
703static struct sway_container *sway_output_from_wlr(struct wlr_output *output) { 683static struct sway_container *sway_output_from_wlr(struct wlr_output *output) {
704 if (output == NULL) { 684 if (output == NULL) {
705 return NULL; 685 return NULL;
@@ -755,8 +735,8 @@ struct sway_container *container_get_in_direction(
755 "got invalid direction: %d", dir)) { 735 "got invalid direction: %d", dir)) {
756 return NULL; 736 return NULL;
757 } 737 }
758 int lx, ly; 738 int lx = container->x + container->width / 2;
759 get_layout_center_position(container, &lx, &ly); 739 int ly = container->y + container->height / 2;
760 struct wlr_output_layout *layout = 740 struct wlr_output_layout *layout =
761 root_container.sway_root->output_layout; 741 root_container.sway_root->output_layout;
762 struct wlr_output *wlr_adjacent = 742 struct wlr_output *wlr_adjacent =