SDL 2.0.22 PRERELEASE

Thanks to all the people who contributed code and feedback, SDL 2.0.22 has been tagged on GitHub as 2.0.22-RC1 and is now available as a PRERELEASE build!

https://www.libsdl.org/tmp/download-2.0.php

Please report any issues at Issues · libsdl-org/SDL · GitHub

In addition to lots of bug fixes, here are the major changes in this release:
General:

  • Added SDL_RenderGetWindow() to get the window associated with a renderer
  • Added floating point rectangle functions:
    • SDL_PointInFRect()
    • SDL_FRectEmpty()
    • SDL_FRectEquals()
    • SDL_HasIntersectionF()
    • SDL_IntersectFRect()
    • SDL_UnionFRect()
    • SDL_EncloseFPoints()
    • SDL_IntersectFRectAndLine()
  • Added SDL_IsTextInputShown() which returns whether the IME window is currently shown
  • Added SDL_ClearComposition() to dismiss the composition window without disabling IME input
  • Added SDL_TEXTEDITING_EXT event for handling long composition text, and a hint SDL_HINT_IME_SUPPORT_EXTENDED_TEXT to enable it
  • Added the hint SDL_HINT_MOUSE_RELATIVE_MODE_CENTER to control whether the mouse should be constrained to the whole window or the center of the window when relative mode is enabled
  • The mouse is now automatically captured when mouse buttons are pressed, and the hint SDL_HINT_MOUSE_AUTO_CAPTURE allows you to control this behavior
  • Added the hint SDL_HINT_VIDEO_FOREIGN_WINDOW_OPENGL to let SDL know that a foreign window will be used with OpenGL
  • Added the hint SDL_HINT_VIDEO_FOREIGN_WINDOW_VULKAN to let SDL know that a foreign window will be used with Vulkan
  • Added the hint SDL_HINT_QUIT_ON_LAST_WINDOW_CLOSE to specify whether an SDL_QUIT event will be delivered when the last application window is closed
  • Added the hint SDL_HINT_JOYSTICK_ROG_CHAKRAM to control whether ROG Chakram mice show up as joysticks

Windows:

  • Added support for SDL_BLENDOPERATION_MINIMUM and SDL_BLENDOPERATION_MAXIMUM to the D3D9 renderer

Linux:

  • Added the hint SDL_HINT_X11_WINDOW_TYPE to specify the _NET_WM_WINDOW_TYPE of SDL windows

Android:

  • Added SDL_AndroidSendMessage() to send a custom command to the SDL java activity
5 Likes

On Linux, it is not possible to use address sanitizer because of controller sorting commit: Sort controllers by the js* index on Linux · libsdl-org/SDL@7ea1b69 · GitHub

This is not a bug in SDL but it is quite annoying.

In SDL

To sort joysticks, SDL do nested call to scandir():

LINUX_FallbackJoystickDetect() calls scandir() to list files in /dev/input and sorts them with sort_entries().

sort_entries() calls get_event_joystick_index() which calls scandir() to find js* file in /sys/class/input/event%d/device

In Address sanitizer

Address sanitizer stores comparison and sorting functions in global variables:

The inner call to scandir() reset both global variables to NULL, then the second comparison in the outer call of scandir() crash by calling a NULL function pointer.

On Linux, it is not possible to use address sanitizer because of controller sorting commit: Sort controllers by the js* index on Linux · libsdl-org/SDL@7ea1b69 · GitHub

Does Initialise scandir argument by meyraud705 · Pull Request #5518 · libsdl-org/SDL · GitHub fix things?

No, this is a crash in address sanitizer and it should be fixed there. It would nice to have a workaround in SDL in the meantime but I don’t see how to do one.

Some issue reports:

(probably best to respond to those on the issue tracker rather than here).

There is a regression in this release:

When I switch my application to fullscreen the contents of the window do not keep their aspect ratio. They are scaled to fill the whole screen.

My system: iMac early 2009, OS X v10.11.6
Affected application is Previous: https://sourceforge.net/projects/previous/

This problem already existed in earlier version but IIRC it was fixed in 2.0.18.

Hi,

We put SDL v2.0.22 RC1 into our game, works 100%…

M.I.T. open-source project source code is available on GitHub below:
https://github.com/SLNTHERO/TetriCrisis_4_110Percent_A.I._Turbo

Thanks!

Jesse

1 Like

Are you using SDL_RenderSetLogicalSize() to set a specific aspect ratio?

Yes, the size of the renderer is set using SDL_RenderSetLogicalSize(sdlRenderer, width, height);

Are you able to reproduce the problem with the testsprite2 test program?
./testsprite2 --logical 640x480 --resizable
On my M1 mac running macOS 12.3.1, when I press the maximize button, the window expands to a new space and shows the smiley faces scaled up with the correct aspect ratio.

Where can I find the testsprite2 program?

I did more tests and have some additional details:
The problem only occurs, if I run my application with two windows (simulating two screens). Only the main window is affected. The problem also occurs when resizing the window, but it seems to only happen about 1 out of 3 tries. The problem also occurs or disappears if I just move a resized window around. The contents of the window get stretched or jump back to correct aspect ratio.

The problem definitely does not occur with the release version of SDL (2.0.20).

The testsprite2 program is in the test subdirectory.

Can you please enter a bug so we can track this?

Maybe someone else can file the bug for me. Due to my very outdated system I am currently unable to log into Github.

This has been updated with bug fixes for release and has been tagged on GitHub as 2.0.22-RC2:
https://www.libsdl.org/tmp/download-2.0.php

I just tried running
./testsprite2 --logical 640x480 --resizable --windows 2

I wasn’t able to get either window to stretch instead of re-aspect no matter how I dragged, moved, or maximized either window. Can you try it and let us know if you have repro steps?

Is there a binary of the program available anywhere?

The affected application binary can be downloaded here: Dropbox - Previous_2.4.zip - Simplify your life

You can active multiple Windows by adding NeXTdimension boards and selecting All display mode via Display preferences. All required supporting files can be found here: previous / Code / [r1126] /branches/branch_softfloat/src

I’m at the NeXT prompt, but I can’t resize or maximize the window. Can you please send me e-mail at slouken@libsdl.org to continue diagnosing this issue?

This has been updated with bug fixes for release and has been tagged on GitHub as 2.0.22-RC3:
https://www.libsdl.org/tmp/download-2.0.php

This should be ready to go as the final release, so please let us know ASAP if there are any regressions in this build.

Thanks!

There’s a regression of some sort in respect of SDL_SetCursor(). With 2.0.20 my app is changing the cursor shape as I move the mouse over different areas, as it should, but with 2.0.22 it’s not changing. I suspect this is related to a change in the mouse capture behavior (is it possible that when the mouse is captured the cursor shape is locked?).

Edit: If I click the mouse in SDL’s window and then move it over the title bar the cursor shape is not changing back to the pointer as it should, it’s stuck in the shape I selected. This definitely looks to be related to the change in capture behavior.

You should report this at Issues · libsdl-org/SDL · GitHub so that it doesn’t get lost.