We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 2067 - Window size limit calculation issue when exiting fullscreen on Windows
Summary: Window size limit calculation issue when exiting fullscreen on Windows
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: video (show other bugs)
Version: HG 2.0
Hardware: All Windows (All)
: P2 normal
Assignee: Sam Lantinga
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-08-28 10:32 UTC by norfanin
Modified: 2013-11-10 22:10 UTC (History)
2 users (show)

See Also:


Attachments
Small testcase that shows a resize issue when exiting fullscreen. (2.05 KB, text/plain)
2013-08-28 10:32 UTC, norfanin
Details

Note You need to log in before you can comment on or make changes to this bug.
Description norfanin 2013-08-28 10:32:11 UTC
Created attachment 1308 [details]
Small testcase that shows a resize issue when exiting fullscreen.

When making a non-resizable window exit fullscreen (more specifically this was noticed SDL_WINDOW_FULLSCREEN_DESKTOP), the Windows function SetWindowPos generates a WM_GETMINMAXINFO event and SDL calculates a minimum and maximum size which seems to be wrong.

http://hg.libsdl.org/SDL/file/e8916fe9cfc8/src/video/windows/SDL_windowsevents.c#l415

It gets the old width and height (the fullscreen size in this case) of the window, adjusts it for the window style and then uses those values as the limit for non-resizable windows. This obviously prevents any resizing in this case.

The WM_GETMINMAXINFO is apparently only generated for some of the Windows window styles.

Why does the code change the values of the MINMAXINFO structure when there are no limits set by the user? Why does it touch the values for maximized windows at all? If I'm understanding it correctly, those are not of interest if it's not a resizable window.

Perhaps it should do something similar like it already does for resizable windows?

Attached is a small testcase. After toggling out of fullscreen, the window size stays at the fullscreen size and not the expected 640x480.
Comment 1 norfanin 2013-08-28 10:33:03 UTC
Hey, attaching the file worked! :)
Comment 2 buckyballreaction 2013-10-22 14:34:54 UTC
This happens on OSX as well; but strangely, not in Linux.  

Also see bug #1962 that I opened on this issue earlier.
Comment 3 Alex Szpakowski 2013-10-22 14:35:44 UTC
It doesn't happen in OS X.
Comment 4 buckyballreaction 2013-10-22 14:43:28 UTC
I just confirm similar behavior on OSX 10.6 (with SDL 2.0.0):  exiting fullscreen will send a resize command to make the window the maximum dimensions on the desktop it can be (with the window decorations), even if the previous window size was really small.

Perhaps the code path is different, but the effect is the same.
Comment 5 Alex Szpakowski 2013-10-22 14:44:34 UTC
There were several OS X-specific bugs related to switching out of fullscreen fixed already for 2.0.1. Can you test with that please? :)
Comment 6 buckyballreaction 2013-10-22 15:16:19 UTC
just verified in rev. cee8a400dc51 on OSX 10.6.  Same behavior.  However my application needs to respond to external window size changes (e.g. being resized by the user).

I'll continue my responses in my bug as it might be different than this, even though behavior is similar (and this Windows-only).
Comment 7 Alex Szpakowski 2013-10-22 15:48:34 UTC
buckyballreaction: I cannot reproduce this myself on either Mac OS 10.8 or Mac OS 10.6. It works fine for me. Are you using the code attached in this issue report to test?
Comment 8 Sam Lantinga 2013-11-10 22:10:53 UTC
Fixed, thanks!
https://hg.libsdl.org/SDL/rev/7c249ca44069