| Summary: | Android: orientation between portrait<->landscape doesn't work | ||
|---|---|---|---|
| Product: | SDL | Reporter: | Trent Gamblin <trent> |
| Component: | video | Assignee: | Sam Lantinga <slouken> |
| Status: | RESOLVED FIXED | QA Contact: | Sam Lantinga <slouken> |
| Severity: | normal | ||
| Priority: | P2 | CC: | rtrussell, sezeroz, sylvain.becker |
| Version: | HG 2.0 | ||
| Hardware: | x86_64 | ||
| OS: | Linux | ||
| Attachments: |
Fix for orientation just working between portrait<->landscape
Documentation fix (Add Android) patch |
||
|
Description
Trent Gamblin
2018-09-03 07:18:10 UTC
Yes, a patch checking for all hints is fine. Thanks! Created attachment 3294 [details]
Fix for orientation just working between portrait<->landscape
Here's a patch. I can change if it's not OK. Thanks.
Created attachment 3295 [details]
Documentation fix (Add Android)
Here's a small documentation fix too. This previously only mentioned iOS so confused me a bit.
Any changes you'd like to see to these patches? I know it's a bit funky, but can't just set orientation to UNSPECIFIED because that's equal to -1 according to Android docs and my testing. If your window is not resizable then you're not actually allowed to set an orientation that changes the display size. What's your use case where this works? The window is resizable. The internal SDL code of the Android driver toggles that flag off for some reason though. I figured it does it for a reason so it was best not to mess with it. See SDL_androidwindow.c line 175. If you meant how does it work with that flag toggled off, honestly I don't know the internals of SDL much but it just works with the same code as on desktops in my game. Created attachment 3356 [details] patch A reworked patch for setting the orientation. it also doesn't keep the RESIZABLE flags. - The hint is used, as documentation states it, to "explicitly control which UI orientations are allowed". - RESIZABLE allows to have both landscape and portrait, provided it's not restricted by the hint. But there is another issue, this time with SDL_WINDOW_FULLSCREEN, because it exchanges w/h and mislead the choice of orientation is nothing is specified. (I think the issue is there: https://hg.libsdl.org/SDL/file/18f3294b230e/src/video/SDL_video.c#l1512 ) This bug seems not to be fixed in SDL 2.0.10. Both patches are effective for me (I don't use the hint), so what is the current status as regards incorporation in a release? Hi Richard: Which one of the 2/3 patches is working for you ? I you don't use the hint, only the part clearing the RESIZEABLE flag should matter ? (In reply to Sylvain from comment #10) > Which one of the 2/3 patches is working for you ? I used your patch because I need the 'full sensor' mode of operation. But since I don't use the hint anyway, most of your code is redundant in my case. > I you don't use the hint, only the part clearing the RESIZEABLE flag should > matter ? I'm not sure, I don't think I tried that. Ok thanks for the feedback ! I've commit the patch: https://hg.libsdl.org/SDL/rev/094b752ee72d (In reply to Sylvain from comment #10) > I you don't use the hint, only the part clearing the RESIZEABLE flag should > matter ? You're absolutely right. I've reverted SDLActivity.java to the original SDL2.0.10 version and orientation changes are still working correctly for me, with the change to SDL_androidwindow.c so it no longer clears the SDL_WINDOW_RESIZABLE flag. I should have tried that change first! So I'm afraid my experience doesn't verify whether your patch is effective, in the presence of the hint. In my application I prefer to set the allowed orientation(s) in AndroidManifest.xml anyway. |