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 3404

Summary: [Patch] [Windows] Borderless windows at desktop res resized by OS
Product: SDL Reporter: Ethan Lee <flibitijibibo>
Component: videoAssignee: Ryan C. Gordon <icculus>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2 CC: icculus, veg
Version: HG 2.0   
Hardware: All   
OS: Windows (All)   
Attachments: Avoid GetClientRect and use LPWINDOWPOS for positioning
Working patch, adds WM_WINDOWPOSCHANGING message handler

Description Ethan Lee 2016-08-05 01:32:59 UTC
We're currently in the process of testing the FEZ 1.12 update and found that on Windows, borderless windows at the full desktop res (i.e. not-quite-FULLSCREEN_DESKTOP-fullscreen) get resized and repositioned by the OS behind our backs, resulting in weird-looking windows...

http://veg.by/z/2016-07-20-16-42-40-ee331be2.png

We found that the cause is the WM_WINDOWPOSCHANGED event, and adding a check for upcoming resize events fixes the problem:

https://github.com/renaudbedard/fez-1.12-issues/issues/122#issuecomment-237650931

There's a chance that this affects other window managers in similar ways, but for now we at least have a fix for Windows.
Comment 1 Ethan Lee 2016-08-05 13:50:27 UTC
Quick update on the fix - it seems the problem is specifically with GetClientRect, not necessarily the event:

https://github.com/renaudbedard/fez-1.12-issues/issues/122#issuecomment-237852505

My guess is that the ClientRect being different from the full window size is affecting the position of future SetPositions, even after we've removed the window border. We'll keep looking at this before 1.12 hits.
Comment 2 Ethan Lee 2016-08-05 15:30:51 UTC
Created attachment 2537 [details]
Avoid GetClientRect and use LPWINDOWPOS for positioning

Attached is a patch that avoids GetClientRect as well as ClientToScreen and uses the LPWINDOWPOS lParam to determine window position/size, which appears to fix the issue for us.
Comment 3 Evgeny Vrublevsky 2016-08-05 18:21:51 UTC
Created attachment 2538 [details]
Working patch, adds WM_WINDOWPOSCHANGING message handler

Hi there. I'm the author of previous patch for this issue. Unfortunately, I had misunderstood the MSDN, as the result my previous patch is wrong. More details:
https://github.com/renaudbedard/fez-1.12-issues/issues/122#issuecomment-237920354

New patch is in the attachment.
Comment 4 Ryan C. Gordon 2016-09-30 03:13:43 UTC
(In reply to Evgeny Vrublevsky from comment #3)
> New patch is in the attachment.

This patch is now https://hg.libsdl.org/SDL/rev/3b789a491509, thanks!

--ryan.