Let's assume that a few windows are visible - I need to implement mechanism which will block events for a selected windows, for example when user click a button in window_nr1 and window_nr2 nothing happens but when a user click a button in window_nr3 event is processed. Compositing window manager renders textures and a window location which is actual for XServer may be different, but this is some kind of workaround so let's also assume that a window texture is rendered without transformations. In Compiz XGrabPointer is use to capture mouse events:
XGrabPointer (privateScreen.dpy, privateScreen.eventManager.getGrabWindow(), true,
ButtonReleaseMask | ButtonPressMask | PointerMotionMask ,
GrabModeAsync, GrabModeAsync, privateScreen.rootWindow(),
cursor, CurrentTime);
where a creation of grab window looks like this:
grabWindow = XCreateWindow (dpy, root, -100, -100, 1, 1, 0,
CopyFromParent, InputOnly, CopyFromParent,
CWOverrideRedirect | CWEventMask,
attrib);
In that case mouse events are captured (i.e. redirected only to a window manager event loop) for the whole screen and it looks like that XGrabPointer can't be used for a capture mouse events for a particular window.
Do you have some ideas how to implement such mechanism ?
Grab the mouse pointer and pass on the events to the destination window.