shithub: microui

Download patch

ref: 3350c9a0fe782a1fe7bf8b2c564f559942e3dee9
parent: 08c3a17463e398956fb086885edf6f57f5d7c6d1
author: rxi <rxi@users.noreply.github.com>
date: Thu Apr 18 15:01:37 EDT 2019

Removed window resize icon and extra footer spacing

--- a/demo/atlas.inl
+++ b/demo/atlas.inl
@@ -894,7 +894,6 @@
   [ MU_ICON_CHECK ] = { 0, 0, 18, 18 },
   [ MU_ICON_EXPANDED ] = { 118, 68, 7, 5 },
   [ MU_ICON_COLLAPSED ] = { 113, 68, 5, 7 },
-  [ MU_ICON_RESIZE ] = { 104, 68, 9, 9 },
   [ ATLAS_WHITE ] = { 125, 68, 3, 3 },
   [ ATLAS_FONT+32 ] = { 84, 68, 2, 17 },
   [ ATLAS_FONT+33 ] = { 39, 68, 3, 17 },
--- a/src/microui.c
+++ b/src/microui.c
@@ -55,7 +55,7 @@
   NULL,       /* font */
   { 68, 10 }, /* size */
   6, 4, 24,   /* padding, spacing, indent */
-  26, 20,     /* title_height, footer_height */
+  26,         /* title_height */
   12, 8,      /* scrollbar_size, thumb_size */
   {
     { 230, 230, 230, 255 }, /* MU_COLOR_TEXT */
@@ -1020,7 +1020,6 @@
   mu_Context *ctx, mu_Container *cnt, mu_Rect body, int opt
 ) {
   if (~opt & MU_OPT_NOSCROLL) { scrollbars(ctx, cnt, &body); }
-  mu_push_clip_rect(ctx, body);
   push_layout(ctx, expand_rect(body, -ctx->style->padding), cnt->scroll);
   cnt->body = body;
 }
@@ -1110,25 +1109,20 @@
     }
   }
 
-  /* do `resize` notch */
+  push_container_body(ctx, cnt, body, opt);
+
+  /* do `resize` handle */
   if (~opt & MU_OPT_NORESIZE) {
-    int sz = ctx->style->footer_height;
+    int sz = ctx->style->title_height;
     mu_Id id = mu_get_id(ctx, "!resize", 7);
     mu_Rect r = mu_rect(rect.x + rect.w - sz, rect.y + rect.h - sz, sz, sz);
     mu_update_control(ctx, id, r, opt);
-    mu_draw_icon(ctx, MU_ICON_RESIZE, r, ctx->style->colors[MU_COLOR_TEXT]);
     if (id == ctx->focus && ctx->mouse_down == MU_MOUSE_LEFT) {
-      cnt->rect.w += ctx->mouse_delta.x;
-      cnt->rect.h += ctx->mouse_delta.y;
-      cnt->rect.w = mu_max(96, cnt->rect.w);
-      cnt->rect.h = mu_max(64, cnt->rect.h);
+      cnt->rect.w = mu_max(96, cnt->rect.w + ctx->mouse_delta.x);
+      cnt->rect.h = mu_max(64, cnt->rect.h + ctx->mouse_delta.y);
     }
-    body.h -= sz;
   }
 
-  /* do scrollbars and init clipping */
-  push_container_body(ctx, cnt, body, opt);
-
   /* resize to content size */
   if (opt & MU_OPT_AUTOSIZE) {
     mu_Rect r = get_layout(ctx)->body;
@@ -1141,6 +1135,7 @@
     cnt->open = 0;
   }
 
+  mu_push_clip_rect(ctx, cnt->body);
   return MU_RES_ACTIVE;
 }
 
@@ -1187,6 +1182,7 @@
   }
   push_container(ctx, cnt);
   push_container_body(ctx, cnt, cnt->rect, opt);
+  mu_push_clip_rect(ctx, cnt->body);
 }
 
 
--- a/src/microui.h
+++ b/src/microui.h
@@ -10,7 +10,7 @@
 
 #include <stdlib.h>
 
-#define MU_VERSION "1.01"
+#define MU_VERSION "1.0"
 
 #define MU_COMMANDLIST_SIZE     (1024 * 256)
 #define MU_ROOTLIST_SIZE        32
@@ -64,7 +64,6 @@
 
 enum {
   MU_ICON_CLOSE = 1,
-  MU_ICON_RESIZE,
   MU_ICON_CHECK,
   MU_ICON_COLLAPSED,
   MU_ICON_EXPANDED,
@@ -168,7 +167,6 @@
   int spacing;
   int indent;
   int title_height;
-  int footer_height;
   int scrollbar_size;
   int thumb_size;
   mu_Color colors[MU_COLOR_MAX];