- Notifications
You must be signed in to change notification settings - Fork3.8k
"SDL_CreateWindowFrom" in "display" module#2981
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
if the environment variable "SDL_WINDOWID" is set, use "SDL_CreateWindowFrom" to create the window in "display.set_mode"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Thanks for the PR! 🎉
I can't really provide an in-depth review because I'm not too experienced around display.c myself, but at a glance I noticed
atollcan return 0 when no conversion happens. IG in that case,SDL_CreateWindowshould be called- SDL_CreateWindowFrom docs mention
In some cases (e.g. OpenGL) and on some platforms (e.g. Microsoft Windows) the hint SDL_HINT_VIDEO_WINDOW_SHARE_PIXEL_FORMAT needs to be configured before using SDL_CreateWindowFrom().
So I wonder how we should be handling this
illume left a comment• edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Thank you very much. This is an important backwards compatibility fix.
Ankith already mentioned that atol can return an error.
- Additionally, I wanted to ask about 32bit and 64bit windows... Is atol (long long?) the correct call to make on both 32/64 bit architectures?
python3 setup.py formatCI is failing because clang-format needs to be run on the C code.
I see there is test code here:#1574 (comment) |
The return type of |
Revisiting this PR, I believe As mentioned above, like if (!window_handle) {/* NULL window_handle can segfault when *window_handle executes */window_handle="";}longwindow_id=atol(window_handle);if (!window_id&&*window_handle!='0') {/* window_id is 0 when atol errors. It can also be 0 when the input was 0 */returnRAISE(pgExc_SDLError,"'SDL_WINDOWID' must be an integer");} As illume pointed above, it would be good to test this change on 32 bit and 64 bit windows, bonus points if this can be put in a unit test ;) |
@Rabbid76 are you still interested in finishing this off? It has been a while, so we could find someone else to take this over to get it into 2.1.3. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
👍 Thanks
"SDL_CreateWindowFrom" in "display" module
the environment variable "SDL_WINDOWID" is set, use "SDL_CreateWindowFrom" to create the window in "display.set_mode"
Using 'SDL_WINDOWID' does not embed pygame display correctly into another application #1574