Fix T62425: topbar showing wrong buttons at some UI scales.
authorBrecht Van Lommel <brechtvanlommel@gmail.com>
Thu, 14 Mar 2019 16:10:47 +0000 (17:10 +0100)
committerBrecht Van Lommel <brechtvanlommel@gmail.com>
Thu, 14 Mar 2019 17:59:11 +0000 (18:59 +0100)
source/blender/editors/screen/screen_edit.c
source/blender/makesdna/DNA_screen_types.h

index e5d2345..cd5b557 100644 (file)
@@ -794,10 +794,15 @@ static void screen_global_area_refresh(
        }
 }
 
+static int screen_global_header_size(void)
+{
+       return (int)ceilf(ED_area_headersize() / UI_DPI_FAC);
+}
+
 static void screen_global_topbar_area_refresh(wmWindow *win, bScreen *screen)
 {
-       const short size_min = HEADERY;
-       const short size_max = 2.25 * HEADERY;
+       const short size_min = screen_global_header_size();
+       const short size_max = 2.25 * screen_global_header_size();
        const short size = (screen->flag & SCREEN_COLLAPSE_TOPBAR) ? size_min : size_max;
        rcti rect;
 
@@ -810,7 +815,7 @@ static void screen_global_topbar_area_refresh(wmWindow *win, bScreen *screen)
 static void screen_global_statusbar_area_refresh(wmWindow *win, bScreen *screen)
 {
        const short size_min = 1;
-       const short size_max = 0.8f * HEADERY;
+       const short size_max = 0.8f * screen_global_header_size();
        const short size = (screen->flag & SCREEN_COLLAPSE_STATUSBAR) ? size_min : size_max;
        rcti rect;
 
index c62aed7..6121ff3 100644 (file)
@@ -286,8 +286,7 @@ typedef struct ScrGlobalAreaData {
         * and winx/winy don't) */
        short cur_fixed_height;
        /* For global areas, this is the min and max size they can use depending on
-        * if they are 'collapsed' or not. Value is set on area creation and not
-        * touched afterwards. */
+        * if they are 'collapsed' or not. */
        short size_min, size_max;
        /** GlobalAreaAlign. */
        short align;