From 6e703f9a37ac5ea93bb85fadc0fcdcd287efdf40 Mon Sep 17 00:00:00 2001 From: Dimitris Panokostas Date: Fri, 5 Apr 2024 19:00:23 +0200 Subject: [PATCH] bugfix: Listbox selection color was hardcoded when inactive (fixes #1270) --- external/libguisan/src/widgets/listbox.cpp | 7 +------ src/osdep/gui/PanelConfig.cpp | 4 ++-- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/external/libguisan/src/widgets/listbox.cpp b/external/libguisan/src/widgets/listbox.cpp index 5ee92f044..750bae009 100644 --- a/external/libguisan/src/widgets/listbox.cpp +++ b/external/libguisan/src/widgets/listbox.cpp @@ -138,8 +138,6 @@ namespace gcn startRow = 0; } - const auto inactive_color = Color(170, 170, 170); - // The y coordinate where we start to draw the text is // simply the y coordinate multiplied with the font height. auto y = rowHeight * startRow; @@ -148,10 +146,7 @@ namespace gcn { if (i == mSelected) { - if (isFocused()) - graphics->setColor(getSelectionColor()); - else - graphics->setColor(inactive_color); + graphics->setColor(getSelectionColor()); graphics->fillRectangle(Rectangle(0, y, getWidth(), rowHeight)); graphics->setColor(getForegroundColor()); } diff --git a/src/osdep/gui/PanelConfig.cpp b/src/osdep/gui/PanelConfig.cpp index 5abe8247f..c356a3446 100644 --- a/src/osdep/gui/PanelConfig.cpp +++ b/src/osdep/gui/PanelConfig.cpp @@ -199,9 +199,9 @@ void InitPanelConfig(const struct config_category& category) const int list_height = category.panel->getHeight() - 2 * DISTANCE_BORDER - 2 * lblName->getHeight() - 3 * DISTANCE_NEXT_Y - 2 * BUTTON_HEIGHT; lstConfigs = new gcn::ListBox(&configsList); lstConfigs->setSize(list_width, list_height); - lstConfigs->setBaseColor(colTextboxBackground); + lstConfigs->setBaseColor(gui_baseCol); lstConfigs->setBackgroundColor(colTextboxBackground); - lstConfigs->setSelectionColor(colSelectorActive); + lstConfigs->setSelectionColor(gui_selection_color); lstConfigs->setWrappingEnabled(true); lstConfigs->setId("ConfigList"); lstConfigs->addActionListener(configsListActionListener);