d2phap / ImageGlass

🏞 A lightweight, versatile image viewer
https://imageglass.org
Other
7.5k stars 488 forks source link

Erratic behavior of F11 and F12 #885

Closed skycommand closed 1 year ago

skycommand commented 3 years ago

I've updated this issue to reflect changes in version 8.0.12.8; I decided that updating this topic is better than opening a new issue because the nature of the problem hasn't changed. (Past versions of this message are also available.)

System information:

To Reproduce

Steps to reproduce the behavior:

  1. Prepare a group of images in a folder
  2. Enter the folder
  3. Double-click the first image to launch ImageGlass
  4. Press F11 to enter the full-screen mode
  5. Press F12 to enter the slideshow mode

Expected behavior:

Step 5 must cause the slideshow to start in chromeless full-screen mode

Actual behavior:

Image glass enters the windowed mode before starting the slideshow.

From this point onward, F12 and F11 behave erratically. Sometimes F11 activates the fullscreen mode and other times, it just reduces the window size to a portion of the screen. The F12 key may or may not trigger the slideshow in chromeless full-screen mode.

Screenshots:

N/A

Additional context:

N/A

d2phap commented 3 years ago

Just a note to look back in the future: This is because IG does not support Slideshow mode from startup.

skycommand commented 3 years ago

This is because IG does not support Slideshow mode from startup.

If that was true, I should have been able to work around the problem by waiting for a few seconds. This doesn't seem to be the case.

Anyway, I can't see how that is relevant. Erratic behaviors like this go against the principle of the least astonishment. For a well-organized mind that writes well-organized code, this mustn't be a problem. All you have to do is to approach the subject systematically, by separation of concerns. For instance, you can:

  1. Assign all UI entry points of the slideshow (toolbar, menu, keyboard, etc.) to a method that invokes the slideshow at the load time
  2. Keep track of component loading status via a private boolean field (especially, if the app is multi-threaded)
  3. Have the slideshow method check the boolean field before doing anything
fire-eggs commented 3 years ago

"Start to Fullscreen to Slideshow" goes into windowed mode because the FullScreenMode function always turns off frameless mode, even in this case where we don't want to.

I believe the subsequent "confusion" of F11 and F12 could then be due to the disconnect between the IsFullScreen flag and the actual window state. I.e. after the sequence "Start to Fullscreen to Slideshow", the IsFullScreen flag is ON but IG is actually windowed.

I think it may be necessary for FullScreen / WindowFit / Frameless to be a little smarter about SlideShow [and visa-versa] but I've not worked out all the implications.

d2phap commented 1 year ago

Slideshow mode is supported in ImageGlass Moon 9.0 beta 3 with full screen / windowed mode