diff --git a/src/view.c b/src/view.c index 2a49973e..94c5c2a9 100644 --- a/src/view.c +++ b/src/view.c @@ -898,16 +898,8 @@ adjust_floating_geometry(struct view *view, struct wlr_box *geometry, } /* Reposition offscreen automatically if configured to do so */ - if (rc.placement_policy == LAB_PLACE_AUTOMATIC) { - if (placement_find_best(view, geometry)) { - return true; - } - } - - /* If automatic placement failed or was not enabled, just center */ - return view_compute_centered_position(view, NULL, - geometry->width, geometry->height, - &geometry->x, &geometry->y); + return view_compute_position_by_policy(view, geometry, + /* allow_cursor */ true, rc.placement_policy); } struct wlr_box @@ -917,8 +909,8 @@ view_get_fallback_natural_geometry(struct view *view) .width = VIEW_FALLBACK_WIDTH, .height = VIEW_FALLBACK_HEIGHT, }; - view_compute_centered_position(view, NULL, - box.width, box.height, &box.x, &box.y); + view_compute_position_by_policy(view, &box, + /* allow_cursor */ true, rc.placement_policy); return box; } diff --git a/src/xdg.c b/src/xdg.c index d3774801..84455efa 100644 --- a/src/xdg.c +++ b/src/xdg.c @@ -123,10 +123,8 @@ do_late_positioning(struct view *view) /* Reposition the view while anchoring it to cursor */ interactive_anchor_to_cursor(server, &view->pending); } else { - /* TODO: smart placement? */ - view_compute_centered_position(view, NULL, - view->pending.width, view->pending.height, - &view->pending.x, &view->pending.y); + view_compute_position_by_policy(view, &view->pending, + /* allow_cursor */ true, rc.placement_policy); } } diff --git a/src/xwayland.c b/src/xwayland.c index 707ab390..d04d7768 100644 --- a/src/xwayland.c +++ b/src/xwayland.c @@ -769,15 +769,12 @@ set_initial_position(struct view *view, /* allow_cursor */ true, rc.placement_policy); } else { /* - * View is maximized/fullscreen. Center the + * View is maximized/fullscreen. Place the * stored natural geometry without actually * moving the view. */ - view_compute_centered_position(view, NULL, - view->natural_geometry.width, - view->natural_geometry.height, - &view->natural_geometry.x, - &view->natural_geometry.y); + view_compute_position_by_policy(view, &view->natural_geometry, + /* allow_cursor */ true, rc.placement_policy); } }