Mouse Events in X11

Robin Watson rmawatson at
Fri Dec 4 15:28:47 PST 2009

Hi, I had a look at XFilterEvent. My problem is that currently I am not
receiving any MotionNotify events when my mouse goes over certain windows
that I have XSelectInput() on, and so XNextEvent() is not getting any events
for me to use with XFilterEvent.


With Eclipse-CDT's window, what is strange, is I will get maybe 1 or 2
MotionNotify Events at the edges of the window when I am entering it with
the pointer, but within the window I get none. The only other possibility I
can think of is that the window I am selecting on is not the correct one,
but there are other windows drawn on top of this one. 


I have enumerated the whole window tree (from the root) and I am currently
using SelectInput() on a window  that I retrieve based on its WM_NAME, from
the window tree.


However if this is not the window that I should select on (the named one), I
cannot see how to accurately  work out which other window it should be.
There seem to be *many* unnamed windows that also exist in the window tree,
that are just children of the Root window .I can't quite see what other
information is available on these unnamed windows that I can key on, to work
out that it is part of 'application XXX..'


any suggestions ?




From: Jay.Cotton at Sun.COM
Sent: 04 December 2009 22:34
Subject: Re: Mouse Events in X11


Have a look at XFilterEvent that may do it for you.  

On 12/04/09 14:13, Robin Watson wrote: 

Hello. I am attempting to globally hook or ideally hook mouse events on a
single window using Xlib. I am using Fedora 11. I am attempting to get the
events I want using XSelectInput() on the default display, with the Window
of the application I am trying to read the mouse events from, using
PointerMotionMask. However, I am finding that this seems to be working


Various windows on the desktop, such as the Konsole window, or Kwrite hook
perfectly. and I get a stream of all the mouse move events when I mouse over
these windows. However I am having problems with certain other windows such
as Eclipse-CDT amongst others. Some of these windows seem to feed back no
mouse movement information.


I have tried using xev to test whether there was a problem with my code or
not. However even if I get the Window ID with xwininfo,(clicking on for
example Eclipse-CDT, and then feeding this Window ID to xev -id  it will
also not recieve the any mouse movement events for this window.


I am confused as to why XSelectInput() will get be able to select on
MotionNotify events on some windows and not others. Eclipse-CDT is certainly
not grabbing the mouse cursor. If anyone could shed any light as to why I
might not be recieving these events on some windows that would be very







xorg mailing list
xorg at


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the xorg mailing list