Carsten Haitzler (The Rasterman) schrieb:

>On Tue, 28 Oct 2003 12:19:49 +0100 (MET) "Gerhard Gruber" <[EMAIL PROTECTED]>
>babbled:
>
>  
>
>>I'm not sure if this is the proper forum for asking such a question, but I
>>found nothing so far on the web and so I hope to get some answers at the core
>>of X. If this is not the correct forum I would really appreciate it if you
>>could point me to where I can ask this question.
>>
>>I'm developing an application which needs to filter all mouse events even
>>when it's window is not active. So I tried to grab the pointer and redirect it
>>to my app. This works, but the problem I have is that of course X doesn't
>>work as long as my app is active because it gets all events and the other apps
>>none. I was looking into the Xlib reference manuals if there is some way to
>>forward or return the XEvent to X again so it can be processed the normal way.
>>In Windows I do this with a hook function which allows me to specify that an
>>event is either passed on, or will be discarded after my hookfunction
>>returns. I wonder if there is a similar mechanism for X. I was looking into
>>GDK, as this would be my prefered way of doing it, but I would settle for a
>>Xlib solution as well if there is no other way.
>>So what I need is either a way to simply filter events and block them on
>>request (prefered) or grab all the input and forward it to the original owner
>>if I'm not interested in it.
>>    
>>
>
>basically there is no choice. you can't do this. you need to POLL for the mouse
>position in a timer to do what you want. you dont have the choice of swallowing
>or allowing a mouse move event (outside your window).
>
I dont think you will need to "poll " ...
you just wait for them to come and then go on .

you say you already manage to grab them , so then you only need to
decide to sent them back or not.
I the XLib function XSendEvent is capable to re-generate the
uninteressting event`s and sent them
back to where it should belong ... just make sure that you also
investigate all the other things of the event so that you can aftwards
generate a proper new one ..

what you then did is to make your own "hook - function" like you where
used to in windows ..

- i think

>
>so you need to poll in a timer. you can then just query the mouse position on
>the screen and do what you need to. this does mean a round trip per query and
>wont make for the nicest app on the planet.
>
>although i can think of an evil hack to avoid polling... very evil. so evil i
>wont mention it.
>
>  
>
>>Can this be done with X and/or GDK/GTK? If I know how to do it in X I could
>>probably figure out how to do it in GDK/GTK as well, but I've been searching
>>the web for several days now and I couldn't find anything helpfull. There
>>seem to be many workarounds for similar problems but none that works for me,
>>though.
>>
i believe this special "hook part " is best done in pure Xlib ... maybe
aftwards you can generate GTK - events again , but hooking all events
should not a GTK thing

>>
>>Thanks for your help.
>>
>>_______________________________________________
>>Devel mailing list
>>[EMAIL PROTECTED]
>>http://XFree86.Org/mailman/listinfo/devel
>>    
>>
>
>
>  
>

-- 
_____________________________________
*Robert Woerle
Linux & Customer Support*
*PaceBlade Technology Europe SA*
phone:  +49 89 552 99935
fax:    +49 89 552 99910
mobile:         +49 179 474 45 27
email:  [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>
web:    http://www.paceblade.com
_____________________________________




_______________________________________________
Devel mailing list
[EMAIL PROTECTED]
http://XFree86.Org/mailman/listinfo/devel

Reply via email to