feat: automatic window placement

With automatic placement, new top-level windows will be placed to
minimize overlap with other windows already on screen.
This commit is contained in:
Andrew J. Hesford 2023-12-24 13:57:46 -05:00 committed by Johan Malm
parent ef62d47ad1
commit 52aafcc054
7 changed files with 548 additions and 5 deletions

View file

@ -9,6 +9,7 @@
#include "input/keyboard.h"
#include "labwc.h"
#include "menu/menu.h"
#include "placement.h"
#include "regions.h"
#include "resize_indicator.h"
#include "snap.h"
@ -684,6 +685,12 @@ view_place_initial(struct view *view)
if (rc.placement_policy == LAB_PLACE_CURSOR) {
view_move_to_cursor(view);
return;
} else if (rc.placement_policy == LAB_PLACE_AUTOMATIC) {
int x = 0, y = 0;
if (placement_find_best(view, &x, &y)) {
view_move(view, x, y);
return;
}
}
view_center(view, NULL);