Ruben2776 / PicView

Fast, free and customizable image viewer for Windows 10 and 11.
https://picview.org
Other
1.02k stars 67 forks source link

Can't Exit Fullscreen with No Image #141

Closed Yevrag35 closed 6 months ago

Yevrag35 commented 6 months ago

Describe the bug

When you go fullscreen with no image loaded you are unable to revert the window back to normal. Only way around as I can see is closing the app and reopening.

To Reproduce

Tested in 2.2.3 build as well as the latest dev branch commit, and the issue is present in both. The issue does not occur in version 2.2.2 or earlier.

Steps to reproduce the behavior:

  1. Open the app with no image loaded (i.e. - it just shows the PicView logo in the background).
  2. Enter fullscreen either by:
    • Clicking the fullscreen button at the top menu bar
    • Pressing the default key bound to the fullscreen functionality (default is F11/F12)
  3. You find that pressing the key bindings F11/F12 do not put the window back to normal size and the top menu buttons are gone (though, as I'll explain, they wouldn't help either).

Expected behavior

Pressing the fullscreen key binding again should revert the window back to normal as it does when an image is being displayed.

Additional context

Debugging the code, and in particular, when you get to this line, because GetMainWindows.MainImage.Source is null and gotoFullscreen is false, it enters the Restore_From_Move() method.

It seems like it may be unintentionally going into that method, because after the routine is finished, some pieces of settings think you reverted the window back to normal successfully, when it hasn't.

Not saying that removing this bit is the fix, but...

if (GetMainWindow.MainImage.Source is null && !gotoFullscreen)
{
    Restore_From_Move();
    return;
}

... commenting it out does allow the window to revert back to normal as you would expect. I'm not sure what the reasons for that Restore_From_Move() are, but I think it's going to that method unintentionally.

Ruben2776 commented 6 months ago

Hi there, thanks for your bug report!

The initial context for the code you've linked was behavior where it wasn't intended to enter into full-screen when no image was provided. I've since then fixed the issue, as you've highlighted, and changed it to support starting the program in full-screen, whether it has been started with an image or not.

Ruben2776 commented 6 months ago

The changes has been added in the 2.2.4 release.