Skip to content
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

Wayland-by-default in 2.0.22rc1 causes some games to regress #5527

Closed
smcv opened this issue Apr 13, 2022 · 29 comments
Closed

Wayland-by-default in 2.0.22rc1 causes some games to regress #5527

smcv opened this issue Apr 13, 2022 · 29 comments
Assignees
Milestone

Comments

@smcv
Copy link
Contributor

smcv commented Apr 13, 2022

While testing an attempt to upgrade SDL to 2.0.22 in the Steam Runtime, I've found that several games unfortunately regress when switched from X11 to Wayland. The games I'm testing are proprietary, so I can't see into their source code, but I'm opening this issue to track regressions that I've found.

A mitigation is that the majority of the games I'm testing have their own bundled or statically-linked copy of SDL, which they will use by default. However, they won't get SDL bug fixes unless either: their developer updates their SDL, or users force the game to use a newer SDL via workarounds like deleting a bundled SDL or setting SDL_DYNAMIC_API. Also, SDL 2.0.22 having a behaviour change that triggers regressions seems like it's undermining the message that upgrading SDL 2 is always a backwards-compatible thing to do.

I wonder whether it would be useful to have a "quirks" mechanism, either in Steam or in SDL, to automatically do the equivalent of SDL_VIDEODRIVER=x11 for certain games?

@smcv
Copy link
Contributor Author

smcv commented Apr 13, 2022

Aperture Desk Job

Source 2 engine. Other Source 2 games like Dota 2 probably behave similarly.

Workaround to use updated SDL: rename Aperture\ Desk\ Job/game/bin/linuxsteamrt64/libSDL2-2.0.so.0 out of the way, or set SDL_DYNAMIC_API.

Ubuntu 22.04, GNOME, Wayland, NVIDIA driver 510.60.02:

  • With SDL 2.0.20 (Steam Runtime 'soldier' public beta), the default is X11 and works as expected. Forcing Wayland via SDL_VIDEODRIVER=wayland causes the game to segfault.
  • With SDL 2.0.22 rc1, forcing X11 via SDL_VIDEODRIVER=x11 works as expected, but the default is Wayland which (again) causes the game to segfault.

@smcv smcv changed the title Wayland-by-default causes some games to regress Wayland-by-default in 2.0.22rc1 causes some games to regress Apr 13, 2022
@smcv
Copy link
Contributor Author

smcv commented Apr 13, 2022

Braid (demo)

Workaround to use updated SDL: rename Braid/lib/libSDL2-2.0.so.0 out of the way, or set SDL_DYNAMIC_API.

Tested on Debian 10, GNOME, Wayland, AMD, Mesa 18.3.6 and on Ubuntu 22.04, GNOME, Wayland, NVIDIA 510.60.02 (same result):

  • With SDL 2.0.20 (Steam Runtime 'soldier' public beta), the default is X11 and works as expected. Forcing Wayland via SDL_VIDEODRIVER=wayland causes startup failure with message Unable to set up graphics. Reason: Cg failed to initialize.
    With SDL 2.0.22 rc1, forcing X11 via SDL_VIDEODRIVER=x11 works as expected, but the default is Wayland which has the same failure as in 2.0.20.

@smcv
Copy link
Contributor Author

smcv commented Apr 13, 2022

Counter-Strike Global Offensive

Source 1 engine. Other Source 1 games like TF2 and Half-Life: Source are likely to behave similarly.

Workarounds to use updated SDL: move Counter-Strike\ Global\ Offensive/bin/libSDL2-2.0.so.0 and Counter-Strike\ Global\ Offensive/bin/linux64/libSDL2-2.0.so.0 out of the way.

Debian 10, GNOME, Wayland, AMD, Mesa 18.3.6 works well.

Ubuntu 22.04, GNOME, Wayland, NVIDIA 510.60.02: with SDL 2.0.20 and 2.0.22, using the Wayland video driver causes a segfault during startup.

@smcv
Copy link
Contributor Author

smcv commented Apr 13, 2022

Crusader Kings II

Clausewitz engine (other Paradox games might behave similarly), with a statically-linked SDL.

Workaround to use updated SDL: SDL_DYNAMIC_API=$STEAM_RUNTIME/usr/lib/x86_64-linux-gnu/libSDL2-2.0.so.0

Tested on Debian 10, GNOME, Wayland, AMD, Mesa 18.3.6 and on Ubuntu 22.04, GNOME, Wayland, NVIDIA 510.60.02 (same result): with either SDL 2.0.20 or 2.0.22, brief gameplay seems to work fine, but when using the Wayland video driver the game hangs (becomes unresponsive) when exited via Alt+F4.

@sulix
Copy link
Contributor

sulix commented Apr 13, 2022

I was just about to report the same thing, and have just started testing a few things with it. More things work than expected, but Braid and Eufloria HD in particular need Cg, which calls X11 directly. I'm pretty sure there are a few games which crash because glXGetProcAddress() or similar doesn't work without X11, and whatever other extension-loading library they're using breaks.

Bioshock Infinite and (and I think Dear Esther, and quite a few more) have broken relative mouse movement — the view is confined to a rectangle — I think they might be using SDL_WarpMouse*() or similar, which isn't implemented on wayland.

And I did see an issue with A Virus Named Tom which caused the game to only show in a corner of the screen on first boot, though it did work if windowed was toggled on/off. Not sure if that's to do with the weird setup I tested it on, or some old config files laying about from a different monitor. (But it worked fine with X11, so…)

Most of these do package their own working SDL without wayland enabled, so probably won't regress out of the box, but…

@smcv
Copy link
Contributor Author

smcv commented Apr 13, 2022

Portal 2

Source 1 engine.

Debian 10, GNOME/Wayland, AMD, Mesa 18.3.6:

  • With SDL 2.0.20 and SDL_VIDEODRIVER=wayland, looking around in first-person during gameplay is very glitchy: it's as though the game is alternating between the current frame, and what I would have seen a couple of frames previously. It's hard to describe, best to try it for yourself.
  • With SDL 2.0.22rc1 in Wayland mode, same problem.
  • X11 is fine.

See also ValveSoftware/portal2#370

@smcv
Copy link
Contributor Author

smcv commented Apr 13, 2022

To explain the maybe-unexpected OSs that I'm using:

  • Debian 10 is the oldest Debian release where GNOME (in this case version 3.30) defaulted to running in Wayland mode, so if there are features that work poorly in older Wayland compositors, Debian 10 will trigger them. The only other environments that seem likely to be widely-used with an old Wayland compositor are older RHEL/CentOS and SLES releases. Ubuntu LTS is a widely-used distribution with old versions of all the packages, but its old LTS branches use Xorg by default, so it's less likely to cause us Wayland problems in practice than Debian.
  • Ubuntu 22.04 is currently only in beta, but will be the first Ubuntu release that defaults to running GNOME in Wayland mode, and is also new enough that the proprietary NVIDIA drivers support native Wayland. Fedora 36 is of a similar age, and will use Wayland by default even when using the proprietary NVIDIA drivers. This also provides an example of a very new Wayland compositor, contrasting with Debian 10.

@smcv
Copy link
Contributor Author

smcv commented Apr 13, 2022

Tomb Raider (2013): #5529 (I opened this separately because it is not solely about Wayland-by-default: forcing Wayland in 2.0.20 does not reproduce it).

@flibitijibibo
Copy link
Collaborator

Will try to run through these...

Aperture Desk Job: Do we have any logs/traces for this one? I know some Source games don't work, but this started to get fixed as the DXVK updates started rolling out. Not sure about Source 2 though.
Braid Demo: I didn't know this still used Cg... does the full retail version still use it? Not sure if we can easily identify Cg games yet.
CSGO: I wonder if Joshua knows about this one? NVIDIA might be the issue, since I believe they're still making Vulkan Wayland work on some hardware.
CK2: A backtrace should tell us what's up - if not that, WAYLAND_DEBUG logs might instead.
Portal 2: Update to Mesa 21.3, this game requires EGL_EXT_present_opaque. Vulkan should be fine either way (though NVIDIA still needs to fix this for both GL and VK)

A lot of these are Source, maybe we should talk to someone maintaining those to see if we can get a better window into what's going on. The Cg case may be interesting, and CK2 looks to be the easiest for us to diagnose from the outside.

@slouken
Copy link
Collaborator

slouken commented Apr 13, 2022

What do you guys think about making X11 the default again for release, and letting distribution maintainers switch it to Wayland if they want?

@smcv, thanks for the heads up on these issues!

@flibitijibibo
Copy link
Collaborator

It's looking like the Steam overlay issue will still be present by the time this gets released, so we may not have a choice here... that's the major blocker since it affects anything using the latest SDL, rather than specific cases.

Ref: ValveSoftware/steam-for-linux#8020

@smcv
Copy link
Contributor Author

smcv commented Apr 13, 2022

What do you guys think about making X11 the default again for release, and letting distribution maintainers switch it to Wayland if they want?

I think that's what I'd do if it was my decision - that way, updating the SDL in the Steam Runtime or bundled with a game will not cause unexpected regressions when run on Wayland distros, particularly older distros like Debian 10.

I think Steam might benefit from having a "quirks" mechanism to force known-bad games into X11 as well, because if maintainers of newer/rolling-release distros start patching or configuring SDL to make native Wayland the default, that's fine for open-source games in their distro (which can be patched to keep up as needed), but less fine for binary-only Steam games (some of which are unmaintained).

@sulix
Copy link
Contributor

sulix commented Apr 14, 2022

For what it's worth, I can't reproduce several of these issues under nVidia/Wayland/KDE/openSUSE, with this patch applied:

  • Portal 2: It does have an issue with the mouse not using relative mode properly (though the "Raw Mouse Input" option works as a work-around), but otherwise works perfectly in the OpenGL backend. The Vulkan backend does error with err: Failed to create surface
  • Crusader Kings II seems to work fine for me here under wayland. It even printed a log message listing SDL video drivers, and wayland worked fine:
Video Driver 0 = wayland
Video Driver 1 = x11
Video Driver 2 = KMSDRM
Video Driver 3 = dummy
  • Tomb Raider is working fine, as noted here.
  • I haven't been able to test CS:GO or Aperture Desk Job due to not having them installed yet.

The full version of Braid (both the SDL 1.2 and SDL 2.0 builds) use Cg: at least the newer builds give a nice error message. There are a few other games using Cg as well: it's rare, but not gone completely. And there are a few games which make X calls for other reasons, too: mostly using GL extension loaders which blindly assume GLX is the only way.

As to whether we should hold back on making SDL_VIDEODRIVER=wayland the default, I think it's the safe option. I think it's possible to make a game with SDL which supports wayland properly with what we've got, but existing games do several things which are broken. (Now, most of these ship their own libSDL2-2.0.so.0 file, so as long as we're not overriding it, things should be fine, but…)

(And Wayland/nVidia is still broken enough that it's not shippable as a default, IMO. It was probably okay to have it be the default in SDL as long as distros weren't encouraging people to use Wayland/nVidia, but now that they're making the very brave decision to do so, uh, it'll be less stable than X11, or even XWayland…)

That being said: I don't think that having every SDL2 game work with SDL_VIDEODRIVER=wayland is a realistic goal. I'm not sure (but could be convinced) that a quirks mechanism would ideally belong in SDL itself (though I think it would fit in the eventual sdl2-compat library). Steam could be a good place for it, though there's equally some sense in having something less tied to a particular vendor…

@sulix
Copy link
Contributor

sulix commented Apr 18, 2022

A few further notes:

  • Portal 2: the mouse issues I saw are all fixed by Wayland: Emulate mouse warp using relative mouse mode #5546
  • Portal 2: The game crashes on startup if I force client-side decorations after complaining about hb_ft_face_create being missing. (This is probably a libdecor bug: it breaks pretty horribly if no plugin is loaded.)
  • Portal 2: I can reproduce the weird mouse glitchiness if I delete the game's libharfbuzz.so.0 and run with libdecor CSD forced: SDL_VIDEO_WAYLAND_PREFER_LIBDECOR=1 LIBDECOR_FORCE_CSD=1 (requires latest libdecor for this commit).
  • Half-Life 2 & Left 4 Dead 2: Game loads as a (-1×-1) px window, which is invisible and useless.
  • Half-Life 2, Left 4 Dead 2, & Portal 2: Crash on startup with vulkan: SDL_VIDEODRIVER=wayland and Portal 2 ValveSoftware/portal2#370 — SDL_Vulkan_CreateSurface() seems to succeed, but the game asserts after printing "Failed to create surface".
  • Civilization: Beyond Earth: Crashes on startup.
  • Bioshock Infinite, Witcher II: Work with the hack in Wayland: Emulate mouse warp using relative mouse mode #5546, otherwise have mouse confinement issues.
  • Shadow of the Tomb Raider: Worked fine for a while, but got a bit glitchy, then steam crashed in libnvidia-GLcore.so (probably out of VRam: nVidia seems to handle this poorly on wayland…)

Basically, everything seems to work okay, except for the triumvirate of nVidia issues, libdecor issues, and games-doing-wayland-unfriendly-things (calling X directly, mouse warping, etc). Of course, those are pretty big issues, given how popular nVidia and Gnome both are…

@flibitijibibo
Copy link
Collaborator

The Vulkan issue is likely the VkSurfaceKHR object failing the present test, like this one here: https://github.com/FNA-XNA/FNA3D/blob/master/src/FNA3D_Driver_Vulkan.c#L2330

This is reported to NV, is supposed to be fixed in an upcoming release.

@smcv
Copy link
Contributor Author

smcv commented Apr 18, 2022

I don't think that having every SDL2 game work with SDL_VIDEODRIVER=wayland is a realistic goal

Since people seem to be starting to talk about SDL 3 already, perhaps SDL 2 should stay on Xwayland-by-default/opt-in-native-Wayland, with SDL 3 as the one to flip the switch to Wayland-by-default with an opt-out mechanism?

Now that SDL_VIDEODRIVER is a hint (#5544), SDL 2 games that know they have first-class-citizen Wayland support could use SDL_SetHint(SDL_HINT_VIDEODRIVER, "wayland,x11") if they want to. In particular, Wayland-first distros might want to patch known-good open-source games to do that, while leaving third-party proprietary games on e.g. Steam defaulting to Xwayland.

@flibitijibibo
Copy link
Collaborator

Since people seem to be starting to talk about SDL 3 already, perhaps SDL 2 should stay on Xwayland-by-default/opt-in-native-Wayland, with SDL 3 as the one to flip the switch to Wayland-by-default with an opt-out mechanism?

This crossed my mind as well, but SDL3 is... quite a ways away. I was hoping we'd have this ready in a few months, whereas 3.0 might not be for a couple years (we've got SDL_Gpu, SDL_ActionSet, and probably a lot more to worry about that Sam and Ryan have in mind).

But, it's looking like the pattern is that we've actually managed to catch up and now we're back to waiting on third parties again - we've still got NVIDIA finishing their support, libwayland is still struggling with event queue overflow, libdecor seems to be showing its flaws as we push more and more of the catalog through it, and of course the Steam team has just decided not to show up at all. Maybe it'd be best to say SDL Wayland is "stable" but not default, so that third parties have a chance to catch up again.

@sulix
Copy link
Contributor

sulix commented Apr 18, 2022

To add to the list of Wayland/nVidia issues, a number of distros are (or have been) packaging the nVidia drivers incorrectly, leaving out (or not properly setting up the symlinks for) the libnvidia-vulkan-producer.so file, which makes Vulkan work fine under X11 and Xwayland, but break for native wayland apps. Combined with the issues with libnvidia-egl-wayland both having bugs and having not been packaged everywhere (particularly for 32-bit) until recently, Xwayland is definitely much more stable than native wayland for nVidia on many setups.

And it turns out a number of other games have dependency clashes with libdecor's cairo plugin: they package some .so file with the game which is too old for the libdecor plugin, which doesn't load, which causes libdecor to crash (as libdecor doesn't handle the case where no plugins load gracefully). This is almost certainly something worth working around in libdecor, but doing so properly could be difficult.

So, I'm definitely settling on the "this isn't ready to be default in 2.0.22" camp. I still think it should be possible to change this before SDL 3, given most of the outright broken applications bundle their own older SDL2 anyway, and no-one's overriding those with newer versions indiscriminately.

@slouken slouken self-assigned this Apr 18, 2022
@slouken slouken added this to the 2.0.22 milestone Apr 18, 2022
@slouken
Copy link
Collaborator

slouken commented Apr 18, 2022

I agree. We'll go ahead and flip the default back to X11 for now.

@slouken
Copy link
Collaborator

slouken commented Apr 18, 2022

I'm going to close this for 2.0.22, but I'll label it "wayland regression" so we can re-examine this later as needed.

Thanks everyone!

@bluca
Copy link

bluca commented Apr 18, 2022

To add to the list of Wayland/nVidia issues, a number of distros are (or have been) packaging the nVidia drivers incorrectly, leaving out (or not properly setting up the symlinks for) the libnvidia-vulkan-producer.so file, which makes Vulkan work fine under X11 and Xwayland, but break for native wayland apps.

@sulix Debian maintainer here - what should we do about libnvidia-vulkan-producer.so exactly? We currently ship it as we do with other internal libraries, versioned with the driver version:

https://packages.debian.org/search?suite=experimental&section=all&arch=any&searchon=contents&keywords=libnvidia-vulkan-producer.so.510.60.02

@christianrauch
Copy link
Contributor

@sulix Can you create issues in the libdecor repo for the bugs that you encountered?

Mixing system libraries with the libraries in the steam runtime can definitely cause issues. If you want to use libdecor with the runtime libraries, you also have to compile libdecor against the runtime. I don't think there is anything libdecor can do about changing the library search paths.

@p2004a
Copy link

p2004a commented Apr 18, 2022

Re: comment above about libdecor not handling plugin loading gracefully: see here: https://gitlab.gnome.org/jadahl/libdecor/-/issues/35#note_1432002, (not exactly dedicated issue but it's discussed and debugged there atm)

@christianrauch
Copy link
Contributor

Re: comment above about libdecor not handling plugin loading gracefully: see here: https://gitlab.gnome.org/jadahl/libdecor/-/issues/35#note_1432002

This is in the current development version, not in the last 0.1 release.

In any case, if there are issues with libdecor, please report them upstream. If they are only discussed in downstream projects, then we will not become aware of those issues to fix them.

@sulix
Copy link
Contributor

sulix commented Apr 19, 2022

Re: libnvidia-vulkan-producer.so: at least on my system (which is currently openSUSE), just having the libnvidia-vulkan-producer.so.510.60.02 file was insufficient: I needed there to be an unversioned .so file as well:

sudo ln -s /usr/lib/libnvidia-vulkan-producer.so{.510.60.02,}

Without it, vulkaninfo would fail to work with this error:

ERROR at /home/abuild/rpmbuild/BUILD/Vulkan-Tools-sdk-1.3.204.0/vulkaninfo/vulkaninfo.h:230:vkGetPhysicalDeviceSurfacePresentModesKHR failed with ERROR_INITIALIZATION_FAILED

And strace showed:

openat(AT_FDCWD, "/usr/lib64/libnvidia-vulkan-producer.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT

If vulkaninfo is working under Debian, then you're probably not affected by this for some reason. I'm still trying to work out why this seems to be an issue here.

Of course, the nVidia/Wayland setup has had enough issues that it doesn't quite feel like it's had enough time to bake everywhere, including QtWayland fixes not yet being present on debian, libnvidia-egl-wayland not having had 32-bit builds on openSUSE, and issues like vulkan queues not supporting present properly and multithreading issues with resizes.

As for the libdecor issues, the main crash is now fixed, and I'll try to nail down and report any remaining issues as I get free time over the next ~week or so. (There's something funny happening with mouse capture regions, I think…)

@smcv
Copy link
Contributor Author

smcv commented Apr 19, 2022

most of the outright broken applications bundle their own older SDL2 anyway

For the Steam games I was testing, it's more accurate to say that most of the games I tried bundle their own older SDL2, and most of the games I tried had problems. I didn't have a large enough sample of games that don't bundle SDL to be able to assess whether those are more or less likely to work, but it seems reasonable to expect that if a majority of the games that bundle SDL are regressing under native Wayland, then some games that don't bundle SDL will probably also regress.

With either my distro hat or my Steam Runtime hat on, I think bundling SDL2 with the game is something we should be reducing rather than increasing, because that way the game will never pick up bug fixes in newer SDL versions without intervention from a relatively knowledgeable user; so I'd like to be in a position to say "stop bundling SDL, rely on the distro and/or Steam Runtime providing a suitable version". However, that idea relies on each SDL update being safe (no regressions) for a majority of games.

Mixing system libraries with the libraries in the steam runtime can definitely cause issues

The LD_LIBRARY_PATH-based Steam Runtime is designed to avoid those issues by always preferring a system copy if it is equal or newer. The really problematic scenario is when a game like Portal 2 bundles a library with the game itself (this seems to be relatively common for the font stack - Harfbuzz, Fontconfig, Freetype, Pango - for whatever reason), and the bundled library is older than the system library, but depended-on by a system library like libdecor that needs a newer version than the bundled one.

The newer container-based Steam Runtime is designed to avoid those issues by more consistently using the container's libraries for everything not in the graphics driver stack, in particular SDL and libdecor. However, when a game like Portal 2 bundles a library with the game itself that is older than the copy in the container, again, that will cause problems. The Steam Runtime version 2 'soldier' container doesn't yet ship libdecor, but I hope it can in future. Steam Runtime version 3 'sniper' does have libdecor.

icculus pushed a commit to icculus/SDL that referenced this issue Apr 27, 2022
This reverts commit 8ceba27.

SDL Wayland support is stable, but there are a number of issues with third-party software (NVIDIA drivers, libwayland event overflow, libdecor not handling plugin load failures, Steam overlay not working with Wayland, etc.) that make it better to default to X11 at this time.

Games which would like to prefer wayland when available can use the following code before SDL_Init():
	SDL_SetHint(SDL_HINT_VIDEODRIVER, "wayland,x11");

Fixes libsdl-org#5527
philippemnoel pushed a commit to philippemnoel/whist-SDL that referenced this issue Apr 28, 2022
* Make Win32 fullscreen and borderless windows minimizable

* reduced a few ifdefs, fixed an unused warning if built w/o SDL_HAVE_YUV.

* rawinput: Fix double detection of gamepads on some 3rd party X360 wireless receivers

The name that the Raw Input joystick driver pulls from the HID stack comes
from USB string descriptors contained on the device. For official wireless
receivers, this always contains "Xbox 360 Wireless Receiver for Windows"
which matches the friendly name that WGI provides.

3rd party Xbox 360 wireless receivers may have different strings in their
USB string descriptors (one uses "XBOX 360 For Windows" instead). This
fails to match WGI's name and causes Raw Input and WGI to both report the
same gamepad.

Since wireless Xbox 360 controllers seem to have a consistent VID/PID
regardless of the adapter enumerating them, we can also match on that to
catch these.

The duplicate case reported to me was:
Controller (XBOX 360 For Windows) - 030000005e040000a102000000007200
Xbox 360 Wireless Receiver for Windows - 030000005e0400000000000000007701

* Makefile.os2: fixed setting OS2DEBUG in CFLAGS.

* minor os/2 clean-ups.

* emscripten: Don't prevent default on filtered key events

* IME Composition Truncation + SDL_IsTextInputShown + SDL_ClearComposition (#5398)

* Fixes for IME Composition Truncation + Addition of SDL_ClearComposition, SDL_IsTextInputShown

* Fixed: Documentation and code style issues raised during code review.

* Sync wiki -> header

* SDL_windowskeyboard.c (IME_IsTextInputShown): remove unused local vars.

* cmake: Make test code use proper C main functions.

Fixes #5021.

* SDL_blit_N.c: removed duplicated const (fixes bug #5401)

* SDL_endian.h: use endian predefs from newer gcc and clang versions.

Closes: libsdl-org/SDL#5403

* Android: add comment to set render target to NULL when going to background (bug #4041)

* Make SDL_VIDEO_OPENGL_EGL optional on Android

* Fixed: Incorrect assumption that mouse button is released when window is allocated

* SDL_audiocvt.c: Don't byteswap 8-bit streams

Otherwise, this results an assert on big endian machines when attenpting to use SDL_LoadWAV_RW function to load 8-bit WAV files.

* METAL: clip rect w/h must be <= render pass

* Fix name of macOS platform and link to README file

* Fixed bug #2199: make SDL_blit_slow handles SDL_PIXELFORMAT_ARGB2101010, storing as RGBA

* Fixed bug #2691 - re-enable surface_testCompleteSurfaceConversion for ARGB2101010

* INSTALL.txt: Say "macOS" instead of "Mac OS X" in modern times.

Reference Issue #5407.

* SDL_windowskeyboard.c: fix build with SDL_DISABLE_WINDOWS_IME defined.

Fixes libsdl-org/SDL#5408

* minor whitespace cleanup.

* SDL_audiocvt.c: minor cleanup.

* Adjust gradle dependencies to enable the build to position assets for the APK

* emscripten: obey enable-misc/SDL_MISC settings

* minor optimization (SDL_audiocvt.c)

* imported two libtool mainstream commits 28fbcb6a and b55b1cc8

* Remove 'reserved identifier' warning

* SDL_blit_slow: remove one nested 'if()' because of ARGB2101010 handling

* SDL_triangle_blit_slow: sync code with SDL_blit_slow to handle ARGB2101010

* SDL_GetBasePath() fixes for OS/2

* use _Static_assert for SDL_COMPILE_TIME_ASSERT(), when available

* testplatform.c: move static asserts out of TestTypes().

* simplify SetDSerror
- no need to keep the error in a static variable
- always print the error code
- reduce the required stack-size
- reduce the number of snprintf calls (and code size)

* Fixed build when events are disabled

Fixes libsdl-org/SDL#5413

* Removed problematic call to ISensor_SetEventSink()

Fixes libsdl-org/SDL#5288

* Fixed warnings when building with cygwin

Fixes libsdl-org/SDL#5025

* SDL_cocoawindow.m: update fullscreen toggle when SDL_SetWindowResizable called

* Ignore unknown WM_SIZE types.

According to MSDN, we can also get SIZE_MAXHIDE and SIZE_MAXSHOW,
based on state changes to other windows. It's not clear under
what circumstances this will happen (I saw some docs indicating
it may require multiple application windows), but it doesn't seem
right to treat them as RESTORED.

* Fix relative mouse input for Unvanquished (unvanquished.net)

Here's an IRC dump that hopefully explains the issue this fixes:

> I'm debugging something odd where, for a libre game,
  unvanquished.net (a FPS), relative mouse input in fullscreen is
  buggy
> it's like, working mostly ok, but it has a weird
  performance/cleanup bug
> after some time in relative mouse input mode, some time as low
  as 15s, usually more, the SDL sends A LOT of relative mouse
  input per frame
> almost all of which have xrel==0 && yrel==0
> by A LOT, I mean that after ~1min, it's usually in the
  thousands per frame
> each frame, a while ( SDL_PollEvent( &e)) loop reads the
  inputs, but it seems SDL is not clearing the list.
> one way to clear the list is to open the in-game console or
  menu, which switches the input mode to absolute, then close it
  which gets a working relative input mode (for some time at least)
> I've shown the issue to be present with SDL2.0.20 but not with
  2.0.14 on my system
> some other players on Arch Linux (SDL2.0.20) report a possibly
  related issue, where some keys seem to be pressed at random
> I've did some bisection on SDL master, and I've found that
  there are actually two commits involved, one breaking it
  totally (no input at all), and one fixing it partially (with
  the problem described above)

First related commit that breaks it totally:

	commit 82793ac
	Author: Sam Lantinga <[email protected]>
	Date:   Thu Oct 14 14:26:21 2021 -0700

	    Fixed mouse warping while in relative mode

	    We should get a mouse event with an absolute position and no relative motion and shouldn't change the OS cursor position at all

Second related commit, that halfway fixes it:

	commit 31f8c3e
	Author: Sam Lantinga <[email protected]>
	Date:   Thu Jan 6 11:27:44 2022 -0800

	    Fixed event pump starvation if the application frequently pushes its own events

Reverting the first commit did fix the issue for me, but would
probably reintroduce the bug it was fixing(?). This patch should
fix it for everyone hopefully.

DaemonEngine/Daemon#600 is the upstream
bug, and contains some early investigation.

* Don't warn if anyone peeps for events after quitting the event subsystem

Fixes libsdl-org/SDL#5013

* video: Add a hint to allow Vulkan surfaces on foreign windows

* Fixed compile warning and comment typo

* Added a hint to mark a foreign window as usable with OpenGL

Fixes libsdl-org/SDL#2942

* When updating grab state, only activate windows that are grabbed, fullscreen, and shown.

Fixes libsdl-org/SDL#5371

* Try not forcing activation when grabbing the mouse in fullscreen windows

* Workaround for bug in Microsoft WGI support

Fixes libsdl-org/SDL#5270

* Use SDL_Log instead of printf

* Added a hint to capture the mouse when mouse buttons are pressed, defaulting on

Fixes libsdl-org/SDL#5301

* Fixed memory leak in WIN_CreateBlankCursor()

* Fixed freeing the Windows blank cursor

* Start rumbling once a raw input controller has been correlated

Fixes libsdl-org/SDL#5351

* Modern CMake doesn't need "LANGUAGE C" for Objective-C

CMake 3.19 fails to compile Objective-C with that property set

Fixes libsdl-org/SDL#5418

* Added the hint SDL_HINT_MOUSE_RELATIVE_MODE_CENTER, controlling whether the mouse should be constrained to the center of the window or the whole window in relative mode.

For further info about the pros and cons, check out the discussion in libsdl-org/SDL#5271

* Added a note that SDL_RenderReadPixels() should be called before SDL_RenderPresent()

* Sync wiki -> header

* Fix "SDL_TRUE is not defined" runtime error for emscripten.

* SDL_UnionRect: If both rects are empty, zero out the result struct.

* SDL_Rect: minor code cleanups.

* SDL_Rect: Added floating point versions of all the rectangle APIs.

Fixes #5110.

* Fix "SDL_FALSE is not defined" runtime error for emscripten.

* Fixed Android crash when SDL_HIDAPI_DISABLED set to 1

The Java code needs the native functions to be implemented, even if they're not surfaced via the C API.

Fixes libsdl-org/SDL#5326

* Relative mouse mode is tied to the window with keyboard focus

This isn't obvious, but makes sense when thinking about how games actually use it. This is also in line with how Windows mouse relative mode is implemented.

Fixes libsdl-org/SDL#5340

* Fixed parameter operation ordering for ease of reading

* audio: Set error message on dsp init failure.

if SDL_EnumUnixAudioDevices() fails to find any devices,
set an error message on the exit path. Without this,
SDL_Init() could fail without any message available
in SDL_GetError().

* Sync wiki -> headers.

* Fixed bug #2426 - SDL_RenderReadPixels result is unspecified and fails testautomation
Call SDL_RenderPresent after calling SDL_RenderReadPixels.
From "include/SDL_render.h":
"If you're using this on the main rendering target, it should be called after rendering and before SDL_RenderPresent()."

* Fixed bug #2962 - when SDL_RenderReadPixels format = 0, used format of the target texture
include/SDL_render.h, format:
"0 to use the format of the rendering target "

* blit-auto optimizations

* regenerated SDL_blit_auto.c.

* Don't try to hide foreign windows when destroying the SDL window representation

Fixes libsdl-org/SDL#5432

* hints: Added SDL_HINT_QUIT_ON_LAST_WINDOW_CLOSE.

Fixes #2349.

* SDL_render.c: remove unsused case, since renderer target has been forced to NULL previously (see bug #4213)

* Add mapping for Logitech Precision Gamepad

* Also fix Android crash when SDL_HIDAPI_DISABLED set to 1

The Java code needs the native functions to be implemented, even if
they're not surfaced via the C API, therefore, a stub version of
functions were made only to the purpose of "fill the gaps" when
SDL_HIDAPI_DISABLED set to 1.

* use != '\0' comparison instead of SDL_strlen in the functions of SDL_getenv

* make SDL_strcasecmp standard compliant

* optimize the SDL_str(case)cmp functions

* Avoid trying to use texture framebuffers on emscripten

* stdlib: just cast iconv()'s 2nd arg to void *.

This makes the compiler happy (enough) regardless of whether the C runtime
headers think this argument should be const or not.

Fixes #4966.

* Fixed freeing a constant string (thanks @gnrlwart)

* Android: add SetWindowResizable() implementation
- which also enable/disable the orientation lock status.

This is only provided when the window is not SDL_WINDOW_FULLSCREEN (see SDL_video.c).
Final orientation also depends on SDL_HINT_ORIENTATIONS.

* Video: do not use hardcoded VIVANTE and VDK libraries

* Add SDL_RenderGetWindow() API to get the window associated with a renderer (#5440)

Add SDL_RenderGetWindow() API to get the window associated with a renderer

* Sync wiki -> header

* wayland: Bump minimum requirement to wayland-client 1.18 or newer

* wayland: The rest of the wayland-client 1.18 requirement... Git, please

* wayland: Basic support for zwp_tablet_*v2 protocol

* video: wayland: Use xdg-output for retrieving the desktop dimensions

Using wl-output to get the desktop display dimensions and dividing by the integer scale factor will not return the correct result when using a desktop with fractional scaling (e.g. a 3840x2160 display at 150% will incorrectly report the scaled desktop area as 1920x1080 instead of 2560x1440).  Use the xdg-output protocol, if available, to retrieve the correct desktop dimensions and offset.

Versions 1 through 3 of the protocol are supported.

* Vita: support audio format fallback

* Vita: add native YUV textures support.

* Fail if texture init fails.
* Refactor and cleanup.

* static analysis: Fixed several complaints from codechecker.

There are still some pending Objective-C specific issues.

Reference issue #4600.

* add some Thrustmaster wheels

* Fixed bug #1650: X11 doesn't set KMOD_NUM and KMOD_CAPS to system state

* x11: Minor cleanups and corrections in X11_ShowMessageBox.

Reference issue #3254.

* Avoid depending on libwayland 1.20 unnecessarily

When using shared linking (linking in the normal way with
-lwayland-client) rather than loading Wayland libraries dynamically at
runtime, listing symbols that don't exist in the current version results
in a build failure. We don't actually call wl_proxy_marshal_flags() or
wl_proxy_marshal_array_flags() directly; the reason we need them is
that they're called by the code generated by wayland-scanner >= 1.20.

If we're building against an older Wayland library, then we'll have its
corresponding version of wayland-scanner (mismatched versions are not
supported), so we won't need those two symbols, and can avoid generating
a dependency on them.

Conversely, if we're building against a newer Wayland library, the
generated code will call them unconditionally, so we cannot treat them as
optional and gracefully fall back: that would result in a crash. Instead,
treat them as a mandatory part of the Wayland library, so that if they
are not found at runtime, we can fall back to X11 without crashing.

libwayland 1.18 is in several LTS distributions (Ubuntu 20.04,
Debian 11, RHEL 8) so avoiding a hard dependency on 1.20 is quite
useful.

Signed-off-by: Simon McVittie <[email protected]>
Resolves: libsdl-org/SDL#5376

* wayland: Don't overwrite error message from SDL_EGL_CreateSurface

SDL_EGL_CreateSurface sets a more specific error message, so overwriting
it would lose information.

Signed-off-by: Simon McVittie <[email protected]>

* wayland: Minor fixes for old compilers

* wayland: Remove some now-redundant casts

* iOS >= 10.0 silence GLes deprecation warnings

* wayland: Add an xkb_keysym_t->SDL_Keycode mapping for backspace

* wayland: Enforce text capitalization manually, for remapped keymods

* wayland: Use xkb_keymap_mod to set mod state

* YUV: fix invalid read on last line when converting from SDL_PIXELFORMAT_YUY2 (see bug #4841)

* Vita: Fix NULL-pointer dereference

* wayland: Optimize keyboard_handle_modifiers.

1. Mod index values are (mostly) constant, so can be done with xkb_state_new
2. Mods can change without the group changing, avoid remap events if possible

Lastly, as a bonus, I added braces to the locale check, because I was nearby.

* Initialize compile status variable and check also program link status

* testshader: use SDL_malloc instead of SDL_stack_alloc.

* README-windows: Convert to actual Markdown text.

* README-windows: Wordwrap text file.

This makes for easier reading outside of a formal Markdown viewer.

* README-windows: Notes on building with Visual Studio/LLVM.

Fixes #5186.

* wayland: Work around a GNOME xdg_output scaling issue

* wayland: Avoid overwriting xdg_output position with wl_output position

* wayland: Relax the check for mismatching output scales

* configure: improvements to libdecor discovery :

use PKG_CHECK_MODULES, and use DECOR_LIB with find_lib.
Closes: libsdl-org/SDL#5460

Co-authored-by: Trigan2025 <[email protected]>

* direct3d: Implement missing blend operations.

This is only for Direct3D 9; Direct3D 11 already had this implemented.

Fixes #5375.

* Remove URLs from markdown headers in README-visualc.md

* Clean up formatting in README-directfb.md

* testgles2: Call correct function to get shader info log and add link status checking

* Sync wiki -> header

* Sync wiki -> header

* Vita: Use preallocated memory pool for textures

* Sync wiki -> header

* Correct default structure packing on Windows ARM64

See issue #5454 for details

* Fix potential memory leak in QueueCmdFillRects

* Vita: add hint to select which touchpad generates mouse events

* emscriptenaudio: proxy calls to main thread

* video: wayland: Use wp-viewporter for fullscreen with non-native resolutions

Wayland doesn't support mode switching, however Wayland compositors can support the wp_viewporter protocol, which allows for the mapping of arbitrarily sized buffer regions to output surfaces.  Use this functionality, when available, for fullscreen output when using non-native display modes and/or when dealing with scaled desktops, which can incur significant overdraw without this extension.

This also allows for the exposure of arbitrarily sized, emulated display modes, which can be useful for legacy compatability.

* wayland: Minor fix for old compilers

* video: wayland: Expose more resolutions for mode emulation

Expose as many emulated display modes as possible.  They will currently display stretched to the display's native desktop aspect, but if an application requires a hardcoded resolution, it will work at minimum.

Aside from the change in the emulated display mode list, the Wayland event handling code had to be updated to support separate scaling for the x and y axes, as square pixels are no longer guaranteed.

* video: wayland: Use viewports for non-fullscreen windows with fractional scaling

Use viewports for non-fullscreen windows when the desktop uses fractional scaling and the window is flagged as DPI-aware to provide a backbuffer mapped as close to 1:1 output as possible.  In the cases of odd window sizes the backbuffer may be a pixel off of scaling perfectly into the window size due to its scaled size being rounded off, but a minute amount of scaling during output is likely preferable to the large amounts of overdraw needed with integer scaled buffers.

* Vita: add audio capture support

* Vita: add SDL_GetPreferredLocales support

* stdinc: SDL_COMPILE_TIME_ASSERT defines shouldn't have a semicolon.

* x11: Catch X11 errors in X11_SetWindowPosition and X11_SetWindowSize.

The functions can go south if other operations are in progress, like
X11_SetWindowBordered, which might be doing something traumatic behind the
scenes of the window manager.

We can't make these tasks totally synchronous, which would fix the problem,
because not only can the window manager block however long it wants, it might
also decide to deny our requests without any notification, so we'd be waiting
forever for a window change that isn't coming.  :(

Fixes #5274.

* joystick: Fix rumble issues on PS5 HIDAPI controllers

We were returning the report size from HIDAPI_DriverPS5_RumbleJoystick() rather
than 0 upon success, causing SDL_JoystickRumble() (and callers) to think that
rumbling failed.

This didn't cause major problems until 1868c5b, when it started preventing
rumble state from being persisted in the joystick core, even though it was
successfully sent to the hardware.

This led to all sorts of strangeness, including broken rumble duration and
attempts to stop rumble being discarded.

* Desktop OpenGL 1.X/2.X PSVita Support

* Update README-vita.md

* Cleanup Spaces

* Vita: PVROGL: fix indentation and ifdef guards

* Vita: fix readme

* x11: Ignore BadValue for extremely small XRRSetScreenSize resolutions.

Reference Issue #4840.

* SDL2 thread proxying fixes

This PR uses new APIs added in [emscripten-core/emscripten#9336](emscripten-core/emscripten#9336)
to improve compatibility with USE_PTHREADS=1.

Original PR: emscripten-ports/SDL2#127
By: @jakogut
Reviewed by: Daft-Freak

* emscriptenmouse: remove old extra `_INT`

* fix formatting and cast warnings

Co-authored-by: Charlie Birks <[email protected]>

* emscriptenmouse: remove useless return statement

* emscriptenframebuffer: fix formatting

* emscripten: Proxy SDL_GetUsableDisplayBounds to the main thread.

* Fixed loading 32-bit BMP files

* Move SDL_List functions to SDL_list.c to avoid more merge with eventual PR

* Add SDL_list.c/h

* Add SDL_list to macosx xcode

* Use RoInitialize/RoUninitialize for Windows.Gaming.Input

Thanks @walbourn!

Fixes libsdl-org/SDL#5270

* fix build against older SDKs after commit 8ebef12.

* check for HAVE_ROAPI_H in cmake and autotools, and

update SDL_config_windows.h and SDL_config_winrt.h

* attempt to fix uwp build

* render: Fix setting the scale mode for non-native textures

* Visualise scroll wheel events in testmouse

* Minor cleanup

* x11: Don't unload libGL.so to prevent a crash in XCloseDisplay()

libGL.so may register callbacks that can be invoked upon XCloseDisplay().
If XCloseDisplay() is called after libGL.so is unloaded, the callback pointer
will point at freed memory and invoking it will crash.

The texture framebuffer check optimized out in f37e4a9 was causing libGL.so to
never be unloaded as a side-effect. Skipping it exposed this bug by allowing
libGL.so to actually unload.

* x11: Wait a bit to see if window pos changes when changing fullscreen.

Helps prevent window from moving to 0,0 when leaving fullscreen.

Fixes #4749.

* testgles2: Fix buffer object sizes

* Added a define VERBOSE_MOTION_EVENTS to show mouse and finger motion events

* Handle interaction between auto capture and the SDL_CaptureMouse() API

Fixes libsdl-org/SDL#5457

* Minor cleanup

* IBus should use ev keycode instead of X keycode

See: https://github.com/ibus/ibus/blob/5a455b1ead5d72483952356ddfe25b9e3b637e6f/client/gtk2/ibusimcontext.c#L468

* Ignore focus change messages that contradict GetForegroundWindow.

On Wine, when a window is programmatically minimized in response
to losing focus, we receive a WM_ACTIVATE for the deactivation,
but GetForegroundWindow still indicates that our window is focused.
This causes an incorrect SDL_WINDOWEVENT_FOCUS_GAINED.

This is probably a Wine bug, but it may take a while to fix and
then for the fix to make its way to users.

* Don't resize fullscreen windows when hiding or minimizing them (thanks @madewokherd!)

This has the benefit of window previews (mousing over the icon) having the correct size and contents.

Fixes libsdl-org/SDL#5320

* x11: when waiting on fullscreen changes, not window position _and_ size.

This makes sure the window doesn't have outdated values if you try to access
them (or call something that does, like SDL_SetWindowMinimumSize).

Fixes #5233.

* Send key release event to input method. (#5281)

Co-authored-by: Ethan Lee <[email protected]>

* Cache the fact that a device didn't look like a joystick

Fixes libsdl-org/SDL#5211

* x11: Try to keep SDL_WINDOW_FULLSCREEN* in sync with window manager.

So if Gnome/KDE/etc have a keyboard shortcut or titlebar decoration to
make any window go fullscreen (with the _NET_WM_FULLSCREEN flag on the
_NET_WM_STATE property), we update the SDL window flag.

Fixes #5390.

* Sort controllers by the js* index on Linux

Also fixed the initial scan to directly scan devices instead of using
udev so they can be sorted, as intended.

Fixes libsdl-org/SDL#4688

* wayland: Evaluate WINDOWPOS_CENTERED_DISPLAY for move events

Partially fixes the mouse cursor in UE5 editor. Imperfect because UE5 uses window position and global mouse state to get position, but of course we don't have global mouse and this is just to get the right display index so this still fails overall. We really need to make global mouse support a feature query...

* wayland: Try to detach at the beginning of ShowWindow, just in case.

It's possible that an external component (probably a GL/VK context) committed, so we need to cover our bases and detach in both HideWindow and ShowWindow.

Fixes a crash in UE5 editor's pop-ups.

* wayland: Add a bug link for the detach FIXME

* wayland: Pin the fake window position at (0, 0).

I kind of thought it'd be nice to have it in the center, but this is an issue
for applications that still assume global mouse and window positions are
accessible. For example, this fixes cursor offset issues in UE5.

* Makefile.in: added missing CXX variable.

* Compile with recursive mutexes for emscripten

Emscripten actually does support recursive mutexes, so no need to use SDL's fake recursive code.

Background: #5428, #5479

* x11: Treat WM setting the window "fullscreen" like FULLSCREEN_DESKTOP.

Fixes #5390.

* Only update modifier state for keys that are pressed in another application

Fixes libsdl-org/SDL#4432

* minor adjustment to os/2 watcom makefile

* Make sure the UIKit message box is being handled on the main thread

Potentially fixes libsdl-org/SDL#4865

* render: Update the size/scale/viewport on moves, in addition to resizes.

For OpenGL this means resetting the viewport state shadowing flag too.

Fixes #1504

* direct3d11: Set the swapchain target immediately after creating it.

Fixes #4782

* video: wayland: Set the surface damage region when using fullscreen viewports

When using emulated display modes, the output size is often larger than the drawable buffer.  As the surface damage region is automatically calculated from the smaller drawable buffer size, the damage region needs to be manually set to cover the entire viewport region or visual repaint artifacts can result.

* Fixed typo

* Updated the patch notes with API changes for 2.0.22

* Update version to 2.0.22 for release

* audio: SDL_ConvertStereoToMono_SSE3 missed an unaligned load.

* UWP: Require Windows 10 16299 or newer.

This is required to build with WGI support. Thanks for @FrozenChameleon for the fix!

Fixes #5504

* Vita: fix VIDEO_VITA_PVR flag

* fix os2 timer in fallback mode

* testevdev: Recognise touchpads as such

At the time I contributed this unit test, SDL didn't understand Linux
touchpads, but now it does.

Fixes: 373216a "Added support for touchpads in the Linux evdev code"
Signed-off-by: Simon McVittie <[email protected]>

* testevdev: Adapt to a broader definition of keyboards

At the time I contributed this unit test, SDL had a relatively narrow
definition of what is a keyboard, approximately matching udev
ID_INPUT_KEYBOARD. Now it uses the equivalent of udev ID_INPUT_KEY,
which matches anything with keyboard keys, and not just reasonably
complete alphanumeric keyboards.

Fixes: 040bd7a "Fix udev not detecting ID_INPUT_KEY devices when udev is not running"
Signed-off-by: Simon McVittie <[email protected]>

* test: Copy utf8.txt to build directory

testiconv wants this.

Signed-off-by: Simon McVittie <[email protected]>

* Initialise scandir argument

'scandir' does not initialise 'entries' on error

* Wayland: Add SDL_HINT_VIDEO_WAYLAND_PREFER_LIBDECOR

This hint allows libdecor to be used even when xdg-decoration is
available. It's mostly useful for debugging libdecor, but could in
theory be used by applications which want to (for example) bundle their
own libdecor plugins.

* WhatsNew.txt: Added SDL_HINT_VIDEO_WAYLAND_PREFER_LIBDECOR

* WhatsNew.txt: Document new dependency on libwayland-client 1.18.0

Signed-off-by: Simon McVittie <[email protected]>

* CI: update os2.yml to use open-watcom/setup-watcom

also remove os2-buildbot.sh -- not needed anymore.

* avoid NullPointer in SDL_GL_MakeCurrent

* avoid NullPointer in SDL_GetRenderTarget

* video: Wayland: Clamp fullscreen window dimensions to desktop

A scaled fullscreen window may exceed the bounds of the desktop.  Clamp the window size to the desktop dimensions in fullscreen mode.

* video: Wayland: Always round scaled pointer coordinates down

Rounding up can cause the pointer coordinates to exceed the window boundaries at the right and bottom edges.

* x11: Update the display when the WM changes a window's fullscreen state.

Fixes #5390.

* Added CMake option to disable the installer

* cmake: Fixed indenting and some oldschool `endif(TEXT)` things.

* hints: Make SDL_VIDEODRIVER and SDL_AUDIODRIVER formal hints.

They were just environment variables before.

Fixes #5528.

* Revert "video: Prefer Wayland over X11"

This reverts commit 8ceba27.

SDL Wayland support is stable, but there are a number of issues with third-party software (NVIDIA drivers, libwayland event overflow, libdecor not handling plugin load failures, Steam overlay not working with Wayland, etc.) that make it better to default to X11 at this time.

Games which would like to prefer wayland when available can use the following code before SDL_Init():
	SDL_SetHint(SDL_HINT_VIDEODRIVER, "wayland,x11");

Fixes libsdl-org/SDL#5527

* Certain audio drivers, like the RME "Pro" Audio driver, have resampling quality issues when using WASAPI.

We'll use SDL's resampling algorithm so we have consistent quality between platforms and drivers.

Fixes libsdl-org/SDL#5538

* wayland: Add support for TOOLTIP/POPUP_MENU

* video: Don't minimize fullscreen windows on focus loss by default when mode switching is disabled

When mode switching is disabled in a video backend, fullscreen windows are basically just fullscreen desktop windows with different internal scaling.  As no mode switching occurs, there's no need to minimize them on focus loss by default.  This can still be overridden by explicitly setting the internal hint for minimizing on focus loss.

This has the side effect of fixing a bug on GNOME, where, when a fullscreen Wayland window has it's focus lost and restored via alt+tab followed by switching back to windowed mode, the top portion of the window won't end up being obstructed by GNOME's top bar.

* Added controller mapping for the Thrustmaster Dual Analog 3.2 on Linux

* Enable evdev-based gamecontrollerdb on FreeBSD

* simplify SDL_GetBasePath on windows
- use GetModuleFileName directly (as recommended)

* use explicit GetModuleFileNameW

* Remove HWND_TOPMOST for fullscreen windows

Fixes libsdl-org/SDL#5509

* SDL_render.c: internally change viewport/cliprect type from SDL_FRect to SDL_DRect (double precision). (see bug #5547)

* Don't call scandir() inside of scandir()

This works around a crash in address sanitizer

* Fixed compile warnings

* x11: Revert "Fix keymap updating for X11 backend"

This reverts commit de6d290.

This patch had multiple issues, discussed in #5520.

* Fixed build

* Fix recent changes in VitaSDK

* SceKernelMemBlockType to unsigned int

* Fix a -Wshadow warning

* Remove an unused function prototype

* WhatsNew.txt: Add SDL_FRectEqualsEpsilon()

* Add SDL_FLT_EPSILON.

* SDL_Rect: Use a default epsilon in SDL_FRectEquals()

Add SDL_FRectEqualsEpsilon() for when more control over
equality test is required.

* test: Basic tests for SDL_FRectEquals

Based on the integer version. These tests mostly check that input
isn't mangled and that invalid input gives the expected negative
result.

* hidapi: Wrap CopyHIDDeviceInfo in define checks.

The purpose of this is to silence a 'defined but not used'
warning.

* os2: SDL_DestroyMutex should ignore NULL mutexes.

Every other backend does this, so this should match, now.
It's possible this was harmless, but we can avoid the system call
and the (likely?) debug message when it fails, though!

* windows: Fix calling convention for RoInitialize/RoUninitialize

Fixes #5563

* windows: Fix RoInitialize() failure after a CoInitializeEx() call using apartment threading

This mirrors the same codepath in WIN_CoInitialize() which handles STA and MTA.

* WGI: Keep a reference to the MTA to avoid crashing on COM teardown

Fixes #5552
Fixes #5270

* WGI: Only call RoUninitialize() if RoInitialize() succeeded

* Handle potential out of memory condition when working with hints

* SDL_Rect: Add \sa documentation block to SDL_FRect

* Return a correlation error when trigger rumble is attempted without correlation

* Fixed build

* SDL: sometimes the PS5 controller doesn't report having to power even when connected over USB. Possibly related to being completely charged? Either way we already know that it's USB or BT so let's use the driver's knowledge instead.

* Added support for the Backbone One controller on iOS

* Revert "Fix relative mouse input for Unvanquished (unvanquished.net)"

This reverts commit 3318590.

Fixes libsdl-org/SDL#5569

* hidapi, libusb: import mainstream commit 536bad201e

* Fixed logical size synchronization issue on macOS

https://discourse.libsdl.org/t/sdl-2-0-22-prerelease/35306/6

* x11: revert checks for _NET_WM_STATE_FULLSCREEN changes.

This reverts commit 8597735.
This reverts commit 0249df9.

Fixes #5572.
Reopens #5390.

Co-authored-by: Jo Bates <[email protected]>
Co-authored-by: Ozkan Sezer <[email protected]>
Co-authored-by: Cameron Gutman <[email protected]>
Co-authored-by: Charlie Birks <[email protected]>
Co-authored-by: Zach Reedy <[email protected]>
Co-authored-by: SDL Wiki Bot <[email protected]>
Co-authored-by: Ryan C. Gordon <[email protected]>
Co-authored-by: Sylvain <[email protected]>
Co-authored-by: Guus Waals <[email protected]>
Co-authored-by: Zach Reedy <[email protected]>
Co-authored-by: Wohlstand <[email protected]>
Co-authored-by: Sam Lantinga <[email protected]>
Co-authored-by: staphen <[email protected]>
Co-authored-by: pionere <[email protected]>
Co-authored-by: uyjulian <[email protected]>
Co-authored-by: Esme Povirk <[email protected]>
Co-authored-by: Antoine Fontaine <[email protected]>
Co-authored-by: Ethan Lee <[email protected]>
Co-authored-by: Christian Kündig <[email protected]>
Co-authored-by: Eddy Jansson <[email protected]>
Co-authored-by: Egor <[email protected]>
Co-authored-by: Jonatha Gabriel <[email protected]>
Co-authored-by: Joao Paulo Magalhaes <[email protected]>
Co-authored-by: Florian "sp1rit"​ <[email protected]>
Co-authored-by: Frank Praznik <[email protected]>
Co-authored-by: Ivan Epifanov <[email protected]>
Co-authored-by: Kimplul <[email protected]>
Co-authored-by: Simon McVittie <[email protected]>
Co-authored-by: DominusExult <[email protected]>
Co-authored-by: capehill <[email protected]>
Co-authored-by: Trigan2025 <[email protected]>
Co-authored-by: Cameron Cawley <[email protected]>
Co-authored-by: Mathieu Eyraud <[email protected]>
Co-authored-by: Connor Clark <[email protected]>
Co-authored-by: Jaylon Gowie <[email protected]>
Co-authored-by: Reinhold Gschweicher <[email protected]>
Co-authored-by: Christoph Reichenbach <[email protected]>
Co-authored-by: Weng Xuetian <[email protected]>
Co-authored-by: David Gow <[email protected]>
Co-authored-by: Semphris <[email protected]>
Co-authored-by: Jan Beich <[email protected]>
1bsyl pushed a commit to 1bsyl/SDL that referenced this issue May 9, 2022
This reverts commit 8ceba27.

SDL Wayland support is stable, but there are a number of issues with third-party software (NVIDIA drivers, libwayland event overflow, libdecor not handling plugin load failures, Steam overlay not working with Wayland, etc.) that make it better to default to X11 at this time.

Games which would like to prefer wayland when available can use the following code before SDL_Init():
	SDL_SetHint(SDL_HINT_VIDEODRIVER, "wayland,x11");

Fixes libsdl-org#5527
@flibitijibibo
Copy link
Collaborator

Minor update for this: in addition to upstream libdecor fixing the major crashes, NV's latest driver and egl-wayland combo resolve the recent breakages, and our fixes were included in those updates. This leaves us with Steam and libwayland, unfortunately I've heard nothing for either one (though libwayland's patch is still maintained AFAICT).

@smcv
Copy link
Contributor Author

smcv commented Jun 9, 2022

This leaves us with Steam and libwayland, unfortunately I've heard nothing for either one (though libwayland's patch is still maintained AFAICT).

The Steam issue you refer to is ValveSoftware/steam-for-linux#8020, right?

Is there a separate libwayland bug with an unmerged patch, or am I misunderstanding you?

@flibitijibibo
Copy link
Collaborator

This patch: https://gitlab.freedesktop.org/wayland/wayland/-/merge_requests/188

And yes, Steam's issue is still the overlay.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants