Skip to content

Commit e562d1b

Browse files
committed
Correctly handle hover in popup windows
1 parent 171090c commit e562d1b

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

nuklear.h

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23500,7 +23500,8 @@ nk_widget_is_hovered(const struct nk_context *ctx)
2350023500
struct nk_rect bounds;
2350123501
NK_ASSERT(ctx);
2350223502
NK_ASSERT(ctx->current);
23503-
if (!ctx || !ctx->current || ctx->active != ctx->current)
23503+
NK_ASSERT(ctx->current->layout);
23504+
if (!ctx || !ctx->current || !ctx->current->layout || (ctx->active != ctx->current && !((int)ctx->current->layout->type & (int)NK_PANEL_SET_POPUP)))
2350423505
return 0;
2350523506

2350623507
c = ctx->current->layout->clip;
@@ -23522,7 +23523,8 @@ nk_widget_is_mouse_clicked(const struct nk_context *ctx, enum nk_buttons btn)
2352223523
struct nk_rect bounds;
2352323524
NK_ASSERT(ctx);
2352423525
NK_ASSERT(ctx->current);
23525-
if (!ctx || !ctx->current || ctx->active != ctx->current)
23526+
NK_ASSERT(ctx->current->layout);
23527+
if (!ctx || !ctx->current || !ctx->current->layout || (ctx->active != ctx->current && !((int)ctx->current->layout->type & (int)NK_PANEL_SET_POPUP)))
2352623528
return 0;
2352723529

2352823530
c = ctx->current->layout->clip;
@@ -23544,7 +23546,8 @@ nk_widget_has_mouse_click_down(const struct nk_context *ctx, enum nk_buttons btn
2354423546
struct nk_rect bounds;
2354523547
NK_ASSERT(ctx);
2354623548
NK_ASSERT(ctx->current);
23547-
if (!ctx || !ctx->current || ctx->active != ctx->current)
23549+
NK_ASSERT(ctx->current->layout);
23550+
if (!ctx || !ctx->current || !ctx->current->layout || (ctx->active != ctx->current && !((int)ctx->current->layout->type & (int)NK_PANEL_SET_POPUP)))
2354823551
return 0;
2354923552

2355023553
c = ctx->current->layout->clip;

0 commit comments

Comments
 (0)