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