UI: Global "Status-bar" Area (WIP)
[blender.git] / source / blender / editors / screen / area.c
index dc5c9be04c8b66ca63bfbdddb8d33ad6117c15e8..e8192c4ce90a60c12c059a738c4d82d381fff241 100644 (file)
@@ -1259,7 +1259,7 @@ static void region_rect_recursive(wmWindow *win, ScrArea *sa, ARegion *ar, rcti
        region_rect_recursive(win, sa, ar->next, remainder, overlap_remainder, quad);
 }
 
-static void area_calc_totrct(ScrArea *sa, int window_size_x, int window_size_y)
+static void area_calc_totrct(ScrArea *sa, const rcti *window_rect)
 {
        short px = (short)U.pixelsize;
 
@@ -1269,16 +1269,16 @@ static void area_calc_totrct(ScrArea *sa, int window_size_x, int window_size_y)
        sa->totrct.ymax = sa->v2->vec.y;
 
        /* scale down totrct by 1 pixel on all sides not matching window borders */
-       if (sa->totrct.xmin > 0) {
+       if (sa->totrct.xmin > window_rect->xmin) {
                sa->totrct.xmin += px;
        }
-       if (sa->totrct.xmax < (window_size_x - 1)) {
+       if (sa->totrct.xmax < (window_rect->xmax - 1)) {
                sa->totrct.xmax -= px;
        }
-       if (sa->totrct.ymin > 0) {
+       if (sa->totrct.ymin > window_rect->ymin) {
                sa->totrct.ymin += px;
        }
-       if (sa->totrct.ymax < (window_size_y - 1)) {
+       if (sa->totrct.ymax < (window_rect->ymax - 1)) {
                sa->totrct.ymax -= px;
        }
        /* Although the following asserts are correct they lead to a very unstable Blender.
@@ -1373,15 +1373,15 @@ static void ed_default_handlers(wmWindowManager *wm, ScrArea *sa, ListBase *hand
 
 void ED_area_update_region_sizes(wmWindowManager *wm, wmWindow *win, ScrArea *area)
 {
+       rcti rect, overlap_rect;
+       rcti window_rect;
+
        if (!(area->flag & AREA_FLAG_REGION_SIZE_UPDATE)) {
                return;
        }
 
-       const int size_x = WM_window_pixels_x(win);
-       const int size_y = WM_window_pixels_y(win);
-       rcti rect, overlap_rect;
-
-       area_calc_totrct(area, size_x, size_y);
+       WM_window_rect_calc(win, &window_rect);
+       area_calc_totrct(area, &window_rect);
 
        /* region rect sizes */
        rect = area->totrct;
@@ -1406,15 +1406,14 @@ void ED_area_initialize(wmWindowManager *wm, wmWindow *win, ScrArea *sa)
        WorkSpace *workspace = WM_window_get_active_workspace(win);
        const bScreen *screen = BKE_workspace_active_screen_get(win->workspace_hook);
        Scene *scene = WM_window_get_active_scene(win);
-
-       const int window_size_x = WM_window_pixels_x(win);
-       const int window_size_y = WM_window_pixels_y(win);
        ARegion *ar;
        rcti rect, overlap_rect;
+       rcti window_rect;
 
        if (ED_area_is_global(sa) && (sa->global->flag & GLOBAL_AREA_IS_HIDDEN)) {
                return;
        }
+       WM_window_rect_calc(win, &window_rect);
 
        /* set typedefinitions */
        sa->type = BKE_spacetype_from_id(sa->spacetype);
@@ -1428,7 +1427,7 @@ void ED_area_initialize(wmWindowManager *wm, wmWindow *win, ScrArea *sa)
                ar->type = BKE_regiontype_from_id(sa->type, ar->regiontype);
 
        /* area sizes */
-       area_calc_totrct(sa, window_size_x, window_size_y);
+       area_calc_totrct(sa, &window_rect);
 
        /* region rect sizes */
        rect = sa->totrct;