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 5530

Summary: Maximised window with SDL_BORDERLESS_WINDOWED_STYLE hint has edges clipped and overlaps 2nd monitor
Product: SDL Reporter: Jon <jonmortiboy>
Component: videoAssignee: Sam Lantinga <slouken>
Status: NEW --- QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2    
Version: 2.0.14   
Hardware: x86_64   
OS: Windows 10   
Attachments: Screenshot of clipped edge and overlap onto second monitor when maximised

Description Jon 2021-02-04 10:10:20 UTC
Created attachment 4760 [details]
Screenshot of clipped edge and overlap onto second monitor when maximised

Maximising a window created with the SDL_BORDERLESS_WINDOWED_STYLE and SDL_BORDERLESS_RESIZABLE_STYLE hints results in the edges of the drawable region being clipped and some visible overlap on a second monitor.


Steps to Reproduce

1. Set SDL_BORDERLESS_WINDOWED_STYLE and SDL_BORDERLESS_RESIZABLE_STYLE hints
2. Create a window with flags SDL_WINDOW_OPENGL | SDL_WINDOW_BORDERLESS | SDL_WINDOW_RESIZABLE
3. Maximise window through any means (drag-snapping to the top of the screen, double-clicking custom titlebar area, win-up)


Actual Results

The window becomes too large for the monitor it is displayed on with roughly 8px around all edges of the window being cut off.

Additionally, with a dual monitor setup, maximising the window on the rightmost monitor results in a black strip down the side of the other monitor. The overlap appears to be the same width as the strip that is cut off from the edge of the window, and has the same height as the height of the window prior to maximising.


Expected Results

No overlap on the second monitor, and for the client area of the maximised window to be fully within the bounds of the monitor and taskbar with no part of the gl context clipped.


Build Date & Hardware

Tested with SDL 2.0.14 (stable)
Windows 10 Version 10.0.18363 Build 18363


Additional Information

- The monitors are both 1080p, landscape with display scaling set to 100% 
- The rendered content is using a glViewport of (0, 0, win_w, win_h) where win_w and win_h are the values returned by SDL_GetWindowSize
- The width and height returned by SDL_GetWindowSize when maximised is 1936x1056, which is 16px wider than the resolution of the display (and presumably taller than the space between the top of the display and the taskbar)
- I have only tested this on a dual-monitor setup so can't currently be sure if the clipping issue is present for single-monitor setups

I've also attached a screenshot showing the issue.