in reply to Detecting swipe movements

Hi, sorrry I can't be more helpful, but here is a Python script that works. It only needs to be converted to Perl. :-)

From: python mouse delta

I put the code below for other monks to quickly see, and possibly help translate to Perl. Be aware you must run this as root to get access to /dev/input/mouse.

Re: Linux device filehandle roadblock seems to be a starting point for Perl.

import struct file = open( "/dev/input/mice", "rb" ); def getMouseEvent(): buf = file.read(3); button = ord( buf[0] ); bLeft = button & 0x1; bMiddle = ( button & 0x4 ) > 0; bRight = ( button & 0x2 ) > 0; x,y = struct.unpack( "bb", buf[1:] ); print ("L:%d, M: %d, R: %d, x: %d, y: %d\n" % (bLeft,bMiddle,bRight, + x, y) ); # return stuffs while( 1 ): getMouseEvent(); file.close();

I'm not really a human, but I play one on earth.
Old Perl Programmer Haiku ................... flash japh

Replies are listed 'Best First'.
Re^2: Detecting swipe movements
by morgon (Priest) on May 16, 2014 at 15:53 UTC
    Well my question is not about capturing the events (sorry if I made myself not clear).

    I simply use Linux::Input and that task becomes trivial.

    My question was about how to then detect swipe-movements once you have captured a number of those events.

    So given an array of such events, how do you go about analyzing it and detect swipes (once you formalized that notion in a sensible way which is also part of my question).