]> git.sesse.net Git - nageru/commitdiff
Add a mode to run in full screen.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Sat, 2 Jun 2018 08:07:19 +0000 (10:07 +0200)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Sat, 2 Jun 2018 08:07:19 +0000 (10:07 +0200)
I wondered if it should be full screen, full-screen or fullscreen,
but VLC uses the option --fullscreen, and it's good to be consistent
with that.

Adapted from a patch by Yoann Dubreuil.

flags.cpp
flags.h
mainwindow.cpp

index cd648b9d1ec53eff80a8185763b8131ca8cae550..9b3a9dac7f302de31f315154f85f0236b301545b 100644 (file)
--- a/flags.cpp
+++ b/flags.cpp
@@ -14,6 +14,7 @@ Flags global_flags;
 // Long options that have no corresponding short option.
 enum LongOption {
        OPTION_HELP = 1000,
+       OPTION_FULLSCREEN,
        OPTION_MULTICHANNEL,
        OPTION_MIDI_MAPPING,
        OPTION_DEFAULT_HDMI_INPUT,
@@ -73,6 +74,9 @@ void usage(Program program)
        }
        fprintf(stderr, "\n");
        fprintf(stderr, "      --help                      print usage information\n");
+       if (program == PROGRAM_NAGERU) {
+               fprintf(stderr, "      --fullscreen                run in full screen, with no decorations\n");
+       }
        fprintf(stderr, "  -w, --width                     output width in pixels (default 1280)\n");
        fprintf(stderr, "  -h, --height                    output height in pixels (default 720)\n");
        if (program == PROGRAM_NAGERU) {
@@ -163,6 +167,7 @@ void parse_flags(Program program, int argc, char * const argv[])
 {
        static const option long_options[] = {
                { "help", no_argument, 0, OPTION_HELP },
+               { "fullscreen", no_argument, 0, OPTION_FULLSCREEN },
                { "width", required_argument, 0, 'w' },
                { "height", required_argument, 0, 'h' },
                { "num-cards", required_argument, 0, 'c' },
@@ -473,6 +478,9 @@ void parse_flags(Program program, int argc, char * const argv[])
                        global_flags.ycbcr_interpretation[card_num] = interpretation;
                        break;
                }
+               case OPTION_FULLSCREEN:
+                       global_flags.fullscreen = true;
+                       break;
                case OPTION_HELP:
                        usage(program);
                        exit(0);
diff --git a/flags.h b/flags.h
index 1cd2755b9641600db4d35f594a73ddef29252bab..09337d13b9e12513d307e395dd9cd1bf8c4f42ae 100644 (file)
--- a/flags.h
+++ b/flags.h
@@ -66,6 +66,7 @@ struct Flags {
        int x264_bit_depth = 8;  // Not user-settable.
        bool use_zerocopy = false;  // Not user-settable.
        bool can_disable_srgb_decoder = false;  // Not user-settable.
+       bool fullscreen = false;
 };
 extern Flags global_flags;
 
index b20e3222cda213e1cc994f128996aa5a5cf90975..b542c1093243dc15af5ae006c0b274b5e9c06352 100644 (file)
@@ -301,6 +301,9 @@ MainWindow::MainWindow()
        }
        midi_mapper.refresh_highlights();
        midi_mapper.refresh_lights();
+       if (global_flags.fullscreen) {
+               QMainWindow::showFullScreen();
+       }
 }
 
 void MainWindow::resizeEvent(QResizeEvent* event)