SDL2 Window decorations don't match desktop theme?


Since my system updated to SDL 2.0.22 a couple weeks ago, I’ve noticed that windows created via SDL2 no longer match my desktop theme. FYI I am running Fedora Linux 36 with GNOME desktop.

For reference, this is what the title bar of my window looks like now:

As stated, this style does not match any of the other windows on my desktop. I do not recognize it at all.

I’m not terribly concerned about this since YMMV depending on the user’s installation of SDL2, GNOME, etc, but it worked perfectly until recently, so I am curious what may have changed.

1 Like

This is indeed the Wayland client-side decorations as provided by libdecor:

There is work to introduce a GTK plugin to make the decorations more like the rest of GNOME…

… but this is technically out of our hands, we just provide the window surface to libdecor and it handles the rest. That said though, I’m surprised it’s using Wayland by default; as far as I know the only two environments that are supposed to do this are RHEL9 (or just CentOS 9 right now, technically) and certain Flatpaks. Is this the default SDL2 package from Fedora’s repositories? If so this is a downstream patch, and Neal Gompa would be the person to talk to about that:

1 Like

Thank you for the help and directions! Wayland does appear to be coming more common. Apparently Fedora has been using it since version 25 (released in nov 2016, so almost 6 years ago).

This is SDL2 version 2.0.22, from the official Fedora repositories. Here’s what I see when I list my installed SDL2 packages:

I already checked if something funny was going on eg linking to the i686 package or something (this is used by Steam btw).

Given that Fedora has been on Wayland for 6 years - and this was all working for me as expected no more than a week or two ago - I am still curious what might have changed to cause this to happen now…

Now I want to try booting in X instead and see if it just corrects itself.

I rebooted my GNOME desktop with X and can confirm my window decorations match my desktop theme properly now, so this is a libdecor/Wayland problem.

I think this is a patch in Fedora then: The current behavior in upstream is to use Xwayland, with native Wayland connections to be used only if the user explicitly sets SDL_VIDEODRIVER or if it’s a Flatpak environment where it only provides an X server/Xwayland connection as a last resort. I suppose technically this is going to be the default behavior in the near future anyway, but if you’re finding that it’s not what you want (and possibly not what Fedora itself wants) I would talk to the package maintainer about this.