Closed Chae4ek closed 2 years ago
I just did a ton of work on the event posting for all three supported platforms but mouse wheel events have not been tested yet. Please check the latest snapshot and let me know if this is still an issue.
Hi, @kwhat! Thank you for supporting this project so far) Unfortunately, the problem is still here
Should be fix in the latest update.
Please reopen if it is still not working.
That works now, but I noticed the behavior had changed a bit. For example:
NativeMouseWheelEvent event =
new NativeMouseWheelEvent(
NativeMouseEvent.NATIVE_MOUSE_WHEEL,
NativeMouseEvent.BUTTON5_MASK,
300,
250,
1,
NativeMouseWheelEvent.WHEEL_UNIT_SCROLL,
1,
1,
NativeMouseWheelEvent.WHEEL_VERTICAL_DIRECTION);
GlobalScreen.postNativeEvent(event);
I expect (should it work so?):
I tested it on Windows: it seems only the 2nd point is done. on Linux: 1 and 2. It looks weird when I move the mouse too fast and post an event, even if I do it in the nativeMouseMoved method cause of the delay.
P.S. I cannot reopen the issue
The library won't be able to compensate for mouse movement while sending events. If you move the mouse while events are being sent, both will happen at the same time. I am not sure how this works on Windows or OS X. We might be able lock the mouse input on Linux while events are being sent, but I am not sure if that will effect the events being posted.
I am not sure how 1 & 3 behave on Windows or OS X. 2 should work on both but hasn't been tested extensively.
Well, I've experimented a bit and figured out that without moving the cursor (just comment this out) this event works the same way as on Windows. It also works fine when moving the mouse quickly.
Well, I've experimented a bit and figured out that without moving the cursor (just comment this out) this event works the same way as on Windows. It also works fine when moving the mouse quickly.
Interesting, those lines seem to be required for Button Press/Release events to behave similarly to Windows. Can you check the button press/release stuff and let me know? I don't think I'll have to to check this today but tomorrow should be good.
- setting the cursor to position
- pressing/releasing/scrolling at the current position
- setting the cursor to its original position
Hmm.. button press/release behaves like 1&2 above on linux, but on Windows like just 2. I think it's a question about new features to do 1&2(&3 probably?) and only 2 to reduce or get rid of the delay. btw I need to perform only the 2nd one, I can't do it with the current lib functions.
Since those lines are in a different method (post_mouse_wheel_event
instead of post_mouse_button_event
), they don't affect pressing/releasing button.
Well, I've experimented a bit and figured out that without moving the cursor (just comment this out) this event works the same way as on Windows. It also works fine when moving the mouse quickly.
Alright I am adding this change so that should hopeful make things usable.
Let me know if there are still issues, I can reopen.
I have a problem with posting a NativeMouseWheelEvent in Linux. It seems the passing coords are ignored and the mouse cursor jumps to the top of the screen, but then jumps at the start position. It looks like this issue #76. I think it's even a similar bug. As I understand it, when posting mouse button events in X11, the same method is used, but when receiving
event->data.mouse
there are no checks whether it's a wheel event: https://github.com/kwhat/libuiohook/blob/dbab471930671ebeb6c9a09f41531afef0405e45/src/x11/post_event.c#L126Interesting fact, if I pass the NATIVE_MOUSE_MOVED or NATIVE_MOUSE_DRAGGED as an id, it works almost fine untill I start moving the cursor