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

Qt: Disable Display Sleep when game is running (Windows) #3008

Merged
merged 1 commit into from Sep 12, 2015
Merged

Qt: Disable Display Sleep when game is running (Windows) #3008

merged 1 commit into from Sep 12, 2015

Conversation

Ryanel
Copy link
Contributor

@Ryanel Ryanel commented Sep 9, 2015

This PR lays the groundwork for Power Management on Game start and end, as well as disables monitor sleeping on Windows. This is only while a game is running, and is re-enabled after it has finished.

@lioncash
Copy link
Member

lioncash commented Sep 9, 2015

Can you please drop the first two commits

@Ryanel
Copy link
Contributor Author

Ryanel commented Sep 9, 2015

I uh, am currently trying to do this. I'm still new to git and pull requests, so sorry for the delay.

@lioncash
Copy link
Member

lioncash commented Sep 9, 2015

No worries

@Ryanel
Copy link
Contributor Author

Ryanel commented Sep 9, 2015

Done.

@Ryanel
Copy link
Contributor Author

Ryanel commented Sep 9, 2015

I uh, don't have any idea how this is failing on arm if the code is only compiled for the Qt Build, and only if it's windows. This change shouldn't impact anything, much less rendering code!

@phire
Copy link
Member

phire commented Sep 9, 2015

That's actually checking for graphical rendering errors, but it plays up sometimes, that's just a false positive.

@Ryanel
Copy link
Contributor Author

Ryanel commented Sep 9, 2015

Ah good c:

@waddlesplash
Copy link
Contributor

'Qt' not 'QT'. And I don't know anything about the Win32 API stuff so I can't really review, sorry.

@Ryanel
Copy link
Contributor Author

Ryanel commented Sep 9, 2015

Basically it signals windows "Hey, I have some content that the person is watching / playing, and I wouldn't like the screen to turn off". It then undo's this. I verified the functionality with MSDN

@archshift
Copy link
Contributor

So if dolphin crashes while a game is playing, what happens? Does the screensaver state return to normal, or is the system stuck in a no-screensaver state?

@Ryanel
Copy link
Contributor Author

Ryanel commented Sep 9, 2015

The command enables a flag on the process. If the process crashes, then there is no flag telling windows what to do. This means that Windows would revert to normal - as there is no process keeping it from sleeping anymore.

void DMainWindow::DisableScreensaver()
{
#ifdef Q_OS_WIN
// TODO: Prevent display from sleeping. This only currently prevents the system from truely sleeping.

This comment was marked as off-topic.

@Ryanel
Copy link
Contributor Author

Ryanel commented Sep 11, 2015

You're correct, DISPLAY_REQUIRED keeps the screen on (it's what video players like VLC use). However, I made a mistake with the comment, which was made when I was using a different method. I can push a commit to fix the comment.

@waddlesplash
Copy link
Contributor

Can you squash your commits and use Qt instead of QT in the first one?

Disables Display Sleeping on Windows on DolphinQt while the game runs,
and re-enables it after the game closes.
@Ryanel
Copy link
Contributor Author

Ryanel commented Sep 11, 2015

Done

@waddlesplash
Copy link
Contributor

LGTM

1 similar comment
@phire
Copy link
Member

phire commented Sep 12, 2015

LGTM

phire added a commit that referenced this pull request Sep 12, 2015
Qt: Disable Display Sleep when game is running (Windows)
@phire phire merged commit ee7285a into dolphin-emu:master Sep 12, 2015
@Ryanel Ryanel deleted the qt-screensaver branch September 12, 2015 08:52
@leoetlino leoetlino modified the milestone: Qt Sep 13, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
6 participants