Commit: 0bce173bc7e9bb6d6cac099d16a8b0f4471d3f63
Author: Brecht Van Lommel
Date:   Wed Jun 13 11:40:32 2018 +0200
Branches: blender2.8
https://developer.blender.org/rB0bce173bc7e9bb6d6cac099d16a8b0f4471d3f63

UI: remove empty space at the end of headers, tweak start/end spacing.

===================================================================

M       source/blender/editors/include/UI_interface.h
M       source/blender/editors/interface/interface.c
M       source/blender/editors/screen/area.c

===================================================================

diff --git a/source/blender/editors/include/UI_interface.h 
b/source/blender/editors/include/UI_interface.h
index 547cfc65c09..e90286ed624 100644
--- a/source/blender/editors/include/UI_interface.h
+++ b/source/blender/editors/include/UI_interface.h
@@ -906,7 +906,7 @@ void UI_exit(void);
 #define UI_ITEM_O_DEPRESS       (1 << 9)
 #define UI_ITEM_R_COMPACT       (1 << 10)
 
-#define UI_HEADER_OFFSET_START ((void)0, 0.4f * UI_UNIT_X)
+#define UI_HEADER_OFFSET ((void)0, 0.2f * UI_UNIT_X)
 
 /* uiLayoutOperatorButs flags */
 enum {
diff --git a/source/blender/editors/interface/interface.c 
b/source/blender/editors/interface/interface.c
index 811bd4457d8..d321cbbb89e 100644
--- a/source/blender/editors/interface/interface.c
+++ b/source/blender/editors/interface/interface.c
@@ -243,7 +243,7 @@ static void ui_update_flexible_spacing(const ARegion 
*region, uiBlock *block)
 
        rcti rect;
        ui_but_to_pixelrect(&rect, region, block, block->buttons.last);
-       const float buttons_width = (float)rect.xmax + UI_HEADER_OFFSET_START;
+       const float buttons_width = (float)rect.xmax + 2 * UI_HEADER_OFFSET;
        const float region_width = (float)region->sizex * U.dpi_fac;
 
        if (region_width <= buttons_width) {
diff --git a/source/blender/editors/screen/area.c 
b/source/blender/editors/screen/area.c
index dafd8990a6e..478afa64939 100644
--- a/source/blender/editors/screen/area.c
+++ b/source/blender/editors/screen/area.c
@@ -2193,13 +2193,12 @@ void ED_region_header_layout(const bContext *C, ARegion 
*ar)
        Header header = {NULL};
        int maxco, xco, yco;
        int headery = ED_area_headersize();
-       const int start_ofs = UI_HEADER_OFFSET_START;
        bool region_layout_based = ar->flag & RGN_FLAG_DYNAMIC_SIZE;
 
        /* set view2d view matrix for scrolling (without scrollers) */
        UI_view2d_view_ortho(&ar->v2d);
 
-       xco = maxco = start_ofs;
+       xco = maxco = UI_HEADER_OFFSET;
        yco = headery + (ar->winy - headery) / 2 - floor(0.2f * UI_UNIT_Y);
 
        /* XXX workaround for 1 px alignment issue. Not sure what causes it... 
Would prefer a proper fix - Julian */
@@ -2230,7 +2229,7 @@ void ED_region_header_layout(const bContext *C, ARegion 
*ar)
                if (xco > maxco)
                        maxco = xco;
 
-               int new_sizex = (maxco + start_ofs) / UI_DPI_FAC;
+               int new_sizex = (maxco + UI_HEADER_OFFSET) / UI_DPI_FAC;
 
                if (region_layout_based && (ar->sizex != new_sizex)) {
                        /* region size is layout based and needs to be updated 
*/
@@ -2243,8 +2242,12 @@ void ED_region_header_layout(const bContext *C, ARegion 
*ar)
                UI_block_end(C, block);
        }
 
+       if (!region_layout_based) {
+               maxco += UI_HEADER_OFFSET;
+       }
+
        /* always as last  */
-       UI_view2d_totRect_set(&ar->v2d, maxco + (region_layout_based ? 0 : 
UI_UNIT_X + 80), headery);
+       UI_view2d_totRect_set(&ar->v2d, maxco, headery);
 
        /* restore view matrix */
        UI_view2d_view_restore(C);

_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to