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 3936 - Creating a Renderer creates a new window
Summary: Creating a Renderer creates a new window
Status: RESOLVED WONTFIX
Alias: None
Product: SDL
Classification: Unclassified
Component: *don't know* (show other bugs)
Version: 2.0.7
Hardware: x86_64 Linux
: P2 normal
Assignee: Ryan C. Gordon
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-11-02 14:41 UTC by autrimpo
Modified: 2017-11-22 05:39 UTC (History)
0 users

See Also:


Attachments
Archive containing the mentioned files. (848 bytes, application/gzip)
2017-11-02 14:41 UTC, autrimpo
Details

Note You need to log in before you can comment on or make changes to this bug.
Description autrimpo 2017-11-02 14:41:13 UTC
Created attachment 3055 [details]
Archive containing the mentioned files.

Overview:

Creating a Window and then creating a Renderer actually creates two windows in rapid succession with only the last window "surviving" - this leads to unexpected behaviour with some window managers (e.g. bspwm and the "preselect split" feature don't work correctly).

Steps to Reproduce:

Create a window as described here: https://wiki.libsdl.org/SDL_CreateWindow and call SDL_CreateRenderer() on the window. (See also attached sample source code.)

Actual Results:

Two windows are created.

Expected Results:

Only one window is created.

Build Date & Hardware:

SDL 2.0.7 on Void Linux x86_64 (glibc)
(2.0.7. was not an option in the "Version" field so I picked 2.0.6)

Additional Builds and Platforms:

Also encountered in Arch Linux on all the versions of SDL2 back to Dec 2015.

Additional Information: 

I've logged the output using bspwm's "external rules" feature, which runs a script each time a new window is created.

I've attached a minimal source code that produces the behaviour, output from the external_rules script after launching the compiled code once as well as the external_rules script itself.

Also see this issue for more information (with imv the window actually appeared to be created three times, suggesting that there might be other function calls that do this as well): https://github.com/eXeC64/imv/issues/56
Comment 1 autrimpo 2017-11-02 14:45:14 UTC
Forgot to mention, though it is kind of obvious, that commenting out the SDL_CreateRenderer() call in the example produces the correct behaviour with regard to bspwm (and number of windows being created).
Comment 2 Sam Lantinga 2017-11-02 15:55:55 UTC
This is done when the renderer needs the window to be created with certain OpenGL flags that can't be modified at runtime.
Comment 3 Ryan C. Gordon 2017-11-02 16:13:20 UTC
(Administrative note: added a 2.0.7 version, updated this report.)

--ryan.
Comment 4 autrimpo 2017-11-20 15:26:45 UTC
I see, so if I understand it correctly it's an OpenGL limitation and nothing can be done about it?
Comment 5 Sam Lantinga 2017-11-22 05:39:06 UTC
That's my understanding, yes.