Module: mousegrabber

Set a callback to process all mouse events.

Info:

  • Copyright: 2008-2009 Julien Danjou
  • Originally authored by: Julien Danjou <julien@danjou.info>
    (Full contributors list available on our github project)

Static module functions

mousegrabber.run (func, cursor) Grab the mouse pointer and list motions, calling callback function at each motion.
mousegrabber.stop () Stop grabbing the mouse pointer.
mousegrabber.isrunning () -> boolean Check if mousegrabber is running.


Static module functions

🔗 mousegrabber.run (func, cursor)
Grab the mouse pointer and list motions, calling callback function at each motion. The callback function must return a boolean value: true to continue grabbing, false to stop. The function is called with one argument: a table containing modifiers pointer coordinates.

The list of valid cursors is:

num\_glyphs
arrow
based\_arrow\_down
based\_arrow\_up
boat
bogosity
bottom\_left\_corner
bottom\_right\_corner
bottom\_side
bottom\_tee
box\_spiral
center\_ptr
circle
clock
coffee\_mug
cross
crosshair
cross\_reverse
cursor
diamond\_cross
dotbox
dot
double\_arrow
draft\_large
draft\_small
draped\_box
exchange
fleur
gobbler
gumby
hand
hand
heart
icon
iron\_cross
leftbutton
left\_ptr
left\_side
left\_tee
ll\_angle
lr\_angle
man
middlebutton
mouse
pencil
pirate
plus
question\_arrow
rightbutton
right\_ptr
right\_side
right\_tee
rtl\_logo
sailboat
sb\_down\_arrow
sb\_h\_double\_arrow
sb\_left\_arrow
sb\_right\_arrow
sb\_up\_arrow
sb\_v\_double\_arrow
shuttle
sizing
spider
spraycan
star
target
tcross
top\_left\_arrow
top\_left\_corner
top\_right\_corner
top\_side
top\_tee
trek
ul\_angle
umbrella
ur\_angle
watch
xterm

Parameters:

Name Type(s) Description
func function A callback function as described above.
cursor string or nil The name of an X cursor to use while grabbing or nil to not change the cursor.
🔗 mousegrabber.stop ()
Stop grabbing the mouse pointer.
🔗 mousegrabber.isrunning () -> boolean
Check if mousegrabber is running.

Returns:

    boolean True if running, false otherwise.
generated by LDoc 1.5.0