-
Notifications
You must be signed in to change notification settings - Fork 140
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
clicks not registering #3
Comments
So this works fine under |
Yes this is a known bug. X uses a client-server model which is abstracted from the client perspective by Xlib. Xlib calls transparently send requests to the core X server which then relays those requests to other clients (i.e windows/window managers). It appears that the simulated mouse events getting sent to the server are being processed after the mouse indicator is being remapped preventing the target window from processing the click. It is unclear why this is happening given that the requests appear to be sent in the correct order (verified using xtrace) which indicates that there is either a bug in the X server (which causes it to process map events before simulated click events) or else certain window managers are doing strange things with pointer grabs. Properly discovering the root cause is quite involved (and possibly beyond my ken). My suspicion is that it has some to do with the way the window manager handles events (I was able to reproduce the issue on fluxbox but not on dwm). It is unlikely anything can be done about it short of adding an artificial delay or else simply not remapping the mouse decorations after each click. Presently I have chosen the former option to preserve existing functionality, but it is a bit of a kludge and may not work across all window managers. TLDR: It was a race condition. Try the latest commit :P. |
I've done some basic testing on fluxbox and most of the kinks seem to have been ironed out (double click now works). Let me know if you discover any other issues. I suspect compositing window managers (typically found on heavier DEs) may introduce some complications but I haven't tried any. Feel free to report back with any problems or close the issue once you feel things are working. Thanks |
I got around to installing XFCE (all 2+GB of it!) and did a bit more testing. It turns out there is another issue which prevents certain programs from working properly. X uses a model in which only one client can have control of the keyboard at a given time. Unfortunately since warp needs access to the keyboard in order to process input events this effectively means that pointer actions which result in programs attempting to grab the keyboard will fail (and conversely any attempts by warp to grab the pointer if another program has already done so will also fail). This is most notable on the XFCE top bar but also appears to be true of many graphical program menus which silently fail when they can't grab the keyboard to implement menu shortcuts (interestingly Chrome does not suffer from this issue). Since I principally use chrome, urxvt and a fairly spartan window manager I have managed to remain blissfully ignorant of these issues :P. This is obviously a major problem for anyone who uses GUI oriented setup (and who would consequently most likely benefit from a program like this). It probably also explains the conspicuous lack of such programs already in existence. Potential SolutionsAs far as I can tell there doesn't exist a way to properly implement something like this in X. There was an attempt to introduce an extension for accessibility related key interception some time ago (XEviE) but it appears to have been abandoned. The following are potential workarounds. Yield the keyboard grab upon click (stop drop and roll).Pros
Cons
Use uinputPros
Cons
Resourceshttps://freedesktop.org/wiki/Software/XEvIE/ ConclusionPresently I favour the first option but if your main use case involves interacting with a lot of graphical program menus then I am willing to undertake the second (I may eventually end up implementing it as an exercise anyway). Let me know how you want to proceed. |
Followup: I went ahead and implemented the first solution along with a few other improvements (see the latest commit and updated readme). This is as far as I can take the current implementation. If you are interested in a uinput version which works with popup menus feel free to create another issue or email me directly :P. I'm closing this for now since there is nothing else which can be done. |
Played around with this under XFCE, and behaviour seems reasonable enough, gonna switch to a minimal WM soon enough anyway |
Update: After some experimentation it appears it is indeed possible to improve upon the existing implementation by abusing xinput slave devices to undermine standard X grabs. This is not perfect since it is theoretically possible for another client to grab exclusive control of the same devices but most application toolkits seem to use the higher level APIs. This represents a nice middle ground between an input layer solution and the current one and should hopefully slake the thirst for a complete rewrite. |
Implemented in f762bad |
I need to hit the mouse click key many times before it's detected - feels like some sort of race condition? XFCE on Ubuntu 19.10
The text was updated successfully, but these errors were encountered: