Skip to content

Commit

Permalink
make -fullscreen work even if no files opened (for #2965)
Browse files Browse the repository at this point in the history
  • Loading branch information
kjk committed Oct 23, 2023
1 parent 7b282d7 commit aa75718
Showing 1 changed file with 16 additions and 7 deletions.
23 changes: 16 additions & 7 deletions src/SumatraStartup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,18 @@ static void OpenUsingDDE(HWND targetHwnd, const char* path, Flags& i, bool isFir
SendMyselfDDE(cmd.Get(), targetHwnd);
}

static void FlagsEnterFullscreen(const Flags& flags, MainWindow* win) {
if (!win) {
return;
}
if (flags.enterPresentation || flags.enterFullScreen) {
if (flags.enterPresentation && win->isFullScreen || flags.enterFullScreen && win->presentation) {
ExitFullScreen(win);
}
EnterFullScreen(win, flags.enterPresentation);
}
}

static MainWindow* LoadOnStartup(const char* filePath, const Flags& flags, bool isFirstWin) {
LoadArgs args(filePath, nullptr);
args.showWin = !(flags.printDialog && flags.exitWhenDone) && !gPluginMode;
Expand All @@ -284,13 +296,7 @@ static MainWindow* LoadOnStartup(const char* filePath, const Flags& flags, bool
if (!win->IsDocLoaded() || !isFirstWin) {
return win;
}

if (flags.enterPresentation || flags.enterFullScreen) {
if (flags.enterPresentation && win->isFullScreen || flags.enterFullScreen && win->presentation) {
ExitFullScreen(win);
}
EnterFullScreen(win, flags.enterPresentation);
}
FlagsEnterFullscreen(flags, win);
if (flags.startView != DisplayMode::Automatic) {
SwitchToDisplayMode(win, flags.startView);
}
Expand Down Expand Up @@ -1325,6 +1331,9 @@ int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR, int) {
goto Exit;
}
}
if (flags.fileNames.Size() == 0) {
FlagsEnterFullscreen(flags, win);
}

if (flags.stressTestPath) {
// don't save file history and preference changes
Expand Down

0 comments on commit aa75718

Please sign in to comment.