Immediate-Mode-UI / Immediate-Mode-UI/Nuklear

Many trackpad mouse down events are lost (MacOS+SDL2+OpenGL2)

Open
#494 6 comments 0 reactions 0 assignees View on GitHub
Dominant language
C
Stars
11.4k
Forks
686
Avg merge
4d 1h
Merged PRs (30d)
3

Description

I'm using SDL2 with OpenGL2, on Macs with a Magic Trackpad configured as "tap to click" (ie: mouse-down events are generated by just tapping the trackpad, without having to fully press it).

When I tap, most of the times the mouse-down event is lost, so togglebuttons are not toggled, buttons are not pressed, etc, etc...

A few times it works, other times doesn't. Strange. I tried to debug it, but I don't know the Nuklear internals, so I don't know where to look for.

The only things I can say for the moment are these:

- **nk_sdl_handle_event()** in `nuklear_sdl_gl2.h` is getting an event for **all the taps**. No events are lost. So, the problem is not in SDL2, because the events are arriving correctly to Nuklear.
- For every tap, I'm getting both a mouse down and a mouse up event. So, the problem is not about mouse clicks being unterminated or unstarted.
- In every mouse up/down event, `ctx->input.mouse.buttons[NK_BUTTON_LEFT].down` is different from `evt->type == SDL_MOUSEBUTTONDOWN`. So, function **nk_input_button()** doesn't return prematurely at the check for both being equal.

As I said, I don't know the Nuklear internals, so I wasn't able to dig deeper. Do you have any idea on what might be happening?

Contributor guide

Open the contributing guide

Research direction

Start in nuklear_sdl_gl2.h at nk_sdl_handle_event(), then trace the SDL mouse button events into nk_input_button() and the NK_BUTTON_LEFT state. Reproduce the Magic Trackpad tap behavior on macOS with SDL2 and OpenGL2, and determine why a reported mouse-down does not reach the toggle buttons; done means taps reliably press or toggle the controls.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
desktop
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.