When setting an IconBundle as a window's icon, on my High DPI system (using the Gtk backend), the smallest icon will be chosen, and it will be displayed way too small. As I provide many bigger icons, I expect a bigger icon to be chosen, at least big enough to fill up the title bar.
I use wxwidgets in Python using wxWidgets/Phoenix. However, I don't think the Python bindings cause this problem, so I post this issue here. Sorry for my demonstration being written in Python, I hope you can execute it anyway.
To Reproduce
Download the demonstration program:
demonstration_wx_icon_issue.zip
Execute it via python3 main.py
Platform and version information
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
For the reference, here is the code:
import os import wx def getFullPath(relativePath: str): return os.path.join(os.path.dirname(__file__), relativePath) def main(): wxapp = wx.App() fr = wx.Frame(None, -1, 'Test') wx.Image.AddHandler(wx.PNGHandler()) ib = wx.IconBundle() for sz in ("16", "32", "64", "128", "256"): ib.AddIcon(wx.Icon(wx.Bitmap(getFullPath(("resources/icon%s.png" % sz))))) fr.SetIcons(ib) fr.Show(True) wxapp.MainLoop() if __name__ == '__main__': main()
I haven't tried it yet, but it looks like it ought to work. Is your application configured to use high DPI? I.e. does wxWindow::GetDPIScaleFactor() return 2 (or whichever DPI scaling you use)? Not doing this seems like the most likely reason for the problem.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
Is your application configured to use high DPI? I.e. does wxWindow::GetDPIScaleFactor() return 2 (or whichever DPI scaling you use)? Not doing this seems like the most likely reason for the problem.
It returns 2.0, which is my scaling factor...
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
I've finally looked into this and this indeed doesn't work with wxGTK, even though it seems like it ought to, according to the documentation which says that GTK will select the right size automatically from the provided list. I don't know what can we do about it, we could select the icon of the right size and set it only, but if some environments/WMs do try to select the best fitting icon, this would prevent them from doing it.
Also, I've checked how things worked under MSW and there the correct icon is selected initially, but it's not updated later if the DPI changes, so I've created a PR fixing it.
For the reference, here is the code snippet I've inserted into the minimal sample to test this:
wxImage::AddHandler(new wxPNGHandler); wxIconBundle ib; for ( int size = 16; size < 512; size *= 2 ) ib.AddIcon(wxString::Format("resources/icon%d.png", size)); SetIcons(ib);
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
Fixed in master, will be backported to 3.2 too soon.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
Fixed in master, will be backported to 3.2 too soon.
Nice! Did you fix it by working around the Gtk Bug and only setting one icon size?
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
Oops, sorry for the misleading message. I've only fixed the MSW problem mentioned above, not hte GTK one about which I still have no idea. I should have opened a separate issue for that one...
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
Oops, sorry for the misleading message. I've only fixed the MSW problem mentioned above, not hte GTK one about which I still have no idea. I should have opened a separate issue for that one...
Ok, that makes sense!
As soon as I have time, I plan to to write some demo program in Gtk to reproduce this issue, and submit the bug to Gtk.
I think it might have to do with their window decoration, because the issue only occurs inside the window decoration (the icon in the Gnome dash has the correct resolution).
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
Closed #22807 as completed.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()