Closed pockata closed 8 years ago
The Xorg protocol only allow one application at a time to register the
XCB_EVENT_MASK_BUTTON_PRESS event, so if wew registers it, it will need
some way to pass it on to the windows concerned.
I tried a few things already, like xcb_send_event()
, but in vain.
I tried to look at how other WM using xcb handle this (namely, bspwn and
i3), but none of them seems to handle it.
And to be fair, this is not a feature I've been interrested in, so I
gave up on this rather quickly.
So yeah, by default, when you register the XCB_EVENT_MASK_BUTTON_PRESS with an application, the event doesn't pass through this application underneath.
Thanks, I understand the situation now. I do a lot of web dev and click-focus is more natural for me than hover-focus.
I guess as an alternative I could use sxhkd to bind the mouse button to a script to find the top window under the cursor, but this approach sounds less performant. I'll up my Xorg game and look into this.
If you can find a simple and elegant solution, we'll be really interrested in having it implemented. Another solution woukd be to have a tool to find the window that is directly under the cursor, and, as you said, use it to figure out which window was clicked. It would require a modifier key though.
We're basically there. I've managed to get the keypress (XCB_BUTTON_PRESS) event to register with wew and get passed (replayed) to the window. However, the keyrelease (XCB_BUTTON_RELEASE) event does not get registered with wew. Not sure why.
I'll investigate the problem a bit more and send a PR for you to review in a few days.
That's a good news! is your branch available somewhere so I could review it? maybe I can help
It's a local copy currently. I've changed a lot of things that I thought were related to the case, but later found that they are not. I'll do a cleanup to remove the unnecessary parts and upload the code to Github later today.
Here's a link to my fork with the changes I made.
The keyrelease event doesn't get registered with wew when the pointer_mode in xcb_grab_button is set to XCB_GRABMODESYNC (which seems to be necessary for the click event to be replayed to the window). As per the documentation (or my interpretation of it), another xcb_allow_events call should be made to unfreeze further events, but I've had no luck getting that to work.
I'm not 100% that this isn't intended behavior, but here it goes.
I wanted to implement focusing windows with click (instead of hover), but starting wew with a mask
wew -m 4
(XCB_EVENT_MASK_BUTTON_PRESS) grabs the click event (the event is registered in wew) but doesn't pass it to the window underneath the cursor.Am I doing something wrong or is this how the program should behave?