Bug 1192669 - openSUSE Tumbleweed logo missing in gnome control center info panel since GNOME 41
Summary: openSUSE Tumbleweed logo missing in gnome control center info panel since GNO...
Status: RESOLVED FIXED
Alias: None
Product: openSUSE Tumbleweed
Classification: openSUSE
Component: GNOME (show other bugs)
Version: Current
Hardware: x86-64 openSUSE Tumbleweed
: P5 - None : Normal (vote)
Target Milestone: ---
Assignee: E-mail List
QA Contact: E-mail List
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-11-14 07:55 UTC by Michael Du
Modified: 2022-03-15 11:41 UTC (History)
7 users (show)

See Also:
Found By: ---
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---
dimstar: needinfo? (hel)
bjorn.lie: needinfo? (rbrown)


Attachments
GNOME 40 info (99.83 KB, image/png)
2021-11-14 08:24 UTC, Michael Du
Details
GNOME 41 info (93.27 KB, image/png)
2021-11-14 08:35 UTC, Michael Du
Details
strace result (98.54 KB, image/png)
2021-11-18 12:46 UTC, Michael Du
Details
/usr/share/pixmaps/ works fine (38.53 KB, image/png)
2021-11-22 10:25 UTC, Alynx Zhou
Details
/usr/share/icons/hicolor/scalable/apps/ opened but not rendered (34.67 KB, image/png)
2021-11-22 10:26 UTC, Alynx Zhou
Details
After change MinSize to 16 (141.49 KB, image/png)
2021-11-25 08:58 UTC, Alynx Zhou
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Du 2021-11-14 07:55:46 UTC
openSUSE Tumbleweed logo missing in gnome control center info panel since GNOME 41.
Comment 1 Michael Du 2021-11-14 08:24:23 UTC
Created attachment 853726 [details]
GNOME 40 info
Comment 2 Michael Du 2021-11-14 08:35:56 UTC
Created attachment 853727 [details]
GNOME 41 info
Comment 3 Alynx Zhou 2021-11-18 02:41:38 UTC
I guess the LOGO var in /usr/lib/os-release changed so it cannot find logo in /usr/share/pixmaps/distributor-logos, will look at it.
Comment 4 Dominique Leuenberger 2021-11-18 08:14:59 UTC
@Alynx: the change was in g-c-c, how it finds the logo. I had only invested a few minutes on it at the very beginning (strace showed the right file would be found)

Relevant upstream change should be
https://gitlab.gnome.org/GNOME/gnome-control-center/-/merge_requests/985
Comment 5 Alynx Zhou 2021-11-18 08:18:11 UTC
(In reply to Dominique Leuenberger from comment #4)
> @Alynx: the change was in g-c-c, how it finds the logo. I had only invested
> a few minutes on it at the very beginning (strace showed the right file
> would be found)
> 
> Relevant upstream change should be
> https://gitlab.gnome.org/GNOME/gnome-control-center/-/merge_requests/985

I've read the code, and it should behave the same because we don't have -text or -text-dark logos. Both version 40 and version 41 will load the LOGO var in /usr/lib/os-release under /usr/share/pixmaps/, so I think there should be changes in those two packages.
Comment 6 Alynx Zhou 2021-11-18 08:22:28 UTC
Also I think the current used code is from commit 43b40b3b4a18a37cb3741179bf0b627f535731b4, which fixed problem in https://gitlab.gnome.org/GNOME/gnome-control-center/-/merge_requests/985.
Comment 7 Alynx Zhou 2021-11-18 08:26:53 UTC
Or there might be some difference between gtk_image_set_from_icon_name and g_themed_icon_new_from_names, like searching path...
Comment 8 Dominique Leuenberger 2021-11-18 08:31:32 UTC
> grep LOGO /usr/lib/os-release 
LOGO="distributor-logo-Tumbleweed"

(this is unchanged for a while)

> strace gnome-control-center 2>&1 | grep distributor-logo
openat(AT_FDCWD, "/usr/share/icons/hicolor/scalable/apps/distributor-logo-Tumbleweed.svg", O_RDONLY) = 19

and /usr/share/icons/hicolor/scalable/apps/distributor-logo-Tumbleweed.svg does show the proper TW logo (transparent background)
Comment 9 Alynx Zhou 2021-11-18 08:42:45 UTC
(In reply to Dominique Leuenberger from comment #8)
> > grep LOGO /usr/lib/os-release 
> LOGO="distributor-logo-Tumbleweed"
> 
> (this is unchanged for a while)
> 
> > strace gnome-control-center 2>&1 | grep distributor-logo
> openat(AT_FDCWD,
> "/usr/share/icons/hicolor/scalable/apps/distributor-logo-Tumbleweed.svg",
> O_RDONLY) = 19
> 
> and /usr/share/icons/hicolor/scalable/apps/distributor-logo-Tumbleweed.svg
> does show the proper TW logo (transparent background)

That is strange, I run strace gnome-control-center 2>&1 | grep distributor-logo and got no output on new installed tumbleweed
Comment 10 Alynx Zhou 2021-11-18 08:46:26 UTC
My newly installed Tumbleweed does not have /usr/share/icons/hicolor/scalable/apps/distributor-logo-Tumbleweed.svg, strange...
Comment 11 Alynx Zhou 2021-11-18 08:49:52 UTC
$ zypper se distribution-logos-openSUSE
Loading repository data...
Reading installed packages...

S | Name                                   | Summary                   | Type
--+----------------------------------------+---------------------------+--------
  | distribution-logos-openSUSE            | Logos for openSUSE Dist-> | package
  | distribution-logos-openSUSE-Kubic      | Logos for openSUSE Kubic  | package
  | distribution-logos-openSUSE-MicroOS    | Logos for openSUSE Micr-> | package
i | distribution-logos-openSUSE-Tumbleweed | Logos for openSUSE Tumb-> | package
  | distribution-logos-openSUSE-icons      | Icons with distribution-> | package

Looks like we don't have distribution-logos-openSUSE-icons installed by default on Tumbleweed? Files under /usr/share/icons/hicolor/ is in this package.
Comment 12 Michael Du 2021-11-18 12:46:28 UTC
Created attachment 853848 [details]
strace result

It seems that g-c-c has found the logo svg file, but can't show in the panel correctly.
Comment 13 Alynx Zhou 2021-11-22 10:25:01 UTC
It seems GIcon can load svg under /usr/share/pixmaps/ correctly but not /usr/share/icons/hicolor/scalable/apps/, I write a small program to load logo on my own machine (even not opensuse), and if I put the tumbleweed svg in /usr/share/pixmaps/, it works, but put svg in /usr/share/icons/hicolor/scalable/apps/, a warning logo is shown.
Comment 14 Alynx Zhou 2021-11-22 10:25:40 UTC
Created attachment 853907 [details]
/usr/share/pixmaps/ works fine
Comment 15 Alynx Zhou 2021-11-22 10:26:08 UTC
Created attachment 853908 [details]
/usr/share/icons/hicolor/scalable/apps/ opened but not rendered
Comment 16 Alynx Zhou 2021-11-22 10:26:27 UTC
I'd like to check icon loading code next.
Comment 17 Alynx Zhou 2021-11-25 07:37:53 UTC
Some interesting find:

If I move distributor-logo-Tumbleweed.svg to /usr/share/icons/Adwaita/scalable/apps, a missing-logo is shown, but it turns out that you need to run `sudo gtk-update-icon-cache /usr/share/icons/Adwaita/` and `sudo gtk-update-icon-cache /usr/share/icons/hicolor/` to rebuild the cache, then the logo shows correctly.

And if I move the logo back to hicolor and run `sudo gtk-update-icon-cache /usr/share/icons/Adwaita/` and `sudo gtk-update-icon-cache /usr/share/icons/hicolor/`, no logo is shown (even the missing logo), every thing seems working fine but no logo, I guess maybe the size is wrongly calculate to 0 (but not sure).

Still reading code.
Comment 18 Alynx Zhou 2021-11-25 08:21:22 UTC
So I think the problem actually happens here: https://gitlab.gnome.org/GNOME/gtk/-/blob/gtk-3-24/gtk/gtkicontheme.c#L3958

I managed to print the `size` var, and find something interesting:

If put svg in pixmaps, size is 0, so it will load svg with desired_size, which should be a proper value and you can see the icon.

If put svg in Adwaita, size is 8, it's small but you still can see the icon.

If put svg in hicolor, size is 1 (???!!!), so the icon is too small to see it.

I'll read more code to see where those numbers come and fix it.
Comment 19 Alynx Zhou 2021-11-25 08:54:38 UTC
So finally it turns out a big mess, every code pieces have a proper logic and when they works together they lead into a joke.

We have GtkImage before we load icon, so we cannot decide GtkImage's size and we want the icon to decide its size so we pass GTK_ICON_SIZE_INVALID.

But GtkIconHelper treat GTK_ICON_SIZE_INVALID as 0 (https://gitlab.gnome.org/GNOME/gtk/-/blob/gtk-3-24/gtk/gtkiconhelper.c#L238), so it loads icon with size == 0.

And after a mess of functions we reached https://gitlab.gnome.org/GNOME/gtk/-/blob/gtk-3-24/gtk/gtkicontheme.c#L3958, because we put logo under hicolor theme, so it's size is decided by theme's size.

And theme's size is calculated in https://gitlab.gnome.org/GNOME/gtk/-/blob/gtk-3-24/gtk/gtkicontheme.c#L3081, where it compares GtkIconHelper's size (0) with theme icons' size and uses the one with minimal difference, for scalable icons, we have

```
[scalable/apps]
MinSize=1
Size=128
MaxSize=256
Context=Applications
Type=Scalable
```

so the nearest value to 0 is 1, so finally we got a 1px logo which cannot be seen...

For Adwaita, the MinSize is 8, which is also too small, but at lease we can see it.

You can try to modify /usr/share/icons/hicolor/index.theme to make MinSize=16, and update icon cache, then you will see the logo in gnome-control-center (but 16 is too small though).

I am not sure where to fix it, passing GTK_ICON_SIZE_INVALID is ok here, and I am not sure if changing https://gitlab.gnome.org/GNOME/gtk/-/blob/gtk-3-24/gtk/gtkiconhelper.c#L238 to bigger value is OK, and it's hard to decide a better MinSize for hicolor...
Comment 20 Alynx Zhou 2021-11-25 08:58:30 UTC
Created attachment 854039 [details]
After change MinSize to 16
Comment 21 Alynx Zhou 2021-11-25 09:17:40 UTC
GNOME 40 is fine is because that upstream manually set GtkImage's size before GNOME 41 (https://gitlab.gnome.org/GNOME/gnome-control-center/-/commit/fdd629293d25adc7f44031ad9eab4c6a5589b005), which covers this bug.

However revert this commit seems not a proper fix, it's just a workaround, and upstream wants to support non-square logo.
Comment 22 Dominique Leuenberger 2021-11-25 09:36:43 UTC
so it sounds like we should move the ./hicolor/scalable/apps/distributor-logo-Tumbleweed.svg to /usr/share/pixmap and be done with it

The icon theme overriding a distro logo sounds very debatable anyway, so the change very likely is correct anyway
Comment 23 Dominique Leuenberger 2021-11-25 09:43:58 UTC
Do you see any reason NOT to move the distributor-logos to /usr/share/pixmaps? They don't really have any relevance to an icon theme
Comment 24 Alynx Zhou 2021-11-25 09:47:27 UTC
(In reply to Dominique Leuenberger from comment #23)
> Do you see any reason NOT to move the distributor-logos to
> /usr/share/pixmaps? They don't really have any relevance to an icon theme

I think /usr/share/pixmaps should be the better please for distribution logo, I am also confused that why we put it under hicolor, move it is reasonable for me.

But I still want to fix it in the Gtk side (or maybe hicolor) too, where the problem actually exists.
Comment 25 Alynx Zhou 2021-11-25 09:51:19 UTC
(In reply to Alynx Zhou from comment #24)

> But I still want to fix it in the Gtk side (or maybe hicolor) too, where the
> problem actually exists.

I mean the 1px problem when we want gtk to decide the best icon size. Not related to the logo location.
Comment 26 Alynx Zhou 2021-11-26 07:28:35 UTC
I opened an upstream issue for icon size:
https://gitlab.gnome.org/GNOME/gtk/-/issues/4488
Comment 27 Bjørn Lie 2021-12-27 12:17:18 UTC
Adding Richard to cc/needinfo since he had a hand in the logo package too.
Comment 28 Dominique Leuenberger 2022-03-15 11:41:51 UTC
Fixed in GNOME:Next - with GNOME 42.
https://openqa.opensuse.org/tests/2245673#step/gnome_control_center/9

Will trickle down to Tumbleweed as GNOME 42 gets ready.