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

Cocoa - Incorrect window size when leaving fullscreen #2518

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

Cocoa - Incorrect window size when leaving fullscreen #2518

SDLBugzilla opened this issue Feb 11, 2021 · 0 comments

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: 2.0.5
Reported for operating system, platform: Mac OS X 10.10, x86_64

Comments on the original bug report:

On 2017-07-29 15:04:08 +0000, wrote:

Created attachment 2812
Minimal test case

When exiting a "fullscreen space" on OS X, windows don't go to their defined "windowed mode size", but go back to their previous size.

Steps to reproduce:

  1. Create a windowed mode SDL window
  2. Toggle it to fullscreen with the SDL_WINDOW_FULLSCREEN_DESKTOP flag
  3. While in fullscreen, change the windowed mode size using SDL_SetWindowSize
  4. Toggle the window back to windowed mode

Expected result:

  • The window has the size specified during step 3.

Actual result:

  • The window has the size specified when creating the window in step 1.

Attached is a minimal reproduction test case.
The attached test case works as expected on X11 and Windows.

On 2017-07-29 15:04:49 +0000, wrote:

Downstream bug report:
https://bugs.scummvm.org/ticket/9971

On 2017-08-09 05:25:36 +0000, Ryan C. Gordon wrote:

(Sorry if you get a lot of copies of this email, we're touching dozens of bug reports right now.)

Tagging a bunch of bugs as target-2.0.6.

This means we're in the final stretch for an official SDL 2.0.6 release! These are the bugs we really want to fix before shipping if humanly possible.

That being said, we don't promise to fix them because of this tag, we just want to make sure we don't forget to deal with them before we bless a final 2.0.6 release, and generally be organized about what we're aiming to ship. After some debate, we might just remove this tag again and deal with it for a later release.

Hopefully you'll hear more about this bug soon. If you have more information (including "this got fixed at some point, nevermind"), we would love to have you come add more information to the bug report when you have a moment.

Thanks!
--ryan.

On 2017-08-30 04:42:55 +0000, Sam Lantinga wrote:

Fixed, thanks!
https://hg.libsdl.org/SDL/rev/f9d5845f2311

On 2017-08-30 18:50:00 +0000, wrote:

Thanks.

The window is now resized to its specified size, but it moves to the top left corner of the screen. That is unexpected because neither the user nor the program moved it there. Test program attached (the same one as before).

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

This should be fixed by David Ludwig's patch:
https://hg.libsdl.org/SDL/rev/f76299105635

On 2017-09-04 19:24:51 +0000, wrote:

Unfortunately the window still moves to the top left corner of the screen after resizing: https://www.youtube.com/watch?v=T1s0nEvWzrE

On 2017-09-04 20:31:06 +0000, David Ludwig wrote:

Odd. I had the window-move bug reproduce for me at one point. I am no longer able to, even when I revert the patch that I applied, and when I revert to just-before the initial patch.

On 2017-09-04 20:37:49 +0000, David Ludwig wrote:

Correction: I am unable to reproduce the window-move bug when using SDL just-after the initial patch was applied, in addition to just-before and just-after my followup patch (which targeted a separate bug).

This is on macOS 10.12.6, Xcode 8.3.3, and the macOS 10.12 SDK, compiling both the attached code, as well as one of my own test apps.

Might the window-move bug be system specific?

On 2017-09-04 21:53:01 +0000, Sam Lantinga wrote:

I'm not seeing this either, using the minimal test case you provided. Can you check the window origin here and make sure it's not 0?
/* Restore windowed size and position in case it changed while fullscreen */
{
NSRect rect;
rect.origin.x = window->windowed.x;
rect.origin.y = window->windowed.y;
rect.size.width = window->windowed.w;
rect.size.height = window->windowed.h;
ConvertNSRect([nswindow screen], NO, &rect);

        s_moveHack = 0;
        [nswindow setContentSize:rect.size];
        [nswindow setFrameOrigin:rect.origin];
        s_moveHack = SDL_GetTicks();
    }

On 2017-09-05 04:57:53 +0000, wrote:

Using the attached test case :
window->windowed.x: 0
window->windowed.y: 22

Those values come from a "windowDidMove" callback that is received while leaving fullscreen (before trying to resize the window).

This is using OSX 10.10.5.

On 2017-09-05 10:12:55 +0000, Sam Lantinga wrote:

Thanks, I can reproduce this in a VM running OSX 10.10.

On 2017-09-09 17:32:44 +0000, Sam Lantinga wrote:

Fixed, thanks!
https://hg.libsdl.org/SDL/rev/05aa6d232dca

On 2017-09-09 17:58:54 +0000, Sam Lantinga wrote:

The fix for this bug introduced bug 3809, so I'm backing it out for SDL 2.0.6 release, until we have a chance to properly handle maximize/restore transitions.

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

2 participants