Skip to content
This repository has been archived by the owner on Nov 24, 2024. It is now read-only.

Commit

Permalink
Added a flag to prevent window dragging
Browse files Browse the repository at this point in the history
Merged: rxi#50

Merge branch 'prevent-window-dragging' of github.com:valx76/microui
  • Loading branch information
namandixit committed Oct 29, 2024
2 parents 50b23b5 + b960eca commit 4b35d00
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/microui.c
Original file line number Diff line number Diff line change
Expand Up @@ -1118,7 +1118,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;
}
Expand Down
3 changes: 2 additions & 1 deletion src/microui.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 4b35d00

Please sign in to comment.