Ask / Submit

[Request] Support SDL landscape mode

asked 2014-12-12 01:54:15 +0300

smoku gravatar image

updated 2014-12-12 12:18:51 +0300

chemist gravatar image

I have done my share of games and emulator porting for N900. (Widelands, Bos Wars, Open Dune, Robbo, psx4m, uae4all, ...) It was relatively easy - just need to tweak UI here and there to better fit for "invisible mouse cursor".

Recently I wanted to port these to Jolla Phone and stumbled on a real show stopper - Sailfish OS does not support landscape mode for SDL apps.

I know that your "standard" answer is to rotate in software. But that's just PITA. I loved that on Maemo 5 the developer need not to be concerned with the device orientation. The screen dimension change was just signaled and you needed to relayout the application only. (With a cool rotation animation provided by window manager.) Or just request fixed layout to be pinned for your app. No need to rotate your pixmaps manually, translate pointer coordinates and so on. It was coded once and for all on the lower layer and just worked.

I have already spent too much time on rotating just one game and it still has glitches and weird issues. And thinking that I need to redo/reinvent all these work for each and every one pending... I'm sorry, but that just won't happen...

edit retag flag offensive close delete



Hi smoku, would this also help to port ScummVM?

Stephan ( 2014-12-12 09:43:23 +0300 )edit

One way Jolla could fix this is by implementing nested Wayland Compositor. Start a new wayland server that is in landscape mode, draw to it using SDL, rotate and draw to screen. Apps should be able to request landscape only, like described above.

simskog95 ( 2014-12-12 10:14:02 +0300 )edit

@Stephan ScummVM is already ported

smoku ( 2014-12-12 11:19:26 +0300 )edit

My SDL2 game was rejected and I think all the rest of my games will be rejected since I use the same code base for doing the rotation and translation of touch events:

"Your application is coded to landscape mode. This makes the swipe closing gesture not working as it should work from the top of the application. Currently it works from the right side since the application is set on portrait mode and not actually on landscape mode as the UI shows it. This might confuse the Jolla user since swipe gestures are orientating with the screen orientation. Please fix this orientation issue."

hamlatzis ( 2015-03-23 16:02:50 +0300 )edit

Have you posted this issue on sailfish-devel mailing list? I think it could help to discuss it also there.

wanderer ( 2015-03-27 08:01:04 +0300 )edit

1 Answer

Sort by » oldest newest most voted

answered 2015-04-14 21:09:29 +0300

thp gravatar image

I've got the window flags part working locally (so one can rotate client-side, but get volume bar overlay and gestures working correctly for landscape), but will go the "clean" way of getting the changes integrated in upstream's Hg repository first, so we know that some future SDL release will include that API (as soon as it's in upstream's Hg, we can then patch nemomobile's packaging of libsdl to already have that feature available earlier for Sailfish OS):

As for compositor-side rotation, that would be nice as well, maybe we can make it happen via a nested Wayland compositor as simskog95 suggested (in that case, we should make it so that it uses the hwcomposer from the HAL for doing the rotated blits in 2D hardware to not impact GL performance).

@smoku: For your use cases, a solution where an application can opt-in to landscape framebuffer orientation (so the window you get has landscape dimensions and the input events map to that landscape window) would do the trick? Or do you need in-game switching of orientation as well?

edit flag offensive delete publish link more



That's a very good news. :-) For my use cases an option to opt-in for landscape mode with all the magic of translations happening in background is enough.

smoku ( 2015-04-15 01:02:28 +0300 )edit

Why is there a need for nested compositor? All the demos of Weston are big on showing off the ability to rotate windows with transparent input translation. Is lipstick that different?

smoku ( 2015-04-15 02:08:25 +0300 )edit

When are we going to see the new version?

hamlatzis ( 2016-10-31 19:49:00 +0300 )edit

A request was made to pull in this feature on 08-Oct-2016

menounsef ( 2016-11-08 13:15:16 +0300 )edit
Login/Signup to Answer

Question tools



Asked: 2014-12-12 01:54:15 +0300

Seen: 648 times

Last updated: Apr 14 '15