Stop floaters from snapping on move to new output

This commit is contained in:
Brian Ashworth 2018-08-27 03:06:37 -04:00
parent d6a5dfc913
commit 11c1619f30
1 changed files with 12 additions and 10 deletions

View File

@ -216,16 +216,18 @@ static void arrange_workspace(struct sway_container *workspace) {
// Adjust any floating containers // Adjust any floating containers
double diff_x = workspace->x - prev_x; double diff_x = workspace->x - prev_x;
double diff_y = workspace->y - prev_y; double diff_y = workspace->y - prev_y;
for (int i = 0; i < workspace->sway_workspace->floating->length; ++i) { if (diff_x != 0 || diff_y != 0) {
struct sway_container *floater = for (int i = 0; i < workspace->sway_workspace->floating->length; ++i) {
workspace->sway_workspace->floating->items[i]; struct sway_container *floater =
container_floating_translate(floater, diff_x, diff_y); workspace->sway_workspace->floating->items[i];
double center_x = floater->x + floater->width / 2; container_floating_translate(floater, diff_x, diff_y);
double center_y = floater->y + floater->height / 2; double center_x = floater->x + floater->width / 2;
struct wlr_box workspace_box; double center_y = floater->y + floater->height / 2;
container_get_box(workspace, &workspace_box); struct wlr_box workspace_box;
if (!wlr_box_contains_point(&workspace_box, center_x, center_y)) { container_get_box(workspace, &workspace_box);
container_floating_move_to_center(floater); if (!wlr_box_contains_point(&workspace_box, center_x, center_y)) {
container_floating_move_to_center(floater);
}
} }
} }