Module: mousegrabber
Set a callback to process all mouse events.
Info:
- Copyright: 2008-2009 Julien Danjou
-
Originally authored by: Julien Danjou <[email protected]>
(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_glyphsarrowbased_arrow_downbased_arrow_upboatbogositybottom_left_cornerbottom_right_cornerbottom_sidebottom_teebox_spiralcenter_ptrcircleclockcoffee_mugcrosscrosshaircross_reversecursordiamond_crossdotboxdotdouble_arrowdraft_largedraft_smalldraped_boxexchangefleurgobblergumbyhandhandhearticoniron_crossleftbuttonleft_ptrleft_sideleft_teell_anglelr_anglemanmiddlebuttonmousepencilpirateplusquestion_arrowrightbuttonright_ptrright_sideright_teertl_logosailboatsb_down_arrowsb_h_double_arrowsb_left_arrowsb_right_arrowsb_up_arrowsb_v_double_arrowshuttlesizingspiderspraycanstartargettcrosstop_left_arrowtop_left_cornertop_right_cornertop_sidetop_teetrekul_angleumbrellaur_anglewatchxtermParameters:
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.