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).

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.
> 
> Thanks for your help.
> 
> _______________________________________________
> Devel mailing list
> [EMAIL PROTECTED]
> http://XFree86.Org/mailman/listinfo/devel


-- 
--------------- Codito, ergo sum - "I code, therefore I am" --------------------
The Rasterman (Carsten Haitzler)    [EMAIL PROTECTED]
熊耳 - 車君                         [EMAIL PROTECTED]
Mobile Phone: +61 (0)413 451 899    Home Phone: 02 9698 8615
_______________________________________________
Devel mailing list
[EMAIL PROTECTED]
http://XFree86.Org/mailman/listinfo/devel

Reply via email to