GNOME Bugzilla – Bug 746210
GtkListBoxRow with GtkImage child: correctly update CSS on selection
Last modified: 2017-08-24 21:40:48 UTC
It’s for a bug visible in Iagno (`iagno`) 3.15.90+, in the “Select theme” dialog that appears when you click “Appearance” in the app-menu. I think it’s a gtk+ bug, sorry if I missed something. There’s a ListBox with inside each ListBoxRow a Label and an Image. When a ListBoxRow is selected, the :selected CSS state is updated (you could make the text of the Label change), but the "GtkListBoxRow:selected GtkImage" CSS isn’t applied. You have to hover the ListBoxRow for the image color/opacity to be updated.
Does your gtk have commit 9ec28047756256ad396ccb318e214e13dd034af0 ? That was included in 3.15.11
Oh, I just discovered a thing… it works correctly on hicolor theme. I’m using HighContrast. The bug exists on git master and Fedora 22 package with gtk+ 3.15.11.
What wasn't mentioned in the original description is that iagno uses custom css to 'hide' images and animated transitions.
I’m sorry I didn’t make that clear for the beginning. Yes, I’m not tracking a theme bug, but a renderer bug: at one point, a correct CSS declaration does not correctly update the rendering of the window. I found two fixes to Iagno’s bug. The first one is what I was looking for (after my second comment…): the declaration that makes the rendering update in hicolor theme, but not in HighContrast. == Fix 1 == https://git.gnome.org/browse/iagno/commit/?id=75a21d5ba729c7937a12c8c01d77366ff9099af4 Adding a line: #fake-example *:selected *:visited { opacity: 1; } makes the rendering work correctly. Of course, I do not have any widget called “fake-example”; and “opacity:1” could be replaced by other things. What is important is that having a check on “*:selected *:visited” updates the rendering when something is selected, or that not having such a line do not update the rendering… The hicolor theme does not show the problem because it has a “*:selected *:link:visited” selection somewhere[1]. [1] currently, on https://git.gnome.org/browse/gtk+/tree/gtk/theme/Adwaita/gtk-contained.css#n1290 == Fix 2 == https://git.gnome.org/browse/iagno/commit/?id=0d1168d639441034fee424fb0b73f0dc0e17e28d Changing the line: GtkListBox#themes-listbox GtkListBoxRow:selected GtkImage { by GtkListBox#themes-listbox GtkListBoxRow:selected * { correctly updates rendering on HighContrast theme (without needing the first fix). That’s the proof the “*” selector is doing many more things that just the minimum, but it’s probably a less important issue for now.
The “fix 1” solved a similar problem in different conditions (other application, and other theme). “another small question: I sometimes get weird rendering of my ListboxRows. But only after I click to activate them not when I iterate through them with keyboard short-cuts. And only with the elementary theme as far as I have tested (adwaita works). Is there something wrong in Gtk+ or maybe elementary theme, or could this bug be caused by my code? https://launchpadlibrarian.net/214922826/Screenshot%20from%202015-08-19%2000%3A11%3A06.png ” (on #gtk+, this day.)
Possibly a dupe of https://bugzilla.gnome.org/show_bug.cgi?id=763517 which discusses various oddities with ListBox and CSS?
*** This bug has been marked as a duplicate of bug 763517 ***