UI: Increase Area Padding at Window Edges

This PR slightly increases the area border padding at the window edges.
The current lack of padding looks awkward when paired with area
highlighting since that line hits the window edges.

Pull Request: https://projects.blender.org/blender/blender/pulls/137925
This commit is contained in:
Harley Acheson
2025-06-13 19:58:40 +02:00
committed by Harley Acheson
parent d230aa498e
commit 24a80f250e

View File

@@ -1811,7 +1811,11 @@ static void region_rect_recursive(
static void area_calc_totrct(const bScreen *screen, ScrArea *area, const rcti *window_rect)
{
short px = short(std::max(float(U.border_width) * UI_SCALE_FAC, UI_SCALE_FAC));
/* Padding around each area, except at window edges. */
const short px = short(std::max(float(U.border_width) * UI_SCALE_FAC, UI_SCALE_FAC));
/* Padding at window edges. */
const short px_edge = int(UI_SCALE_FAC * 2.0f);
area->totrct.xmin = area->v1->vec.x;
area->totrct.xmax = area->v4->vec.x;
@@ -1819,18 +1823,12 @@ static void area_calc_totrct(const bScreen *screen, ScrArea *area, const rcti *w
area->totrct.ymax = area->v2->vec.y;
/* Scale down totrct by the border size on all sides not at window edges. */
if (!ED_area_is_global(area) && screen->state != SCREENFULL &&
!(screen->temp && BLI_listbase_is_single(&screen->areabase)))
if (!ED_area_is_global(area) && screen->state != SCREENFULL && !(screen->temp) &&
!BLI_listbase_is_single(&screen->areabase))
{
if (area->totrct.xmin > window_rect->xmin) {
area->totrct.xmin += px;
}
if (area->totrct.xmax < (window_rect->xmax - 1)) {
area->totrct.xmax -= px;
}
if (area->totrct.ymin > window_rect->ymin) {
area->totrct.ymin += px;
}
area->totrct.xmin += (area->totrct.xmin > window_rect->xmin) ? px : px_edge;
area->totrct.xmax -= (area->totrct.xmax < (window_rect->xmax - 1)) ? px : px_edge;
area->totrct.ymin += (area->totrct.ymin > window_rect->ymin) ? px : px_edge;
if (area->totrct.ymax < (window_rect->ymax - 1)) {
area->totrct.ymax -= px;
@@ -1839,6 +1837,9 @@ static void area_calc_totrct(const bScreen *screen, ScrArea *area, const rcti *w
/* Small gap below Top Bar. */
area->totrct.ymax -= U.pixelsize;
}
else {
area->totrct.ymax -= px_edge;
}
}
/* Although the following asserts are correct they lead to a very unstable Blender.
* And the asserts would fail even in 2.7x