ref: 920994c010d4539e1cf5965d55e51dcb4f8ccacf
parent: d68acf09fc4454cb4642034dd5e4275c6971ac05
author: Sigrid Haflínudóttir <[email protected]>
date: Sun Jan 12 18:24:54 EST 2020
fix "moving all windows by dragging background": only move when started in the background
--- a/microui.c
+++ b/microui.c
@@ -1288,7 +1288,12 @@
if (~opt & MU_OPT_NOFRAME)
draw_frame(rect, MU_COLOR_WINDOWBG);
- if (mu_ctx.focus == 0 && mu_ctx.mouse_down == MU_MOUSE_LEFT) {
+ /* moving all windows by "dragging" background */
+ if (mu_ctx.last_hover_root == nil && mu_ctx.hover_root == nil && mu_ctx.mouse_pressed == MU_MOUSE_LEFT)
+ mu_ctx.moving = 1;
+ else if (mu_ctx.mouse_down != MU_MOUSE_LEFT)
+ mu_ctx.moving = 0;
+ if (mu_ctx.moving) {
cnt->rect.x += mu_ctx.mouse_delta.x;
cnt->rect.y += mu_ctx.mouse_delta.y;
}
--- a/microui.h
+++ b/microui.h
@@ -205,6 +205,7 @@
char number_buf[MU_MAX_FMT];
mu_Id number_editing;
Rectangle screen;
+ int moving;
/* buffers */
char *str, *oldstr;