Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Eisel <julian@blender.org>2020-08-03 13:54:13 +0300
committerJulian Eisel <julian@blender.org>2020-08-03 14:00:53 +0300
commit14b77b37cb8ca8bf5caa334532a3ef4af527f5a7 (patch)
treed12036aaae8d6791b90fab621c62d549efa7d377
parent33e6562a8a1ab84b0de92857dcd7decbffe3f263 (diff)
Fix T78428: Checkbox labels don't highlight on mouse-over in popovers
The text colors set by the general widget state function (`widget_state()`) would always be overriden by the menu-back text colors to avoid contrast issues. This would only respect the selected state, not other states. Address this now by changing the input theme colors to use the menu-back ones, rather than overriding after the fact (calling `widget_state()`).
-rw-r--r--source/blender/editors/interface/interface_widgets.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c
index c9c460c6a72..2bc2ed5f5e8 100644
--- a/source/blender/editors/interface/interface_widgets.c
+++ b/source/blender/editors/interface/interface_widgets.c
@@ -2622,18 +2622,19 @@ static void widget_state_numslider(uiWidgetType *wt, int state, int drawflag)
/* labels use theme colors for text */
static void widget_state_option_menu(uiWidgetType *wt, int state, int drawflag)
{
- bTheme *btheme = UI_GetTheme(); /* XXX */
+ const bTheme *btheme = UI_GetTheme();
+
+ const uiWidgetColors *old_wcol = wt->wcol_theme;
+ uiWidgetColors wcol_menu_option = *wt->wcol_theme;
+
+ /* Override the checkbox theme colors to use the menu-back text colors. */
+ copy_v3_v3_uchar(wcol_menu_option.text, btheme->tui.wcol_menu_back.text);
+ copy_v3_v3_uchar(wcol_menu_option.text_sel, btheme->tui.wcol_menu_back.text_sel);
+ wt->wcol_theme = &wcol_menu_option;
- /* call this for option button */
widget_state(wt, state, drawflag);
- /* if not selected we get theme from menu back */
- if (state & UI_SELECT) {
- copy_v3_v3_uchar(wt->wcol.text, btheme->tui.wcol_menu_back.text_sel);
- }
- else {
- copy_v3_v3_uchar(wt->wcol.text, btheme->tui.wcol_menu_back.text);
- }
+ wt->wcol_theme = old_wcol;
}
static void widget_state_nothing(uiWidgetType *wt, int UNUSED(state), int UNUSED(drawflag))