Skip to content
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

Fix graphics flickering/stretching on Windows #367

Merged
merged 12 commits into from
Jun 27, 2024

Conversation

NQNStudios
Copy link
Collaborator

@NQNStudios NQNStudios commented Jun 19, 2024

Fixes #366

This bug was unbelievably hard to track down and fix.

I think it was probably caused by a change in SFML's code for handling window resize events on Windows. When we add the menubar to the window by bypassing SFML and using the Windows APIs, SFML now detects that change and shrinks the logical viewport of your window without expanding the window itself to fit the menubar in it.

I updated menuProc() to catch that first unwanted resize event and discard it. I also made the window expand to fit the menubar's additional height, handled for a rare edge case where the menubar needs more than 1 row for its buttons, and made sure the splash screens still render in the right places.

I need to test this on Linux and Mac to make sure it didn't break those.

@NQNStudios
Copy link
Collaborator Author

This doesn't break the Linux behavior.

@NQNStudios
Copy link
Collaborator Author

I checked and this also doesn't break anything on Mac OS.

@NQNStudios
Copy link
Collaborator Author

These changes didn't fix the scenario and character editors, though...

@NQNStudios
Copy link
Collaborator Author

Would be bad practice to leave something broken in the editors when there's a known solution, so I applied the same fix to them and it worked.

@NQNStudios
Copy link
Collaborator Author

I think issue #59 must be related to the same underlying cause (stuffing a menu bar into an SFML window making it squish its effective viewport weirdly). So I might as well see if that's still a problem and try to fix that too.

@NQNStudios
Copy link
Collaborator Author

@CelticMinstrel I'm done fiddling with this one if you don't have any other changes in mind.

@CelticMinstrel
Copy link
Member

I assume you checked that this doesn't break anything on Mac or Linux, right?

@NQNStudios
Copy link
Collaborator Author

NQNStudios commented Jun 26, 2024 via email

@CelticMinstrel CelticMinstrel merged commit c251fee into calref:master Jun 27, 2024
6 checks passed
NQNStudios added a commit to NQNStudios/cboe that referenced this pull request Jul 3, 2024
* DRY, standardized window top offset
* handle_splash_events() handle multiple events per frame
* accurate windows menubar height for multiple rows
* Windows filter a resize event triggered by the menubar
* windows expand small window to fit menubar
* splash screens draw in view rect, not window rect
@NQNStudios NQNStudios deleted the windows-flicker branch September 8, 2024 20:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Windows] Bad graphical flickering in Windowed mode
2 participants