History

add "force redraw" to mu_render (redrawing when window is (un)hidden)

Sigrid Solveig Haflínudóttir committed 5 years ago

Commit 4fd28b31 parent ea55c033 files · +8 −4Browse files

Unified · Split

3 files
  1. demo/plan9.c +5 −1
  2. microui.c +2 −2
  3. microui.h +1 −1
demo/plan9.c+5−1
@@ -16,6 +16,7 @@ threadmain(int argc, char **argv) · 15 unmodified lines
1616 char *s;
1717 Biobuf *snarf;
1818 Keyboardctl *kctl;
19+ int redraw;
1920 Rune key;
2021 Mouse m;
2122 Alt a[] = {
@@ -50,11 +51,13 @@ threadmain(int argc, char **argv) · 28 unmodified lines
5051 process_frame();
5152
5253 oldbuttons = 0;
54+ redraw = 0;
5355 for (;;) {
5456 process_frame();
55− if (mu_render())
57+ if (mu_render(redraw))
5658 flushimage(display, 1);
5759
60+ redraw = 0;
5861 gotevent = 1;
5962 switch (alt(a)) {
6063 case 0: /* mouse */
@@ -79,6 +82,7 @@ threadmain(int argc, char **argv) · 18 unmodified lines
7982
8083 case 1: /* resize */
8184 getwindow(display, Refnone);
85+ redraw = 1;
8286 break;
8387
8488 case 2: /* keyboard */
microui.c+2−2
@@ -1436,12 +1436,12 @@ mu_end_panel(void) · 1435 unmodified lines
14361436 }
14371437
14381438 int
1439−mu_render(void)
1439+mu_render(int force)
14401440 {
14411441 mu_Command *cmd;
14421442 mu_Rect r, iconr;
14431443
1444− if (memcmp(&mu_ctx.screen, &screen->r, sizeof(mu_ctx.screen)) != 0)
1444+ if (force || !eqrect(mu_ctx.screen, screen->r) != 0)
14451445 mu_ctx.screen = screen->r;
14461446 else if (mu_ctx.oldcmdsnum == mu_ctx.cmdsnum && memcmp(mu_ctx.oldcmds, mu_ctx.cmds, mu_ctx.cmdsnum*sizeof(mu_Command)) == 0)
14471447 if (mu_ctx.oldstrnum == mu_ctx.strnum && memcmp(mu_ctx.oldstr, mu_ctx.str, mu_ctx.strnum) == 0)
microui.h+1−1
@@ -253,7 +253,7 @@ mu_Rect mu_rect(int x, int y, int w, int h); · 252 unmodified lines
253253 Image *mu_color(u8int r, u8int g, u8int b, u8int a);
254254
255255 void mu_init(void);
256−int mu_render(void);
256+int mu_render(int force);
257257 void mu_begin(void);
258258 void mu_end(void);
259259 void mu_set_focus(mu_Id id);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t