Hey Armin, that code analysis you provided really helped me in sorting
out his issue; unfortunately i couldn’t use your patch directly
because i add another view on top of the one created by sdl and so
hitTest either stops touch events or is able to dected events
happening only on the first view (skipping all the subviews of my
So i dug around and found something interesting, that is the uiwindow
frame is somehow cropped at wrong values in sdl_uikitwindow.m; however
why is this needed? after all we own all the surface and despite the
orientation we are currently in we always want to be able to use the
My proposed solution is this:
diff -r 50bf98210aae src/video/uikit/SDL_uikitwindow.m
— a/src/video/uikit/SDL_uikitwindow.m Thu Aug 18 22:43:37 2011 +0200
+++ b/src/video/uikit/SDL_uikitwindow.m Tue Aug 23 02:31:32 2011 +0200
@@ -145,7 +145,7 @@
frame.origin.x = 0;
frame.origin.y = 0;
- [uiwindow setFrame:frame];
- [uiwindow setFrame:[[UIScreen mainScreen]bounds]];
SDL_SendWindowEvent(self->window, SDL_WINDOWEVENT_RESIZED, w, h);
Worked great in my case! Do you think you could try and see if it can
help in your issue?
VittorioOn Sun, May 8, 2011 at 2:24 AM, Armin Ronacher <armin.ronacher at active-4.com> wrote:
Alright, the problem is definitively the view. ?SDL does something
horrible there. ?Things I know so far:
- SDL totally fucks up the view frame. ?It disables auto resizing but
? something still does something in there because the frame of the
? window ends up being different to the frame of the view. ?If the
? frame of the view is “fixed” all becomes worse as now the rendering
? is equally fucked at that point (right side of screen black).
- Whowever wrote that rotation code in SDL had something in mind that
? (no longer?) works as intended. ?It certainly serves/served a purpose
? but without documentation it’s not quite clear what it does.
- Even if it work work as expected, the touch code in SDL would still
? be wrong as it never takes rotations into account.
I came up with a horrible hack that fixes this by doing two things
- Ignore boundaries of views and always returns the only view we have
? in the hitTest of the window.
- Update the touch internals on rotations.
This is the patch:
?http://paste.pocoo.org/show/384923/ [for view]
?http://paste.pocoo.org/raw/384923/ [for donwload]
I totally do not recommend to check this in, but at least it’s a
workaround for the moment. ?I will have to check the history log to see
who came up with the rotation code, maybe something in the log messages
reveals the intent. ?I certainly must be missing something, because from
looking at that code it does not make a lot of sense. ?I can’t imaging
that a misaligned UIView is the intention. ?Right now my idea is that
the badly placed UIView might be an accident and another mistake sortof
fixed that original problem good enough that nobody noticed for a while.
I am quite happy to have a look at that code but I would really need the
input of the original developer to understand why the code is doing
things that way.
SDL mailing list
SDL at lists.libsdl.org