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

Event input code requires two renders?

Open
#60 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C
Stars
11.4k
Forks
686
Avg merge
4d 1h
Merged PRs (30d)
3

Description

So, I've encountered this problem specifically on the edit-box. It's in this code:

` if (in && in->mouse.buttons[NK_BUTTON_LEFT].clicked && in->mouse.buttons[NK_BUTTON_LEFT].down) {
edit->active = NK_INBOX(in->mouse.pos.x, in->mouse.pos.y,
bounds.x, bounds.y, bounds.w, bounds.h);
}`

Left-mouse-button must be clicked and currently held down for an edit-box to be made active (show the caret).

However, if in a single event pump I push both the left-mouse-button down and left-mouse-button up, ctx->input->mouse.buttons[0].down is 0 and ctx->input->mouse.buttons[0].clicked is 2, and the edit-box is never made active.

Speaking specifically about Windows, is there some guarantee that each cycle of the event loop will only receive once mouse button event? The demos appear to work, but my code is a little more complicated, and yet I think it's only a matter of timing that the demos work, and if the events were delivered a little more batch-like, the demos would also fail.

What am I missing here?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the edit-box input handling shown in the issue and trace how the Windows event pump updates mouse button state when down and up arrive in one cycle. Reproduce the batched-event case and determine the expected activation behavior; done means the behavior is defined and the edit-box handles that event sequence consistently.

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
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.