-
Notifications
You must be signed in to change notification settings - Fork 191
[GTK] Scale external program icons to 16x16 #3004
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
|
@akurtakov any better ideas here? I'll try to get a 16x16 icon with GTK3 APIs, somehow. I do have such sizes available... I'm not sure why 48x48 is always returned. |
| } | ||
| } | ||
| data.alphaData = alphaData; | ||
| ImageData scaled = data.scaledTo(16, 16); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess we can check if the height or width are higher than 16 and only then scale...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense.
Did you found the commit that changed this icons size?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably its this commit in platform UI:
eclipse-platform/eclipse.platform.ui@f0b1071
For too large icons, we used to show a default. After this commit we don't.
|
I don't believe there would be such a "simple" fix. |
I think there is:
What is the difference for HiDPI? Will the zoom level argument be different? The GTK3 documentation does say this: https://docs.gtk.org/gtk3/method.IconTheme.lookup_by_gicon.html
|
|
Yes, looks like gtk_icon_theme_lookup_by_gicon_for_scale https://docs.gtk.org/gtk3/method.IconTheme.lookup_by_gicon_for_scale.html has to be used. |
|
Slightly modifying the prints: Then I see: In the Advantest environment, So we must be missing icons... at least for |
OK, I'll try to in the next few days. I assume for the scale parameter we use And the scaling down we can do for scale 1, when hopefully we are not in the HiDPI case. Considering that Though SWT won't be scaling the SVG in a sensible way... Unless we try to open the SVG by using the path to the icon. Which will make things even more complicated, so I won't be trying that. |
| long shellHandle = shell.handle; | ||
| long window = GTK3.gtk_widget_get_window(shellHandle); | ||
| if (window != 0) { | ||
| scale = GDK.gdk_window_get_scale_factor(window); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like to get the scaling argument we need a window.
Any better way to get the window @akurtakov ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thinking about this, we are requesting icon data that is likely cached by platform UI.
Depending on the screen scaling doesn't seem like a good idea. E.g. if two screens have different scaling, we would be caching the icon for one of them...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@HeikoKlare maybe you have insights here? Where do we handle different DPI for icons in platform UI? Maybe doing the fix in SWT is not the best place...
This change ensures Program icons are scaled to 16x16 pixels, to avoid huge icons in platform UI. Fixes: eclipse-platform#3003

GTK3 API gtk_icon_theme_lookup_by_gicon() returns 48x48 icons, despite specifying size 16x16 in the arguments.
This change scales the retrieved icon to 16x16,
to avoid unexpected program icon sizes.
Fixes: #3003