From 14b77b37cb8ca8bf5caa334532a3ef4af527f5a7 Mon Sep 17 00:00:00 2001 From: Julian Eisel Date: Mon, 3 Aug 2020 12:54:13 +0200 Subject: 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()`). --- source/blender/editors/interface/interface_widgets.c | 19 ++++++++++--------- 1 file 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)) -- cgit v1.2.3