From bf3d57cdbfc2152fba99ca939fe1af57d37516e2 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Fri, 14 Jul 2023 11:25:50 +0900 Subject: [PATCH] [ui] Return whether events to imui were consumed Needed for non-ui handling of events (eg, mouse interaction with the main screen). --- include/QF/ui/imui.h | 2 +- libs/ui/imui.c | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/include/QF/ui/imui.h b/include/QF/ui/imui.h index 6ce0b403d..69821ada6 100644 --- a/include/QF/ui/imui.h +++ b/include/QF/ui/imui.h @@ -99,7 +99,7 @@ void IMUI_DestroyContext (imui_ctx_t *ctx); void IMUI_SetVisible (imui_ctx_t *ctx, bool visible); void IMUI_SetSize (imui_ctx_t *ctx, int xlen, int ylen); -void IMUI_ProcessEvent (imui_ctx_t *ctx, const struct IE_event_s *ie_event); +bool IMUI_ProcessEvent (imui_ctx_t *ctx, const struct IE_event_s *ie_event); void IMUI_BeginFrame (imui_ctx_t *ctx); void IMUI_Draw (imui_ctx_t *ctx); diff --git a/libs/ui/imui.c b/libs/ui/imui.c index d8023aa75..26489240d 100644 --- a/libs/ui/imui.c +++ b/libs/ui/imui.c @@ -307,7 +307,7 @@ IMUI_SetSize (imui_ctx_t *ctx, int xlen, int ylen) Canvas_SetLen (ctx->csys, ctx->canvas, (view_pos_t) { xlen, ylen }); } -void +bool IMUI_ProcessEvent (imui_ctx_t *ctx, const IE_event_t *ie_event) { if (ie_event->type == ie_mouse) { @@ -326,6 +326,7 @@ IMUI_ProcessEvent (imui_ctx_t *ctx, const IE_event_t *ie_event) ctx->key_code = k->code; ctx->unicode = k->unicode; } + return ctx->hot != nullent || ctx->active != nullent; } void