Unified · Split
| @@ -16,6 +16,7 @@ threadmain(int argc, char **argv) · 15 unmodified lines | ||
| 16 | 16 | char *s; |
| 17 | 17 | Biobuf *snarf; |
| 18 | 18 | Keyboardctl *kctl; |
| 19 | + int redraw; | |
| 19 | 20 | Rune key; |
| 20 | 21 | Mouse m; |
| 21 | 22 | Alt a[] = { |
| @@ -50,11 +51,13 @@ threadmain(int argc, char **argv) · 28 unmodified lines | ||
| 50 | 51 | process_frame(); |
| 51 | 52 | |
| 52 | 53 | oldbuttons = 0; |
| 54 | + redraw = 0; | |
| 53 | 55 | for (;;) { |
| 54 | 56 | process_frame(); |
| 55 | − if (mu_render()) | |
| 57 | + if (mu_render(redraw)) | |
| 56 | 58 | flushimage(display, 1); |
| 57 | 59 | |
| 60 | + redraw = 0; | |
| 58 | 61 | gotevent = 1; |
| 59 | 62 | switch (alt(a)) { |
| 60 | 63 | case 0: /* mouse */ |
| @@ -79,6 +82,7 @@ threadmain(int argc, char **argv) · 18 unmodified lines | ||
| 79 | 82 | |
| 80 | 83 | case 1: /* resize */ |
| 81 | 84 | getwindow(display, Refnone); |
| 85 | + redraw = 1; | |
| 82 | 86 | break; |
| 83 | 87 | |
| 84 | 88 | case 2: /* keyboard */ |
| @@ -1436,12 +1436,12 @@ mu_end_panel(void) · 1435 unmodified lines | ||
| 1436 | 1436 | } |
| 1437 | 1437 | |
| 1438 | 1438 | int |
| 1439 | −mu_render(void) | |
| 1439 | +mu_render(int force) | |
| 1440 | 1440 | { |
| 1441 | 1441 | mu_Command *cmd; |
| 1442 | 1442 | mu_Rect r, iconr; |
| 1443 | 1443 | |
| 1444 | − if (memcmp(&mu_ctx.screen, &screen->r, sizeof(mu_ctx.screen)) != 0) | |
| 1444 | + if (force || !eqrect(mu_ctx.screen, screen->r) != 0) | |
| 1445 | 1445 | mu_ctx.screen = screen->r; |
| 1446 | 1446 | else if (mu_ctx.oldcmdsnum == mu_ctx.cmdsnum && memcmp(mu_ctx.oldcmds, mu_ctx.cmds, mu_ctx.cmdsnum*sizeof(mu_Command)) == 0) |
| 1447 | 1447 | if (mu_ctx.oldstrnum == mu_ctx.strnum && memcmp(mu_ctx.oldstr, mu_ctx.str, mu_ctx.strnum) == 0) |
| @@ -253,7 +253,7 @@ mu_Rect mu_rect(int x, int y, int w, int h); · 252 unmodified lines | ||
| 253 | 253 | Image *mu_color(u8int r, u8int g, u8int b, u8int a); |
| 254 | 254 | |
| 255 | 255 | void mu_init(void); |
| 256 | −int mu_render(void); | |
| 256 | +int mu_render(int force); | |
| 257 | 257 | void mu_begin(void); |
| 258 | 258 | void mu_end(void); |
| 259 | 259 | void mu_set_focus(mu_Id id); |