From 7b73a5cab0ffc0107a33febe8548b339e4bff42e Mon Sep 17 00:00:00 2001 From: "U-Q7X\\z" Date: Sun, 13 May 2018 20:51:12 +0800 Subject: [PATCH] No mouse activatives no send data Do not send input every 16ms when there is no mouse activatives. Although current windows version filtered SetCursorPos() param with x=0 and y=0 condition,call it twice will return error code 87. But raw SendInput() will not check that, system never go sleep. --- Windows/Gopher/Gopher.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Windows/Gopher/Gopher.cpp b/Windows/Gopher/Gopher.cpp index 32b47f0..1826057 100644 --- a/Windows/Gopher/Gopher.cpp +++ b/Windows/Gopher/Gopher.cpp @@ -537,7 +537,10 @@ void Gopher::handleMouseMovement() y -= dy; _yRest = y - (float)((int)y); - SetCursorPos((int)x, (int)y); //after all click input processing + if ((int)x && (int)y) // Do not send input every 16ms when there is no mouse activatives + { + SetCursorPos((int)x, (int)y); //after all click input processing + } } // Description: