iOS mouse events and touch events behaviour unexpected

Hi, I am building an iOS game, with SDL 2.0.16. I am finding the mouse and touch events I’m getting while running in xcode with target as “My Mac (designed for iPad)” (my computer is an M1 device).

For mouse events, just looking at the x coordinate, I only ever get numbers from 0 to 1024 (inclusive) - according to SDL_GetWindowSize(), my window is 1025 wide (SDL_RenderGetViewport() gives 2050 as the width, and I created my window with SDL_WINDOW_ALLOW_HIGHDPI, so this seems plausible).

However, instead of 0 mapping to the left of my app, and 1025 mapping to the right, I get 0 mapping to something slightly to the right of the left border of the app, and 1025 mapping to somewhere near (but not at) the right border. If I click outside these bounds (e.g. clicking on the far left), then I will get an event with an x coordinate of 0 - and now future events will be given relative to this (and the same sort of thing happens on the right hand side).

If I instead try to use touch events (which I only receive when SDL_HINT_MOUSE_TOUCH_EVENTS=1), I don’t receive SDL_FINGERMOTION events - only SDL_FINGERDOWN and SDL_FINGERUP. Looking at the x coordinate of these, it appears to have the same issues as the mouse events (just scaled down by 1025).

Any hints on what to try would be appreciated.

Andy