[Scummvm-tracker] [ScummVM :: Bugs] #13054: MAC OS X: OPENGLSDL: Maximizing a window doesn’t set SDL_WINDOW_MAXIMIZED flag.

ScummVM :: Bugs trac at scummvm.org
Sun Oct 31 04:19:47 UTC 2021


#13054: MAC OS X: OPENGLSDL: Maximizing a window doesn’t set SDL_WINDOW_MAXIMIZED
flag.
-------------------+----------------------------
Reporter:  macca8  |      Owner:  (none)
    Type:  defect  |     Status:  new
Priority:  normal  |  Component:  Port: Mac OS X
 Version:          |   Keywords:
    Game:          |
-------------------+----------------------------
 Pressing the window title bar’s green button to maximize a window expands
 the window to fill the screen as expected, but registers in the config
 file as window_maximized=false.

 The test in OpenGLSdlGraphicsManager::notifyResize() determines if a
 window is maximized by checking if its SDL_WINDOW_MAXIMIZED flag is set.
 Unfortunately, in macOS, this flag doesn’t always set as expected,
 resulting in the test incorrectly returning false. This appears to be a
 known SDL bug affecting macOS, included as part of [https://github.com
 /libsdl-org/SDL/issues/2561 this SDL bug report] (I’m running macOS
 10.11.6).

 What this does is incorrectly assign the maximized values to the config
 file’s last_window_width/height settings, instead of creating the expected
 last_maximized_width/height entries.

 If a user exits the maximized window other than by clicking the green
 button, the previous values are lost, and the maximized values become the
 default window size. When next entering windowed mode, these values may be
 adjusted further, reducing the window to the maximum size allowable for an
 unmaximized window.

 The good news is that this bug doesn’t interfere with the ability to
 maximize  a window, so the objective here is to modify the test in
 notifyResize() to enable macOS to correctly identify a maximized window.

 I’m no expert here, and there’s probably a simple and obvious way of
 resolving this test (there usually is), however, I’d like to offer a
 couple of suggestions as food for thought, if I may.

 The style of the window when maximized (at least in macOS 10.11.6)
 suggests that the SDL_WINDOW_FULLSCREEN_DESKTOP flag is set. A feature of
 this flag is that it resizes a maximized window to the equivalent of the
 desktop resolution (I’ve confirmed this by checking the config file’s
 entries while maximized), which is always larger than the unmaximized
 window.

 This presents two possible tests:
 - if this flag is only set when the window is maximized, add this flag to
 the existing test, such that if either flag is set (with priority given to
 SDL_WINDOW_MAXIMIZED), the test returns true.
 - alternatively, test if the window’s size equals the desktop resolution,
 which would also return true.

 Hopefully, if this can be resolved, it may address the odd macOS behaviour
 identified by criezy in [https://github.com/scummvm/scummvm/pull/3400 PR
 3400].

 Applies to current daily builds and the 64-bit 2.5.0 release.
-- 
Ticket URL: <https://bugs.scummvm.org/ticket/13054>
ScummVM :: Bugs <https://bugs.scummvm.org>
ScummVM


More information about the Scummvm-tracker mailing list