Open broughtong opened 1 year ago
Similarly on Windows 11, in C++ SDL the taskbar icon is updated when the window icon is changed, but in PySDL the window icon will change, but the taskbar icon remains a default.
Hi @broughtong, this seems like a window manager-specific bug: with Fedora 38 and KDE, you test example works perfectly:
Can you try adding an sdl2.SDL_PumpEvents()
call after showing your window? That updates various window properties on some window managers, from what I remember.
Tried the Pump events, no change.
I tried also Kubuntu 20.04, which might clear up what is happening:
The icon and title used on the window itself are correct.
The icon in the task bar though is just the regular python icon, and the title in this case "Python (v3.10)" with a subheading of the real window title of "some title".
In regular Ubuntu, due to the window manager the only logo visible at all is the Python one (in the taskbar to the left), the title on the window is correct, and the title at the top of the screen is just "Python (v3.x)".
In C++ SDL, in all cases the logo on both the window and taskbar are the one given by SDL_SetWindowIcon
, and the title on both the window and taskbar is the one from SDL_SetWindowTitle
I can partially reproduce that: with the latest KDE Plasma from Fedora 38, I get the "python" main heading along with the proper window title as the subheading, but the custom-set window icon still shows fine for me in the task bar:
From what I can tell, the top heading in the KDE taskbar is the name of the application itself, with the subheading being the title of that specific window (if there are multiple windows open for the same app, it lists the app title once and the window name for each separate window):
As such, since whatever you're running with PySDL2 is run via the Python interpreter, most window managers will report that as the application name instead of the app's current window title. Seems this isn't an issue limited to PySDL2 either, with reports of the same problem applying to people using PyQT or PySide: https://stackoverflow.com/questions/27453436/set-application-name-in-pyside
Since this isn't PySDL2-specific, maybe there's a generic Python library out there that can set/override the current application title within a given Python script?
Ok so I'm now pretty sure this is actually a bug within SDL itself, not setting the class/classname property correctly in the x server.
In C++ it doesn't matter as there is nothing already set, but when called through Python , it is getting some wrong info about the window.
If I alter the class/classname manually in X for the window, all calls (including previous calls) now take effect correctly in the taskbar.
Will report it over there.
To see the difference, open your window.
Run xdotool selectwindow
in a terminal and click the window to get the ID.
Then do xdotool set_window --class my_new_title WINDOWID
and xdotool set_window --classname my_new_title WINDOWID
All icons and titles should now correctly appear.
What doesn't work?
Changing a window icon using
sdl2.SDL_SetWindowIcon
doesn't work on Ubuntu 20.04.Creating a window in the C++ SDL has no logo set by default (in pysdl2 it has a python logo by default).
Changing it with
SDL_SetWindowIcon
in C++ correctly sets it, but same code in python does nothing, the logo remains the Python logo. I've tried hiding the window to start with, setting the logo, and then showing it but same issue. Likewise the title showing in the taskbar is always "Python (v3.8)" regardless of whatsdl2.SDL_SetWindowTitle
is set to.How To Reproduce Any code that reproduces the bug, e.g.:
Platform (if relevant):