2

I am looking for a program working on Microsoft Windows 7 that can detect or test the presence of mouse acceleration.

  • What do you mean exactly with detecting or testing the presence of mouse acceleration? Do you need to measure it somehow? And, just out of interest, why do you need to do that? – mguassa Jul 14 '15 at 18:14
  • @mguassa Measuring it would be ideal. I need that because I suspect a bunch of programs to alter the mouse acceleration when they are launched, so I would like to do a comparative study, before/after launch. – Franck Dernoncourt Jul 14 '15 at 18:16
  • There is a javascript program to know acceleration of mouse here : gist.github.com/ripper234/5757309 and here: omnipotent.net/jquery.sparkline/#s-about – BarathVutukuri Jul 14 '15 at 18:32
1

You could just put the javascript from @BarathVutukuri comment into a simple text file saved as html and wrap it in a tag; though you might need to put the speed result into an alert or something.

Alternatively this would not be difficult to code in a short C# app.

<span id="mousespeed"></span>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script src="http://omnipotent.net/jquery.sparkline/2.1.1/jquery.sparkline.min.js">
</script>
<script>
function drawMouseSpeedDemo() {
    var mrefreshinterval = 500; // update display every 500ms
    var lastmousex=-1; 
    var lastmousey=-1;
    var lastmousetime;
    var mousetravel = 0;
    var mpoints = [];
    var mpoints_max = 30;
    $('html').mousemove(function(e) {
        var mousex = e.pageX;
        var mousey = e.pageY;
        if (lastmousex > -1) {
            mousetravel += Math.max( Math.abs(mousex-lastmousex), Math.abs(mousey-lastmousey) );
        }
        lastmousex = mousex;
        lastmousey = mousey;
    });
    var mdraw = function() {
        var md = new Date();
        var timenow = md.getTime();
        if (lastmousetime && lastmousetime!=timenow) {
            var pps = Math.round(mousetravel / (timenow - lastmousetime) * 1000);
            mpoints.push(pps);
            if (mpoints.length > mpoints_max)
                mpoints.splice(0,1);
            mousetravel = 0;
            $('#mousespeed').sparkline(mpoints, { width: mpoints.length*2, tooltipSuffix: ' pixels per second' });
        }
        lastmousetime = timenow;
        setTimeout(mdraw, mrefreshinterval);
    }
    // We could use setInterval instead, but I prefer to do it this way
    setTimeout(mdraw, mrefreshinterval); 
};
drawMouseSpeedDemo();
</script>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.