onepad: reset the screen saver every 4096 Vsync

I didn't put the code in PCSX2 because it requires the display pointer.
And I'm afraid of multithread issue.

Related to issue #942
This commit is contained in:
Gregory Hainaut 2015-11-07 11:03:39 +01:00
parent 83d578f39a
commit 2b02a7433f
1 changed files with 10 additions and 0 deletions

View File

@ -160,6 +160,16 @@ void PollForJoystickInput(int cpad)
EXPORT_C_(void) PADupdate(int pad) EXPORT_C_(void) PADupdate(int pad)
{ {
// Gamepad inputs don't count as an activity. Therefore screensaver will
// be fired after a couple of minute.
// Emulate an user activity
static int count = 0;
if ((count & 0xFFF) == 0) {
// 1 call every 4096 Vsync is enough
count++;
XResetScreenSaver(GSdsp);
}
// Actually PADupdate is always call with pad == 0. So you need to update both // Actually PADupdate is always call with pad == 0. So you need to update both
// pads -- Gregory // pads -- Gregory
for (int cpad = 0; cpad < 2; cpad++) { for (int cpad = 0; cpad < 2; cpad++) {