Immediate-Mode-UI / Immediate-Mode-UI/Nuklear
nk_window_set_focus on background window
- Dominant language
- C
- Stars
- 11.4k
- Forks
- 686
- Avg merge
- 4d 1h
- Merged PRs (30d)
- 3
Description
If we set focus on background window, it is brought to the front. In my use case it overlapped all other windows (and window was not moveable). I think the solution is to change line:
```
nk_insert_window(ctx, win, NK_INSERT_BACK);
```
of [nk_window_set_focus function](https://github.com/Immediate-Mode-UI/Nuklear/blob/11d8acfd4fbb9d0966161fa01d58be15be1974e3/src/nuklear_window.c#L668) to following:
```
if (win->flags & NK_WINDOW_BACKGROUND)
nk_insert_window(ctx, win, NK_INSERT_FRONT);
else
nk_insert_window(ctx, win, NK_INSERT_BACK);
```
This way background window gets focus and it remains in background.
Contributor guide
Research direction
Start in src/nuklear_window.c at nk_window_set_focus, specifically the nk_insert_window call around line 668. Check how NK_WINDOW_BACKGROUND windows are ordered, then verify that focusing one leaves it behind other windows rather than bringing it to the front.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c
- Domain
- desktop
- Issue type
- Bug
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 48/100