Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xlib: Images cause scrollable content to break #729

Open
purpasmart96 opened this issue Nov 8, 2024 · 0 comments
Open

xlib: Images cause scrollable content to break #729

purpasmart96 opened this issue Nov 8, 2024 · 0 comments

Comments

@purpasmart96
Copy link

In the pure x11 demo, after enabling stb_image and loading your images via the nk_xsurf_load_image_from_file function

You then use that loaded image later on in for example nk_button_image_label(ctx, icon, "text1", NK_TEXT_CENTERED);

However if any content in that window is scrollable it causes weird rendering/clipping issues.

Here it is when there is scrolling

Screenshot_20241108_125410

And when there is no scrolling

Screenshot_20241108_125601

This issue goes away if I forgo the image/icon by doing nk_button_label(ctx, "text1"); instead, but that kinda defeats the whole point of having image loading support.

To reproduce my examples add the following to demo/x11/main.c
line 17:
#define NK_XLIB_INCLUDE_STB_IMAGE
#define NK_XLIB_IMPLEMENT_STB_IMAGE

line 154:

// Make sure the is a image file named 'image.png' in the directory you launch the demo
struct nk_image icon = nk_xsurf_load_image_from_file("image.png");

line 177:

nk_layout_row_dynamic(ctx, 64, 3);
nk_button_image_label(ctx, icon, "text1", NK_TEXT_CENTERED);
nk_button_image_label(ctx, icon, "text1", NK_TEXT_CENTERED);
nk_button_image_label(ctx, icon, "text1", NK_TEXT_CENTERED);

I believe I also had change the makefile to use C99 instead of C89 so that stb_image would compile.

Please let me know if I'm doing anything, wrong or if you guys need more info.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant