From 4e4a6e569d9f0c5840045d2d825cf3165d9ffe07 Mon Sep 17 00:00:00 2001 From: Pere Pujal i Carabantes Date: Sat, 2 Nov 2019 01:00:16 +0100 Subject: [PATCH] Handling orientation on Android. --- src/tuxpaint.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/tuxpaint.c b/src/tuxpaint.c index c60cc6865..270e6f078 100644 --- a/src/tuxpaint.c +++ b/src/tuxpaint.c @@ -24044,12 +24044,25 @@ static void setup(void) /* Deal with orientation rotation option */ - +#if defined __ANDROID__ + SDL_SetHint(SDL_HINT_ORIENTATIONS, "LandscapeRight"); +#endif + if (rotate_orientation) { if (native_screensize && fullscreen) { +#if defined __ANDROID__ + /* FIXME 2019-11-02: Could this work on every device instead of just Android ones? */ + SDL_SetHint(SDL_HINT_ORIENTATIONS, "Portrait"); + int tmp; + + tmp = WINDOW_WIDTH; + WINDOW_WIDTH = WINDOW_HEIGHT; + WINDOW_HEIGHT = tmp; +#else fprintf(stderr, "Warning: Asking for native screen size overrides request to rotate orientation.\n"); +#endif } else {