I have 2 problems with SDL_GetWindowSafeAreareturning wrong results, possibly related.
First on iPadOS when I rotate the iPad from portrait to landscape and my resize event handler calls SDL_GetWindowSafeArea, the values returned are for the unrotated (portrait oriented) device:
resize: w_width = 2752, w_height = 2064, event.width = 2752, event.height = 2064, sRA.w = 2062, sRA.h = 2648, sRA.x = 0, sRA.y = 64
The first width & height are those set for the app by the resize handler. The second are the values in the event. The remainder are the values returned by SDL_GetWindowSafeArea multiplied by the value returned by SDL_GetWindowDisplayScale, except 1 is subtracted from the returned width in an attempt to work around the second problem.
The second problem is that when dragging to resize the app on macOS the returned width and height are a few pixels off from those in the event. In this case, WSA.x = WSA.y = 0 as there is nothing to protect. I have seen as much as 30 pixels difference.
The documentation says the function must be called from the main thread. On macOS I have a main loop calling SDL_PumpEvents() so the handler should be called by the main thread. On iPadOS, there is no main, so I suppose that event handler is called by some other thread and that may be the cause of the problem there.
I need the information at resize time to re-prepare a bunch of Vulkan stuff used by a text overlay renderer which must render in the safe area. If it is invalid to call SDL_GetWindowSafeAreain the event handler, how best to handle this?