简体   繁体   中英

linux x11 window manager - blocking mouse events

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 (ie 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 ?

抓住鼠标指针并将事件传递到目标窗口。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM