[Bf-blender-cvs] [82b667bb006] topbar: Fix headers not using correct background color

Julian Eisel noreply at git.blender.org
Sat Oct 21 15:51:27 CEST 2017


Commit: 82b667bb0064bc56f2e4d30d0100a94e1d5bc5b6
Author: Julian Eisel
Date:   Sat Oct 21 15:51:06 2017 +0200
Branches: topbar
https://developer.blender.org/rB82b667bb0064bc56f2e4d30d0100a94e1d5bc5b6

Fix headers not using correct background color

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

M	source/blender/editors/include/UI_resources.h
M	source/blender/editors/screen/area.c

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

diff --git a/source/blender/editors/include/UI_resources.h b/source/blender/editors/include/UI_resources.h
index 7d2837ffe4e..49c9cffdd54 100644
--- a/source/blender/editors/include/UI_resources.h
+++ b/source/blender/editors/include/UI_resources.h
@@ -51,7 +51,7 @@ typedef enum {
 /* use to denote intentionally unset theme color */
 #define TH_UNDEFINED -1
 
-enum {
+typedef enum ThemeColorID {
 	TH_REDALERT,
 
 	TH_THEMEUI,
@@ -308,7 +308,7 @@ enum {
 
 	TH_EDGE_BEVEL,
 	TH_VERTEX_BEVEL
-};
+} ThemeColorID;
 
 /* specific defines per space should have higher define values */
 
diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c
index 20af9ee215e..86ae1dcd4b9 100644
--- a/source/blender/editors/screen/area.c
+++ b/source/blender/editors/screen/area.c
@@ -1848,6 +1848,18 @@ int ED_area_header_switchbutton(const bContext *C, uiBlock *block, int yco)
 
 /************************ standard UI regions ************************/
 
+static ThemeColorID region_background_color_id(const bContext *C, const ARegion *region)
+{
+	switch (region->regiontype) {
+		case RGN_TYPE_HEADER:
+			return ED_screen_area_active(C) ? TH_HEADER : TH_HEADERDESEL;
+		case RGN_TYPE_PREVIEW:
+			return TH_PREVIEW_BACK;
+		default:
+			return TH_BACK;
+	}
+}
+
 void ED_region_panels(const bContext *C, ARegion *ar, const char *context, int contextnr, const bool vertical)
 {
 	ScrArea *sa = CTX_wm_area(C);
@@ -2117,7 +2129,7 @@ void ED_region_header(const bContext *C, ARegion *ar)
 	bool region_layout_based = ar->flag & RGN_RESIZE_LAYOUT_BASED;
 
 	/* clear */
-	UI_ThemeClearColor((ED_screen_area_active(C) || (ar->regiontype != RGN_TYPE_HEADER)) ? TH_BACK : TH_HEADERDESEL);
+	UI_ThemeClearColor(region_background_color_id(C, ar));
 	glClear(GL_COLOR_BUFFER_BIT);
 	
 	/* set view2d view matrix for scrolling (without scrollers) */



More information about the Bf-blender-cvs mailing list