-
-
Notifications
You must be signed in to change notification settings - Fork 667
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
Consecutive touchpad clicks are perceived as one #3137
Comments
Let me set the milestone v2.9 first, but if the fix is obvious and the issue is serious enough, I might change the mileston to the stable version. |
@sedyh I would like to know which Ebitengine or GLFW was problematic. You checked ebiten/internal/ui/input_glfw.go Lines 77 to 83 in 6452cbc
is called every frame (144Hz?) and |
Yes. Here is some additional output and the code: for gb, ub := range glfwMouseButtonToMouseButton {
s, err := u.window.GetMouseButton(gb)
if err != nil {
return err
}
u.inputState.MouseButtonPressed[ub] = s == glfw.Press
if gb == 0 {
log.Println("press:", s)
}
} |
Are mouse events fired as expected? ebiten/internal/glfw/x11_window_linbsd.c Lines 1468 to 1477 in 6452cbc
|
Yes, they are. const int mods = translateState(event->xbutton.state);
printf("event: %d\n", event->xbutton.button);
if (event->xbutton.button == Button1)
_glfwInputMouseClick(window, GLFW_MOUSE_BUTTON_LEFT, GLFW_PRESS, mods);
else if (event->xbutton.button == Button2)
_glfwInputMouseClick(window, GLFW_MOUSE_BUTTON_MIDDLE, GLFW_PRESS, mods);
else if (event->xbutton.button == Button3)
_glfwInputMouseClick(window, GLFW_MOUSE_BUTTON_RIGHT, GLFW_PRESS, mods); ebitengine-real-clicks.mp4 |
@sedyh Are the events actually for mouse buttons? |
Its all just left click:
if (event->xbutton.button == Button1) {
printf("event-button-left: %d\n", event->xbutton.button);
_glfwInputMouseClick(window, GLFW_MOUSE_BUTTON_LEFT, GLFW_PRESS, mods);
} else if (event->xbutton.button == Button2) {
_glfwInputMouseClick(window, GLFW_MOUSE_BUTTON_MIDDLE, GLFW_PRESS, mods);
} else if (event->xbutton.button == Button3) {
_glfwInputMouseClick(window, GLFW_MOUSE_BUTTON_RIGHT, GLFW_PRESS, mods);
} |
My current guess is that this is due to sticky states but I am not 100% sure ebiten/internal/glfw/input_unix.c Lines 93 to 94 in 6452cbc
|
@sedyh Thanks. Are releasing events also fired? ebiten/internal/glfw/x11_window_linbsd.c Lines 1502 to 1535 in 6452cbc
|
@hajimehoshi Yes, for the left button:
|
Not sure about this: Lines 1263 to 1272 in 6452cbc
|
My current understanding is
As long as I cannot reproduce the issue, it is almost impossible to know what's going on. @sedyh Would it be possible for you to investigate why this mismatch happens? |
Thanks. Keyboards has similar implementation but has different stories. Let's focus on mouse buttons first. |
@sedyh and I have discusse in the Discord server and found the following: Now Ebitengine just watches input states wihtout handling events. The issue is that a release event could be delayed and it could come just before the next pressing event. Ebitengine could not detect the state change when the two events came at one event polling. @sedyh confimed that another mouse worked as expected, so I think this is an issue in the X driver for the touchpad. In order to mitigate this issue, my current idea is to fix Unfortunately, We might have to add |
Ebitengine Version
2.8+ (6452cbc)
Operating System
Go Version (
go version
)go version go1.23.1 linux/amd64
What steps will reproduce the problem?
Run the example:
Run the input monitor with your device id (xinput without flags will list device ids):
What is the expected result?
Every times xinput fires, ebitengine example should fire a log too.
What happens instead?
The engine perceives frequent clicks (>2 cps) as single press:
ebitengine-real-fail.mp4
Anything else you feel useful to add?
No response
The text was updated successfully, but these errors were encountered: