oblitum / Interception

The Interception API aims to build a portable programming interface that allows one to intercept and control a range of input devices.
http://oblita.com/interception
1.33k stars 271 forks source link

How to stop events from being passed downstream #42

Closed awasu closed 7 years ago

awasu commented 7 years ago

Hi

Thanks for writing this, it seems to work pretty well and is easy to use :-)

I work with very large documents and so I bought a trackball and was hoping to be able to use Interception to translate rolling the trackball around into keyboard/mouse messages that scroll the document horizontally and vertically i.e. to pan the document.

I've got something working, but as the document scrolls around, the cursor on the screen keeps moving. All the sample programs do a interception_receive(), then a interception_send(), which implies that if you only do the interception_receive(), the event will be consumed and not passed on downstream.

I had a look through the source code but couldn't see anything to do this - is there any way to stop these mouse move events from being processed by the rest of the system?

oblitum commented 7 years ago

It's just like you described. There are examples that map different input kinds, for example, the mathpointer sample trigger mouse movement when a numeric key is pressed, but the number key is never sent back to the system when pressed.

awasu commented 7 years ago

Thanks for the quick reply.

Turns out the problem was being happening because I was testing in a VM, which is doing its own funky stuff with the mouse :facepalm: Once I moved to real machine, the cursor stops moving.

It might be an idea to add a note to the read-me about this - I'm sure a lot of developers will do their initial testing in a VM and it's an easy misteak to make :-)

oblitum commented 7 years ago

@awasu Thanks for the tip, will add it.