diff --git a/xwin.c b/xwin.c index b60ea4d..a2a08bc 100644 --- a/xwin.c +++ b/xwin.c @@ -35,6 +35,8 @@ #include /* for exit() */ #endif +#include + /* * IMPORTS: routines that this module vectors out to */ @@ -67,6 +69,11 @@ extern void xdrawrect(); */ static void help_popup(); static void help_popdown(); +static struct timeval last_repaint; +static long int timediff(struct timeval* t1, struct timeval* t2) +{ + return 1000000 * (t2->tv_sec - t1->tv_sec) + t2->tv_usec - t1->tv_usec; +} static String fallback_resources[] = { "*window.width: 600", @@ -338,10 +345,20 @@ static void c_resize(Widget w, XtPointer data, XEvent* event, Boolean* continue_to_dispatch) { UNUSED(w, data, event, continue_to_dispatch); - /* - * printf("Resize\n"); - */ + /* + * printf("Resize\n"); + */ + long int diff; + struct timeval t; + + gettimeofday(&t, NULL); + diff = timediff(&last_repaint, &t); + + if (diff < (long int)50000) + return; xrepaint(); + + gettimeofday(&last_repaint, NULL); } static void @@ -351,6 +368,14 @@ c_repaint(Widget w, XtPointer data, XEvent* event, Boolean* continue_to_dispatch /* * printf("Expose\n"); */ + long int diff; + struct timeval t; + + gettimeofday(&t, NULL); + diff = timediff(&last_repaint, &t); + + if (diff < (long int)50000) + return; xrepaint_noclear(); }