From e5a0d3dfb676087bdcef4c82876234782e46604c Mon Sep 17 00:00:00 2001 From: "Steinar H. Gunderson" Date: Sat, 2 Jun 2018 10:07:19 +0200 Subject: [PATCH] Add a mode to run in full screen. 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 | 8 ++++++++ flags.h | 1 + mainwindow.cpp | 3 +++ 3 files changed, 12 insertions(+) diff --git a/flags.cpp b/flags.cpp index cd648b9..9b3a9da 100644 --- 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 1cd2755..09337d1 100644 --- 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; diff --git a/mainwindow.cpp b/mainwindow.cpp index b20e322..b542c10 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -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) -- 2.39.2