widgets, themes: Fix bug with selection...

background color. Resolves #9983.

We now check the parent widget's color
first to prevent issues with the selection
altering the background color of the
icon until the view is refreshed.
As a result, we can now define the
selected color of an icon, fixing a
regression from 2.10.
This commit is contained in:
Alx Sa 2025-01-20 05:46:34 +00:00 committed by Jehan
parent 80fca449a4
commit 9bef3b2edd
5 changed files with 33 additions and 11 deletions

View file

@ -132,6 +132,8 @@ gimp_container_icon_view_class_init (GimpContainerIconViewClass *klass)
widget_class->unmap = gimp_container_icon_view_unmap;
widget_class->popup_menu = gimp_container_icon_view_popup_menu;
gtk_widget_class_set_css_name (widget_class, "GimpContainerIconView");
}
static void

View file

@ -1182,11 +1182,27 @@ gimp_view_render_temp_buf_to_surface (GimpViewRenderer *renderer,
GtkStyleContext *style;
GdkRGBA *color = NULL;
style = gtk_widget_get_style_context (widget);
/* Try to get the parent's color first to prevent issues with
* changes in preselected backgrounds. If not set though, go for
* the current's widget's color instead */
style = gtk_widget_get_style_context (gtk_widget_get_parent (widget));
gtk_style_context_get (style, gtk_style_context_get_state (style),
GTK_STYLE_PROPERTY_BACKGROUND_COLOR, &color,
NULL);
if (color &&
color->red == 0 &&
color->green == 0 &&
color->blue == 0)
{
gdk_rgba_free (color);
style = gtk_widget_get_style_context (widget);
gtk_style_context_get (style, gtk_style_context_get_state (style),
GTK_STYLE_PROPERTY_BACKGROUND_COLOR, &color,
NULL);
}
if (color)
{
cairo_set_source_rgb (cr, color->red, color->green, color->blue);

View file

@ -10,11 +10,6 @@
@import url("common.css");
/* Highlight icons in Grid View when hovered over */
iconview:hover {
background-color: @fg-color;
}
/*
* Paned separator handles
*/

View file

@ -10,11 +10,6 @@
@import url("common.css");
/* Highlight icons in Grid View when hovered over */
iconview:hover {
background-color: @strong-border-color;
}
/*
* Paned separator handles
*/

View file

@ -437,6 +437,20 @@ paned menu separator {
padding: 0px;
}
/* Highlight icons in Grid View when hovered over */
iconview:hover {
border: 2px solid @dimmed-fg-color;
}
iconview:selected {
border: 2px solid @fg-color;
}
GimpContainerIconView scrolledwindow {
background-color: @extreme-bg-color;
}
.view button {
background-color: @bg-color;
border-color: @border-color;