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

How do you detect if any window/control has focus and should be consuming mouse events or keyboard events?

Open
#155 8 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 am looking for a UI-agnostic function that will tell me if Nuklear made a change based on the input I just passed into it. Click and drag on a slider or the title bar are both cases of that. Probably need one to detect if keystrokes are consumed as well.

I tried using `nk_item_is_any_active` to detect the mouse case, and it seems to work a lot of the time. However when I click and drag a title bar fast enough, sometimes the function will return `false` and some input will leak through.

I am not quite sure if this is a bug report or a feature request, hence the phrasing of the issue.

-----

**Edit**:
I think this is an issue of documentation on how to use the library correctly.

If a user of the library calls `nk_item_is_any_active` and other such query functions after `nk_input.*` functions, but before any imperative UI functions, then the state will be out of sync. There should be some advice in the docs to avoid doing that, telling the user to always do nk UI update immediately after `nk_input_end`, and not call those UI query functions in between. Users can call `nk_item_is_any_active` (and similar functions) any time outside that block and it will work correctly.

Contributor guide

Open the contributing guide

Research direction

Start by locating the documentation for nk_item_is_any_active, related query functions, nk_input.*, and nk_input_end. Document that UI update calls should happen immediately after nk_input_end, without query calls in between; done means the guidance explains how to keep input state synchronized.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
documentation
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.