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 2255 - SDL_CreateWindow(w=INT_MAX, h=INT_MAX) claims to succeed
Summary: SDL_CreateWindow(w=INT_MAX, h=INT_MAX) claims to succeed
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: video (show other bugs)
Version: HG 2.0
Hardware: x86_64 Linux
: P2 normal
Assignee: Ryan C. Gordon
QA Contact: Sam Lantinga
URL:
Keywords: triage-2.0.4
Depends on:
Blocks:
 
Reported: 2013-11-20 13:25 UTC by Andrew Church
Modified: 2015-04-06 22:26 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Church 2013-11-20 13:25:49 UTC
(related to bug 2176)

In SDL 2.0.1 and HG r8017 on Linux/X11, SDL_CreateWindow() with impossible size arguments nonetheless claims to succeed.  Specifically, both of the following return a non-NULL window pointer:

SDL_CreateWindow("test", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED,
                 INT_MAX, INT_MAX, 0)
SDL_CreateWindow("test", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED,
                 INT_MAX, INT_MAX, SDL_WINDOW_FULLSCREEN)

I can imagine a situation in which the underlying window system returns success in the first case without actually mapping the window, but surely the second case should fail when attempting to set an INT_MAX by INT_MAX display mode?
Comment 1 Adam M. 2014-05-11 01:41:25 UTC
I think the size you pass to SDL_CreateWindow is the size of the window when it's not fullscreen, even if you specify the SDL_WINDOW_FULLSCREEN flag.

SDL_SetWindowDisplayMode is what actually changes the display mode, so I don't think this is a bug. (That said, I'm not terribly happy with the display and window management API. It certainly could be cleaner.)
Comment 2 Ryan C. Gordon 2015-02-19 05:22:18 UTC
Marking a large number of bugs with the "triage-2.0.4" keyword at once. Sorry if you got a lot of email from this. This is to help me sort through some bugs in regards to a 2.0.4 release. We may or may not fix this bug for 2.0.4, though!
Comment 3 Ryan C. Gordon 2015-04-06 22:22:49 UTC
Ok, so part of the problem is that we try to center this window on the display, so it ends up at coordinates like (-1073740863, -1073741223), but XGetWindowAttributes() reports the window size as 65535x65535, so it got clamped somewhere inside the X server (or we simply lost the top 16 bits?).

So in theory, your window exists, but not at the size you want and way way off-screen.

More experimentation suggests that the maximum is more like 16k, and over this size, the X server is prone to crashing.

I'm just putting an artificial clamp in SDL_CreateWindow(). If we ever find out we need more than 16k x 16k windows, we can lift it.

--ryan.
Comment 4 Ryan C. Gordon 2015-04-06 22:26:59 UTC
This is now sanity-checked in https://hg.libsdl.org/SDL/rev/409b20ba3e70.

--ryan.