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 2174 - SDL_SetWindowSize and window size limits
Summary: SDL_SetWindowSize and window size limits
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: video (show other bugs)
Version: HG 2.0
Hardware: All All
: P2 normal
Assignee: Sam Lantinga
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-10-22 21:42 UTC by norfanin
Modified: 2013-11-12 00:23 UTC (History)
0 users

See Also:


Attachments
Simple window size limit testcase. (2.07 KB, text/plain)
2013-10-22 21:45 UTC, norfanin
Details

Note You need to log in before you can comment on or make changes to this bug.
Description norfanin 2013-10-22 21:42:40 UTC
I stumbled over a few issues with the window size limits and would like to ask what the expected behaviour is to get a better overview and before more inconsistencies get added.

- What window types are affected by the window size limits? Fullscreen, fullscreen-desktop, windowed, borderless, maximized, ...?

- Should SDL_SetWindowSize always respect the window size limits set with SDL_SetWindowMinimumSize and SDL_SetWindowMaximumSize?

- There may be system defaults for the limit of the window size. SDL_SetWindowMinimumSize and SDL_SetWindowMaximumSize could be extended to go back to the system default if a value of 0 is passed (which is an invalid value with the current API).

- If the system default for the limit of the window size is something that fits into SDL, should SDL_SetWindowSize respect it?

- Are conflicting limits (minimum is greater than maximum) considered undefined behaviour?

- Should a change of the limits enforce a new window size if the current size is outside of them? The code already does this, but I'll throw it in here anyway.


An example of an issue I spotted is in SDL_SetWindowSize. This function seems to assume that the backend function always succeeds and just overwrites the width and height in the window struct with the requested values. If the backend function fails (perhaps because of the window size limits) the requested values will get reported with the event the SDL_GetWindowSize instead of the actual width and height of the window.
Comment 1 norfanin 2013-10-22 21:45:00 UTC
Created attachment 1393 [details]
Simple window size limit testcase.

This is a simple testcase that tries to make the window bigger than the limits. The window managers enforce the limits, but SDL reports the wrong values.

Happens on Windows and Linux. OS X seems to be handling it correctly.
Comment 2 Sam Lantinga 2013-11-11 01:30:43 UTC
Good catch.  This should be fixed, thanks!
https://hg.libsdl.org/SDL/rev/7c249ca44069
Comment 3 norfanin 2013-11-11 23:56:00 UTC
No comment on my questions? I may be able to point out and propose more stuff if I know the expected behaviour.
Comment 4 norfanin 2013-11-12 00:23:23 UTC
Oh, your commit changed SDL 2's behaviour on Windows so that it now respects the system defaults (in certain situations?). It's not possible to create windows larger than the desktop size anymore.

This was discussed over here, but there's no clear statement about what the expected behaviour is supposed to be.

https://bugzilla.libsdl.org/show_bug.cgi?id=1848