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!
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
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.
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.
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.
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).
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?
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?
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.
I’m responding here because Sam asked the question here. I am not knowledgeable enough about SDL2 to report it at GitHub - that’s for developers not users!
The list of changes in 2.0.22 includes “The mouse is now automatically captured when mouse buttons are pressed” so I think that’s highly likely to be related to the regression. It breaks my app (in Windows, anyway), so I couldn’t use 2.0.22 unless it is fixed.
I expect it was missed by the automated test suite because only the visual appearance of the cursor is affected (in Windows, anyway)!