Page MenuHome

Fix T85768: Win32 Full-Screen Owned Windows
ClosedPublic

Authored by Harley Acheson (harley) on Feb 19 2021, 4:00 AM.

Details

Summary

I promise the following will make perfect sense, even though it might seem a bit disconnected from the reported error. That error was that Window / New Window could not be made fullscreen with wm.window_fullscreen_toggle. In a nutshell this is because this type of window was being incorrectly seen as a "dialog", and the act of doing fullscreen also trashes the window styles.

To back up a bit. a lot of our code passes around a Boolean to indicate the intent that a window will be shown dialog-like, which for Blender is considered a parented window that cannot be resized, minimized or maximized. But note that we have NEVER made such a thing. None of our windows have this set, even though I have spent time correcting how it is implemented as that was interfering with creating owned windows on Windows.

So when you look down these changes the first thing you will find is that for the first time we finally can have a different look for a window when "dialog" is true. So just a few new lines. When set you get a window like the following:

The next change rips out a lot of code from getState(), as It looks like someone struggled with this 10 years ago. Basically just returns GHOST_kWindowStateNormal in most cases, GHOST_kWindowStateMinimized if IsIcon, and if isZoomed returns GHOST_kWindowStateMaximized if there is a caption (titlebar) or GHOST_kWindowStateFullScreen if not.

The sibling to this is setState(), and that is also cleaned up. The central problem here is that it is setting new window styles for each state. Instead this just gets the existing style and modifies it. Therefore the only real change is that with GHOST_kWindowStateFullScreen we remove the caption, and ensure it is there in all other states. No need for SetWindowPos since we are not altering anything requiring it anymore (no change in frame style).

The very last change is for isDialog(). The current test is for something far too common and used in non-dialogs: WS_POPUPWINDOW. So this is changed to test for maximize button as you never want that on a dialog.

That's it. Now we can make Dialogs when we want (if ever) and any window that can be maximized can also be full-screen if wanted.

Diff Detail

Repository
rB Blender

Event Timeline

Harley Acheson (harley) requested review of this revision.Feb 19 2021, 4:00 AM
Harley Acheson (harley) created this revision.
Harley Acheson (harley) edited the summary of this revision. (Show Details)Feb 19 2021, 6:31 PM

Rather than trying to heuristically determine is something is a dialog isn't this we could just store and query?

@Ray Molenkamp (LazyDodo) - Rather than trying to heuristically determine is something is a dialog isn't this we could just store and query?

Good point. Like this?

Oh, that cleans up nicely!

This revision is now accepted and ready to land.Feb 22 2021, 5:03 PM