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

Pause rendering when the window is minimized #18670

Merged
merged 1 commit into from
Apr 26, 2021
Merged

Conversation

abcdefg30
Copy link
Member

Closes #18354.

Split from #17837.
Still renders when the window just loses focus.

@pchote
Copy link
Member

pchote commented Oct 6, 2020

Before I start debugging, have you verified that this works as expected on windows?

A quick test on macOS shows that the rendering never restarts after unminimizing the window. Audio works, but the rendering remains frozen on the last frame before minimizing.

@abcdefg30
Copy link
Member Author

Of course. This must be some more macOS weirdness, maybe similar to

if (Platform.CurrentPlatform == PlatformType.OSX)
?

@abcdefg30
Copy link
Member Author

@pchote did you have any luck looking into this or can give me any hints?

@pchote
Copy link
Member

pchote commented Oct 22, 2020

Oops, I forgot about this. Please remind me to look into this on the weekend.

@Mailaender
Copy link
Member

I tested this on Linux. No regressions, but I am also not sure if it actually pauses the renderer. I run OpenRA in window mode.

@abcdefg30 abcdefg30 added this to the Next+1 milestone Nov 6, 2020
@abcdefg30 abcdefg30 force-pushed the minimize branch 3 times, most recently from 368daf6 to 2e8061a Compare April 23, 2021 09:19
@abcdefg30
Copy link
Member Author

abcdefg30 commented Apr 23, 2021

Rebased and updated. I simply disabled this for OSX now.

Copy link
Member

@pchote pchote left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After fixing the events on macOS this has a nice sideeffect of working around the bug where minimized windows don't trigger on vsync, meaning that OpenRA renders at huge FPS eating all your CPU and GPU resources while minimized (not that anybody ever actually uses minimise on macOS...).

OpenRA.Game/Graphics/PlatformInterfaces.cs Outdated Show resolved Hide resolved
OpenRA.Platforms.Default/Sdl2Input.cs Outdated Show resolved Hide resolved
OpenRA.Game/Game.cs Outdated Show resolved Hide resolved
@pchote
Copy link
Member

pchote commented Apr 23, 2021

nit: the comment and PR messages say "Only render the game when the window is maximized" which implies that it doesn't render during regular non-maximized use. Change to "Pause rendering when the window is minimized"?

OpenRA.Game/Renderer.cs Outdated Show resolved Hide resolved
@teinarss
Copy link
Contributor

Works on Win10

@abcdefg30
Copy link
Member Author

Updated.

@abcdefg30 abcdefg30 changed the title Only render the game when the window is maximized Pause rendering when the window is minimized Apr 26, 2021
@pchote pchote merged commit 3276373 into OpenRA:bleed Apr 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

don't render if game minimized or paused
5 participants