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

x11_rawfb: nk_edit_string right border cutoff

Open
#165 1 comment 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 attempting to use an adaptation of the x11_rawfb driver for some software-rendered GUI's, and I'm running into trouble where it appears that whatever is drawing the edit string widget is cutting off the right side of the widget. Here is a simple reproducer, done with the original x11_rawfb driver to show it happens with the original.

```c
/* GUI */
if (nk_begin(&rawfb->ctx, "Demo", nk_rect(50, 50, 200, 200),
NK_WINDOW_BORDER|NK_WINDOW_MOVABLE|NK_WINDOW_SCALABLE|
NK_WINDOW_CLOSABLE|NK_WINDOW_MINIMIZABLE|NK_WINDOW_TITLE)) {
char input[64];
int inputlen = 0;
nk_layout_row_dynamic(&rawfb->ctx, 0, 1);
nk_edit_string(&rawfb->ctx, NK_EDIT_SIMPLE, &input[0], &inputlen, 64, nk_filter_default);
}
nk_end(&rawfb->ctx);
```

This results in this output:

![](https://i.imgur.com/GljDVHq.png)

I have not extensively tested other widgets.

After examining the draw calls from my app, I have determined that the widget is attempting to draw a rectangle 1px outside of the right scissor. I think that the obvious solution would be to subtract one from the rectangle's x2 and y2 when stroking it, so you end up with a rectangle that fits within the scissor bounds, but I'm unsure what other wider ramifications such a change might have.

Contributor guide

Open the contributing guide

Research direction

Start with the x11_rawfb driver and the provided nk_edit_string reproducer, then inspect the draw calls and scissor bounds around the edit-string widget. The work is done when the widget's right border renders fully within its scissor region without regressing other widgets.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
desktop
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.