From 2b02a7433f5de72f15b66ae072796036422b3b74 Mon Sep 17 00:00:00 2001 From: Gregory Hainaut Date: Sat, 7 Nov 2015 11:03:39 +0100 Subject: [PATCH] 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 --- plugins/onepad/Linux/linux.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/plugins/onepad/Linux/linux.cpp b/plugins/onepad/Linux/linux.cpp index 086cc5cd95..eb2bf793eb 100644 --- a/plugins/onepad/Linux/linux.cpp +++ b/plugins/onepad/Linux/linux.cpp @@ -160,6 +160,16 @@ void PollForJoystickInput(int cpad) 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 // pads -- Gregory for (int cpad = 0; cpad < 2; cpad++) {