From b960eca6c7505fe9a684de501eed7f2ae6793fa2 Mon Sep 17 00:00:00 2001 From: Valentin PONS Date: Sat, 7 Aug 2021 11:22:59 +0200 Subject: [PATCH] Added a flag to prevent window dragging --- src/microui.c | 2 +- src/microui.h | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/microui.c b/src/microui.c index a8a3f74..db3d9fa 100644 --- a/src/microui.c +++ b/src/microui.c @@ -1107,7 +1107,7 @@ int mu_begin_window_ex(mu_Context *ctx, const char *title, mu_Rect rect, int opt mu_Id id = mu_get_id(ctx, "!title", 6); mu_update_control(ctx, id, tr, opt); mu_draw_control_text(ctx, title, tr, MU_COLOR_TITLETEXT, opt); - if (id == ctx->focus && ctx->mouse_down == MU_MOUSE_LEFT) { + if (id == ctx->focus && ctx->mouse_down == MU_MOUSE_LEFT && ~opt & MU_OPT_NODRAG) { cnt->rect.x += ctx->mouse_delta.x; cnt->rect.y += ctx->mouse_delta.y; } diff --git a/src/microui.h b/src/microui.h index 78a1a34..8d4caf3 100644 --- a/src/microui.h +++ b/src/microui.h @@ -88,7 +88,8 @@ enum { MU_OPT_AUTOSIZE = (1 << 9), MU_OPT_POPUP = (1 << 10), MU_OPT_CLOSED = (1 << 11), - MU_OPT_EXPANDED = (1 << 12) + MU_OPT_EXPANDED = (1 << 12), + MU_OPT_NODRAG = (1 << 13) }; enum {