-
-
Notifications
You must be signed in to change notification settings - Fork 159
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Window.wm_info
#3219
base: main
Are you sure you want to change the base?
Add Window.wm_info
#3219
Conversation
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.
SDL_syswm.h
header is removed in SDL3. The way to access the wm info has also changed, and I believe that also changes what values are exported by the SDL side.
I think that going forward any new API added should be SDL3 style, and any thing in the grey area should not be exported at all.
Alright, good to know. I'll study the new system that SDL3 uses and adjust the Window code for it. I believe I should keep the SDL2 version (unless it has more dictionary keys than sdl3 will support) so it can be added before pygame 3. |
@ankith26 @Starbuck5
|
Perhaps this PR should wait for the "port window to SDL3" PR to be made and merged first |
I suppose that makes sense. Do you need special competence to pull off one of those PRs, or is it just about following the migration guide (and making different codepaths/creating compat macros)? (if so, I could even try to make it, otherwise I'll wait for you or starbuck). :) Almost forgot, do you guys test your PR to actually compile with SDL3 locally, or do you just trust yourselves? About the first option (more likely), how do you do it? My WSL technically counts as linux if that helps |
We do test that the patch compiles on SDL3. It can be done locally, but you have to compile SDL3 from source if you are gonna go the WSL way (don't worry, it's not that hard). BTW, we also have SDL3 CI now that can do the testing on windows+mac+linux. Basically the thing is we are yet to figure how to properly deal with the pixelformat changes uniformly, once that is done we can apply the same strategy everywhere and port the next wave of modules |
Well actually, |
Alright then, nice, thanks |
So even if this code works great on SDL3, why should we expose new API in the SDL2 style? |
We don't have to expose it in a SDL2 style, but the window manager information is very dependent on the os so how would you provide the info without a dictionary? |
Having something called "wm info" is clearly an SDL2 construction. Well, looking at the SDL code you have it looks like they expose it now as properties on the window object itself. |
I have marked as a draft, because with uncertainty about API as well as merge conflicts this is not ready to merge. |
That's true, but each property is going to exist or not based on the OS and window manager. They are not generic properties that belong to almost every window like a position and a size. The dictionary reflects how uncertain the attributes are to exist. plus they are all very low level, so putting them besides common attributes would look "ugly" imo. |
Window manager information and especially the window handle were only accessible to the display module. I feel like you should know the window handle of any window, so I added the property. The return value almost perfectly mimics the display one, but it can change of course since this would be new api.
MRE: