shithub: microui

Download patch

ref: c593f40ab531d3f17ae7c728e752eaf4ad78d73d
parent: 5f253eb525bc296585b9e7879a40ce43f0db034f
author: Sigrid Haflínudóttir <[email protected]>
date: Tue Jan 7 18:35:36 EST 2020

move all windows using the background

--- a/microui.c
+++ b/microui.c
@@ -1288,24 +1288,28 @@
 	if (~opt & MU_OPT_NOFRAME)
 		draw_frame(rect, MU_COLOR_WINDOWBG);
 
+	if (mu_ctx.focus == 0 && mu_ctx.mouse_down == MU_MOUSE_LEFT) {
+		cnt->rect.x += mu_ctx.mouse_delta.x;
+		cnt->rect.y += mu_ctx.mouse_delta.y;
+	}
+
 	/* do title bar */
 	titlerect = rect;
 	titlerect.h = mu_style.title_height;
 	if (~opt & MU_OPT_NOTITLE) {
+		mu_Id id = mu_get_id("!title", 6);
+
 		draw_frame(titlerect, MU_COLOR_TITLEBG);
 
 		/* do title text */
-		if (~opt & MU_OPT_NOTITLE) {
-			mu_Id id = mu_get_id("!title", 6);
-			mu_update_control(id, titlerect, opt);
-			mu_draw_control_text(title, titlerect, MU_COLOR_TITLETEXT, opt);
-			if (id == mu_ctx.focus && mu_ctx.mouse_down == MU_MOUSE_LEFT) {
-				cnt->rect.x += mu_ctx.mouse_delta.x;
-				cnt->rect.y += mu_ctx.mouse_delta.y;
-			}
-			body.y += titlerect.h;
-			body.h -= titlerect.h;
+		mu_update_control(id, titlerect, opt);
+		mu_draw_control_text(title, titlerect, MU_COLOR_TITLETEXT, opt);
+		if (id == mu_ctx.focus && mu_ctx.mouse_down == MU_MOUSE_LEFT) {
+			cnt->rect.x += mu_ctx.mouse_delta.x;
+			cnt->rect.y += mu_ctx.mouse_delta.y;
 		}
+		body.y += titlerect.h;
+		body.h -= titlerect.h;
 
 		/* do `close` button */
 		if (~opt & MU_OPT_NOCLOSE) {