-
Notifications
You must be signed in to change notification settings - Fork 7
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
Gesture button is 'stolen' on Wayland #8
Comments
I don't reproduce this bug !
10ms between ButtonPress and ButtonRelease is maybe too short. |
I think you're right. I logged into an X11 session and it worked OK. |
I used |
I had another few minutes to look at this, and it's no surprise now that it isn't working under Wayland. While rdev uses evdev to monitor input events, making it cross-compatible with X11 and Wayland, that The good news is that the same crate that rdev uses to read input, can generate output, via evdev. There's an example of it here From a glance, it appears to essentially create a virtual mouse and use that to send the input events. The bad news is, that probably means writing a replacement/alternative for simulate(). I know that you have made several improvements to upstream rdev, so I guess this would be another one, but I wonder if you plan to upstream your changes or just continue to run with the local fork? I guess that another way around this would be making ydotool a dependency on Wayland, and calling that to generate the simulated events, but that's not so clean as using an inbuilt lib. mouse-actions is really fast and I think that it would be nice to keep it streamlined. It's obvious that you're not usually using Wayland, and I am, so I could try to take a shot at this if you like? I will warn you that I have zero experience with Rust (outside of this project which I've been glued to since day one) , although having had a lot of experience with C (mostly embedded devices for robotics automation, but also some Linux stuff thanks to the Y2K bug) and a little with C++ (which I hate passionately), I find it fairly comfortable to adjust to Rust, at least reading the code is very clear to me, but I can't guarantee I'll be of any use when it comes to writing it. But I am offering to try, if it will be helpful for you. Or perhaps I should just get out of your way ;) and let you take care of this. Let me know. |
I tried this in a quick-and-drty way, and it doesn't work. Because mouse-actions can't tell that the event came from ydotool, it treats the simulated rightclick just like a real one, and goes into a loop of clicking, simulating a click, which makes it simulate a click, which makes it simulate a click..... So, to be able to simulate mouse events, we would have to use evdev and filter out events which are generated by mouse-actions' virtual device. |
I'll have to reread the above comments carefully, but a workaround (in the meantime) you may be suggesting is to add a binding to for the rigth click release event to I check the code of rdev::simulate feature : it seems to be made for X11 only... edit: ydotool use uinput, the crate https://docs.rs/crate/mouse-keyboard-input/0.3.7 could be used to emulate mouse button under Wayland |
Be careful my friend, it enters a very fast loop, be ready to kill mouse-actions before it crashes your compositor :) Edit (I wanted to post that reply quickly in case maybe I can save you from a bad experience ;) )
This looks interesting, I was looking at the evdev-rs crate (which rdev uses also) but this would be more simple. The tricky part is that mouse-actions will need to be able to filter out any input from the virtual device, to avoid this infinite-loop scenario I had above, I'm still reading rdev's code to see if it can do this natively. I'm very new to rust so I'm slow, hopefully you will look at it and see an easy solution! |
I've come to the same conclusions as you, even though I didn't test the "trap" as I was informed :-)... Thank you ! I suppose we can modify rdev (which is forked in this repo) to ignore the virtual device created by mouse-actions. edit: in relation to this, there is work to be done on rdev and its device management, one of the biggest issues listed in the Readme : "TODO/Hight/fix rdev". |
Some news: For this fix, the management of monitored devices is modified (in the rdev fork), it will then be possible to ignore the future virtual device that will be used to send the clicks currently "stolen" under Wayland. So, I hope to quickly fix the 3 main bugs with this: MA crash, cursor freeze and the stolen click. |
Thanks for the update and keeping me in the loop mate. I actually dropped by after my 500th "**** I miss my mouse gestures" moment today so even if there's not a fix here it's really nice to know it's on your to-do list and very thoughtful of you to think of me and let me know. And I think you've got your priorities in order. I have not experienced the problem with adding devices (I do it all the time I have 3 mice) but if that's a thing for some people it's certainly higher priority than getting things working for wayland. |
Is there any new progress? This may be the only mouse gesture solution on plasma6 at present. |
I use right button as my gesture button (although I do dream of one day selecting the gesture button per-command, rather than globally, but that's a story for another time), and I have noticed that while mouse-actions is working, I cannot right-click (such as to open a context menu)
It turns out that the click is detected, determined too small to be a gesture, but not propagated as a normal click. Trace logs:
load start:
left-click:
right-click
Note that second
propagate = false
, I guess this is the culprit. It appears that neither the mousedown nor mouseup event are forwarded past mouse-actions in this case. I've tested it with middle button and the behaviour is the same.Note also the multiple ^C - I did not type those, I pressed Ctrl+C one time. I am about to log a separate issue for that.
The text was updated successfully, but these errors were encountered: