From 3572c30937fa4d6f009683d91438a37e7adb6ec8 Mon Sep 17 00:00:00 2001
From: William Kendrick
orient=portraitSwaps the width/height options given to Tux Paint, useful for + rotating the window on portait displays, such as a tablet PC that's + in tablet orientation. +
native=yesWhen running Tux Paint in fullscreen mode, this @@ -867,6 +874,7 @@ New Breed Software
--fullscreen
--WIDTHxHEIGHT
+ --orient=portrait
--native
--startblank
--nosound
@@ -904,6 +912,7 @@ New Breed Software
--windowed
--800x600
+ --orient=landscape
--startlast
--sound
--quit
diff --git a/src/tuxpaint.c b/src/tuxpaint.c
index ccd0f2a57..403e78d01 100644
--- a/src/tuxpaint.c
+++ b/src/tuxpaint.c
@@ -808,7 +808,7 @@ static int fullscreen, native_screensize, disable_quit, simple_shapes,
no_button_distinction,
mirrorstamps, disable_stamp_controls, disable_save, ok_to_use_lockfile,
alt_print_command_default, scrolling = 0,
- start_blank, autosave_on_quit;
+ start_blank, autosave_on_quit, rotate_orientation;
static int want_alt_printcommand;
static int starter_mirrored, starter_flipped, starter_personal;
static int recording, playing;
@@ -5312,7 +5312,7 @@ static void show_usage(FILE * f, char *prg)
"Usage: %s {--usage | --help | --version | --copying}\n"
"\n"
" %s [--windowed | --fullscreen]\n"
- " %s [--WIDTHxHEIGHT | --native]\n"
+ " %s [--WIDTHxHEIGHT | --native] [--orient=ORIENTATION]\n"
" %s [--startblank | --startlast ]\n"
" %s [--sound | --nosound] [--quit | --noquit]\n"
" %s [--print | --noprint] [--complexshapes | --simpleshapes]\n"
@@ -6050,6 +6050,7 @@ static void setup(int argc, char *argv[])
fullscreen = 0;
#endif
native_screensize = 0;
+ rotate_orientation = 0;
noshortcuts = 0;
dont_do_xor = 0;
keymouse = 0;
@@ -6283,6 +6284,14 @@ static void setup(int argc, char *argv[])
{
native_screensize = 1;
}
+ else if (strcmp(argv[i], "--orient=portrait") == 0)
+ {
+ rotate_orientation = 1;
+ }
+ else if (strcmp(argv[i], "--orient=landscape") == 0)
+ {
+ rotate_orientation = 0;
+ }
else if (strcmp(argv[i], "--nooutlines") == 0)
{
dont_do_xor = 1;
@@ -6909,6 +6918,23 @@ static void setup(int argc, char *argv[])
SDL_ShowCursor (SDL_DISABLE);
+ /* Deal with orientation rotation option */
+
+ if (rotate_orientation)
+ {
+ if (native_screensize && fullscreen)
+ {
+ fprintf(stderr, "Warning: Asking for native screen size overrides request to rotate orientation.\n");
+ }
+ else
+ {
+ int tmp;
+ tmp = WINDOW_WIDTH;
+ WINDOW_WIDTH = WINDOW_HEIGHT;
+ WINDOW_HEIGHT = tmp;
+ }
+ }
+
/* Deal with 'native' screen size option */
if (native_screensize)