diff --git a/demo.c b/demo.c index 956b574..712ddf2 100644 --- a/demo.c +++ b/demo.c @@ -176,7 +176,7 @@ test_window(mu_Context* ctx) static void log_window(mu_Context* ctx) { - if (mu_begin_window(ctx, "Log Window", mu_rect(350, 40, 300, 200))) { + if (mu_begin_window_ex(ctx, "Log Window", mu_rect(350, 40, 300, 200), MU_OPT_NODRAG)) { /* output text panel */ mu_layout_row(ctx, 1, (int[]) { -1 }, -25); mu_begin_panel(ctx, "Log Output"); diff --git a/demo.sunder b/demo.sunder index 04b0a80..c56b0e1 100644 --- a/demo.sunder +++ b/demo.sunder @@ -168,7 +168,7 @@ func test_window(ui: *smol::ui) void { var textbox_buffer = (:[128]char)[0...]; func log_window(ui: *smol::ui) void { - if ui.*.begin_window("Log Window", smol::rect::init(350, 40, 300, 200)) { + if ui.*.begin_window_ex("Log Window", smol::rect::init(350, 40, 300, 200), smol::OPT_NODRAG) { # output text panel ui.*.layout_row((:[]sint)[-1], -25); ui.*.begin_panel("Log Output"); diff --git a/microui.c b/microui.c index 959760a..256f0cc 100644 --- a/microui.c +++ b/microui.c @@ -1220,7 +1220,7 @@ mu_begin_window_ex(mu_Context* ctx, char const* 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/microui.h b/microui.h index 3b7d239..ee4b042 100644 --- a/microui.h +++ b/microui.h @@ -85,11 +85,12 @@ enum { MU_OPT_NOSCROLL = (1 << 5), MU_OPT_NOCLOSE = (1 << 6), MU_OPT_NOTITLE = (1 << 7), - MU_OPT_HOLDFOCUS = (1 << 8), - MU_OPT_AUTOSIZE = (1 << 9), - MU_OPT_POPUP = (1 << 10), - MU_OPT_CLOSED = (1 << 11), - MU_OPT_EXPANDED = (1 << 12) + MU_OPT_NODRAG = (1 << 8), + MU_OPT_HOLDFOCUS = (1 << 9), + MU_OPT_AUTOSIZE = (1 << 10), + MU_OPT_POPUP = (1 << 11), + MU_OPT_CLOSED = (1 << 12), + MU_OPT_EXPANDED = (1 << 13) }; enum { diff --git a/microui.sunder b/microui.sunder index 5830506..42f9fe2 100644 --- a/microui.sunder +++ b/microui.sunder @@ -58,11 +58,12 @@ let MU_OPT_NORESIZE = (:sint)(1u << 4); let MU_OPT_NOSCROLL = (:sint)(1u << 5); let MU_OPT_NOCLOSE = (:sint)(1u << 6); let MU_OPT_NOTITLE = (:sint)(1u << 7); -let MU_OPT_HOLDFOCUS = (:sint)(1u << 8); -let MU_OPT_AUTOSIZE = (:sint)(1u << 9); -let MU_OPT_POPUP = (:sint)(1u << 10); -let MU_OPT_CLOSED = (:sint)(1u << 11); -let MU_OPT_EXPANDED = (:sint)(1u << 12); +let MU_OPT_NODRAG = (:sint)(1u << 8); +let MU_OPT_HOLDFOCUS = (:sint)(1u << 9); +let MU_OPT_AUTOSIZE = (:sint)(1u << 10); +let MU_OPT_POPUP = (:sint)(1u << 11); +let MU_OPT_CLOSED = (:sint)(1u << 12); +let MU_OPT_EXPANDED = (:sint)(1u << 13); let MU_MOUSE_LEFT = (:sint)(1u << 0); let MU_MOUSE_RIGHT = (:sint)(1u << 1); diff --git a/smolui.sunder b/smolui.sunder index 48fff5d..ae3a8fe 100644 --- a/smolui.sunder +++ b/smolui.sunder @@ -39,6 +39,7 @@ let OPT_NORESIZE = MU_OPT_NORESIZE; let OPT_NOSCROLL = MU_OPT_NOSCROLL; let OPT_NOCLOSE = MU_OPT_NOCLOSE; let OPT_NOTITLE = MU_OPT_NOTITLE; +let OPT_NODRAG = MU_OPT_NODRAG; let OPT_HOLDFOCUS = MU_OPT_HOLDFOCUS; let OPT_AUTOSIZE = MU_OPT_AUTOSIZE; let OPT_POPUP = MU_OPT_POPUP;