inject events into a named pipe

Jonathan B. jon at number-none.com
Thu Feb 1 14:41:52 PST 2007


I am actually looking to do the same thing (confine the mouse pointer to 
a window -- similar to the behavior of ClipCursor in Win32).

In my case, it's because games really need to be able to do that.  Right 
now I am doing "make the cursor invisible, draw your own, keep warping 
it to the center of the window, and read the delta every frame" but 
there are a lot of problems with that and it is just inappropriate for 
certain types of games.

Of course, XGrabPointer will constrain the mouse pointer but it is way 
too severe in its other effects.


Tiago Vignatti wrote:
> Peter Hutterer escreveu:
>> On 02/02/2007, at 04:27 , Tiago Vignatti wrote:
>>
>>> Hello every one,
>>>
>>> I've been trying to inject differents events direct to mouse device 
>>> node and my first attempt is to create a named pipe (fifo). So I did 
>>> the following:
>>>
>>> root at mt4:/dev/input# mkfifo fakemouse p
>>> root at mt4:/dev/input# cat mouse0 > fakemouse
>>
>> Unfortunately a simple cat doesn't do it. You have to write a few 
>> bytes to the mouse device to init the right protocol etc. Only after 
>> that will the forwarding of the bytes work.
>> Have a look at http://www.computer-engineering.org/ps2mouse/ to find 
>> out what to write to the device.
>>
>> Cheers,
>>   Peter
>>
>
> Thanks for all answers, guys. It did help me a lot.
>
> What I really want to do is to confine a pointer in a window. You can 
> imagine the scenario which we have a lot of pointers (for example, 
> MPX) and each pointer must be confined to one window or a bunch of 
> windows (the root window).
>
> Does anyone have an idea how to do this?
>
>> -- 
>> Multi-Pointer X Server
>> http://wearables.unisa.edu.au/mpx
>>
>
> my best regards
>




More information about the xorg mailing list