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 4018

Summary: [Patch] Implement SDL_GetWindowBordersSize() under Windows/Win32/WinAPI
Product: SDL Reporter: Ismael Ferreras Morezuelas (Swyter) <swyterzone+sdl>
Component: videoAssignee: Sam Lantinga <slouken>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: major    
Priority: P2 CC: swyterzone+sdl
Version: HG 2.0   
Hardware: All   
OS: Windows (All)   
Attachments: swy-sdl2-win32-getwindowborderssize.diff

Description Ismael Ferreras Morezuelas (Swyter) 2017-12-31 19:46:20 UTC
Created attachment 3122 [details]
swy-sdl2-win32-getwindowborderssize.diff

As a new year gift I have implemented the Windows version of SDL_GetWindowBordersSize(). I needed it for auto-selecting a cozy window size for the game I'm currently working on and noticed that it only worked under X11, so I thought it could be a good excuse to contribute back more stuff. The Mercurial patch is attached as a .diff file. Let me know what you think.

Happy 2018 to all the SDL2 devs and users!

--

PS: Keep in mind that Windows 10 includes the 8px invisible grip borders as part of the frame. There's a way of detecting if Aero/DWM is being used and ask only for the visible rect, but I believe that GetWindowRect() is doing that for a reason and working as intended, so I haven't changed it. (See [2])


References:
[1]: http://www.firststeps.ru/mfc/winapi/r.php?72
[2]: https://stackoverflow.com/a/34143777/674685
[3]: https://stackoverflow.com/a/431548/674685
[4]: https://wiki.libsdl.org/SDL_GetWindowBordersSize
Comment 1 Sam Lantinga 2018-01-03 18:52:16 UTC
Added, thanks!
https://hg.libsdl.org/SDL/rev/16dbfcc5e455

Happy New Year! :)