Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

macOS: fullscreen toggle does not maintain SDL_Renderer's logical size #2585

Closed
SDLBugzilla opened this issue Feb 11, 2021 · 0 comments
Closed

Comments

@SDLBugzilla
Copy link
Collaborator

This bug report was migrated from our old Bugzilla tracker.

These attachments are available in the static archive:

Reported in version: HG 2.0
Reported for operating system, platform: macOS 10.12, x86_64

Comments on the original bug report:

On 2017-09-02 20:40:31 +0000, David Ludwig wrote:

Created attachment 2906
code for sample application (to reproduce bug with)

On macOS/OSX, toggling between fullscreen and windowed mode via SDL_SetWindowFullscreen calls can cause an app that uses a 'logical screen size', as set via SDL_RenderSetLogicalSize, to not display content correctly.

This bug was -not- present in SDL 2.0.5, but is present in the latest from hg.libsdl.org as of this writing (https://hg.libsdl.org/SDL/rev/11413fa29401). I am not sure which commit triggered this.

Steps to reproduce:

  1. create an SDL_Window in windowed mode
  2. create an SDL_Renderer, using SDL provided defaults
  3. set the SDL_Renderer's logical size to that of the window's size
  4. create and populate a texture, whose size equals that of the SDL_Window, and the SDL_Renderer's logical size
  5. create a game loop, processing events, and displaying the texture in its entirety
  6. add a means to toggle between fullscreen and windowed mode, via calls to SDL_SetWindowFullscreen
  7. run the app
  8. switch to fullscreen, via a call to SDL_SetWindowFullscreen. If using the attached sample code, press 'F' to switch to fullscreen.
  9. switch to windowed mode, via a call to SDL_SetWindowFullscreen. If using the attached sample code, press 'W' to switch to windowed-mode.
  10. observe the contents of the window

Expected result: the entire texture's contents are displayed

Observed result: only a portion of the texture is displayed

Side-observation: the window's position will change, when going back to windowed mode. This was not expected, and may warrant a separate bugzilla case and/or fix

A sample program is attached, with keyboard input potentially leading to SDL_SetWindowFullscreen being called. Specifically, pressing:

  • 'F' will switch to fullscreen
  • 'W' will switch to windowed mode

On 2017-09-02 20:41:46 +0000, David Ludwig wrote:

Created attachment 2907
screenshot of expected result, using attached sample code

On 2017-09-02 20:42:52 +0000, David Ludwig wrote:

Created attachment 2908
screenshot of observed result, using attached sample code

On 2017-09-02 20:59:41 +0000, David Ludwig wrote:

This bug started appearing in changeset 11421 : https://hg.libsdl.org/SDL/rev/f9d5845f2311

On 2017-09-03 21:41:47 +0000, David Ludwig wrote:

Created attachment 2910
possible fix, # 1

Here is a possible fix for this bug. In my own testing (on macOS 10.12), it does not reintroduce the bug (# 3719, https://bugzilla.libsdl.org/show_bug.cgi?id=3719) that changeset 11421 fixed. It also fixes the reopened bug 3719's issue, whereby the SDL window can unexpectedly move, after switching from fullscreen to windowed mode.

Changeset 11421 does not invoke the SDL_Renderer's viewport-updating routines, due in part to [Cocoa_WindowListener windowDidResize:] ceasing to be called (via change 11421).

This change re-introduces the manual call to [Cocoa_WindowListener windowDidResize:], which updates the renderer's viewport, and leaves the window in the expected position.

On 2017-09-04 18:31:25 +0000, Sam Lantinga wrote:

Patch added, thanks!
https://hg.libsdl.org/SDL/rev/f76299105635

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant