topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Sunday December 15, 2024, 11:47 am
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: IDEA: screensaver / monitor timeouts to IGNORE small mouse jitters  (Read 8415 times)

kaon

  • Supporting Member
  • Joined in 2008
  • **
  • Posts: 4
    • View Profile
    • Donate to Member
Background:
When Windows detects no keyboard/mouse activity for the set number of minutes, it starts the starts screensaver or signals the monitor to go into powersave mode.

Problem statement:
We do not want the OS the wake the monitor up in response to unintended mouse movements or optical mouse jitters that plague low-cost mouses.

Suggestion:
We need to modify or hook into the way the OS wakes the monitor up. Ignore movements of less than N pixels, or movements that are not smoothly continuous for at least M milliseconds.
Alternatively, is there a way in WinXP to tell the OS to ignore mouse inputs altogether, when in screensaver mode?

Extra credit:
As much as possible, power down that energy-sucking 3D graphics card when in monitor is in powersaving mode.

PS: Thank you for monoff.exe

skrommel

  • Fastest code in the west
  • Developer
  • Joined in 2005
  • ***
  • Posts: 933
    • View Profile
    • 1 Hour Software by skrommel
    • Donate to Member
 :) Here's Jiggle!

It prevents small mouse movements from stopping the screensaver.

Skrommel

;Jiggle.ahk
; Prevents small mouse movements from stopping the screensaver
;Skrommel @ 2008

#SingleInstance,Force
#Persistent,On
SetBatchLines,-1

SetTimer,CHECKSCREENSAVER,1000
Return


CHECKSCREENSAVER:                     ;is the screensaver running
  oldactive:=active
  VarSetCapacity(active,4,0)
  DllCall("user32.dll\SystemParametersInfo","uint",0x0072,"uint",0,"uint*",active,"uint",0) ; SPI_GETSCREENSAVERRUNNING = 0x0072 
  If active>0                         ;yes, lock the mouse
    hHookKeybd:=DllCall("SetWindowsHookEx",Int,14,Uint,RegisterCallback("CHECKMOUSEMOVE","F"),UInt
               ,DllCall("GetModuleHandle",UInt,0),UInt,0)  ; WH_MOUSE_LL = 14
  Else
  If oldactive=1                      ;no, check if it has run, if so, stop watching the mouse
    Reload
Return


CHECKMOUSEMOVE(nCode,wParam,lParam)
{
   Global blockMouse
   Global counter
   
   If A_TimeIdlePhysical<1000          ;has the system not been idle
   {
     counter+=1
     If counter>100                     ;has it not been idle repeatedly
     {
       blockMouse=0                    ;start forwarding the mouse messages
       counter=0
     }
   }
   Else
   {
     blockMouse=1                      ;stop forwarding the mouse messages
     counter=0
   }
   ToolTip,%A_TimeIdlePhysical%-%counter%-%blockmouse%
   Return blockMouse ? 1 : DllCall("CallNextHookEx",UInt,0,Int,nCode,UInt,wParam,UInt,lParam)
}
« Last Edit: June 14, 2008, 09:14 AM by skrommel »

kaon

  • Supporting Member
  • Joined in 2008
  • **
  • Posts: 4
    • View Profile
    • Donate to Member
:) Here's Jiggle!

It prevents small mouse movements from stopping the screensaver.

Skrommel

(EDIT: removed Skrommel's first version, since he his latest is in his first post)
Impressive, thanks!
There was a run time error about line 40, so I moved up line 41 and there was no more error message.
So I was testing it, and it seemed to have no effect, (I simulated unintended small movements by hand, of course) and it often still woke up out of the screen saver, or out of my monoff.exe.
Either it is not working correctly, or I have to increase the aggressiveness.
But I don't really understand the script. Hope you can help.
« Last Edit: June 14, 2008, 01:48 PM by kaon »

skrommel

  • Fastest code in the west
  • Developer
  • Joined in 2005
  • ***
  • Posts: 933
    • View Profile
    • 1 Hour Software by skrommel
    • Donate to Member
 :tellme: If works very well on Vista... Try the script again, I've corrected the line split, commented the script and decreased the sensitivity.

Skrommel

kaon

  • Supporting Member
  • Joined in 2008
  • **
  • Posts: 4
    • View Profile
    • Donate to Member
Thanks for your help Skrommel.
I know the problem now, even though I'm embarrassed to say I still don't understand how the script works. :p

Anyway, it works if I have a normal screensaver really running. I see the tooltip, cool.

It does not work when I use your MonitorOffSaver.scr, or if the "Turn Off Monitor" timeout setting (of WinXP Power Options Properties > Power scheme) is in effect, or if I am using MonOff.exe.

So ideally, this mouse desensitizing should be in effect when monitor is powered off too.

If it simplifies things, how about combining the mouse desensitizing with MonitorOffSaver.scr and with MonOff.exe?

I personally do not use screensavers for the pretty graphics, I always prefer the monitor go into its lowest power mode, or soft-off.

And there's another potential problem:
The idle timer that WinXP uses to decide whether it is time to start the screensaver / switch off the monitor. This timer would keep getting resetted by the mouse jitters, so that the screensaver would never start. I have one such machine in my work place, it has a off-brand optical mouse. Perhaps the simpler solution is to but a new mouse / mousepad for that machine.

Thanks again!
« Last Edit: June 15, 2008, 12:34 AM by kaon »