Eliminate all delays in updates; let the X server scheduling handle things.

This commit is contained in:
Keith Packard 2003-11-14 08:29:37 +00:00
parent bb2f664686
commit f0000349e7
2 changed files with 19 additions and 1 deletions

View File

@ -1,3 +1,9 @@
2003-11-14 Keith Packard <keithp@keithp.com>
* xcompmgr.c: (main):
Eliminate all delays in updates; let the X server scheduling
handle things.
2003-11-13 Keith Packard <keithp@keithp.com> 2003-11-13 Keith Packard <keithp@keithp.com>
* xcompmgr.c: * xcompmgr.c:

View File

@ -768,7 +768,7 @@ time_in_millis ()
return(tp.tv_sec * 1000) + (tp.tv_usec / 1000); return(tp.tv_sec * 1000) + (tp.tv_usec / 1000);
} }
#define INTERVAL 10 #define INTERVAL 0
main () main ()
{ {
@ -792,7 +792,9 @@ main ()
int n; int n;
int last_update; int last_update;
int now; int now;
#if INTERVAL
int timeout; int timeout;
#endif
dpy = XOpenDisplay (0); dpy = XOpenDisplay (0);
if (!dpy) if (!dpy)
@ -863,15 +865,21 @@ main ()
XFree (children); XFree (children);
XUngrabServer (dpy); XUngrabServer (dpy);
paint_all (dpy, None); paint_all (dpy, None);
#if INTERVAL
last_update = time_in_millis (); last_update = time_in_millis ();
#endif
for (;;) for (;;)
{ {
#if INTERVAL
int busy_start = 0; int busy_start = 0;
#endif
/* dump_wins (); */ /* dump_wins (); */
do { do {
XNextEvent (dpy, &ev); XNextEvent (dpy, &ev);
#if INTERVAL
if (!busy_start) if (!busy_start)
busy_start = time_in_millis(); busy_start = time_in_millis();
#endif
/* printf ("event %d\n", ev.type); */ /* printf ("event %d\n", ev.type); */
switch (ev.type) { switch (ev.type) {
case CreateNotify: case CreateNotify:
@ -943,6 +951,7 @@ main ()
break; break;
} }
} while (XEventsQueued (dpy, QueuedAfterReading)); } while (XEventsQueued (dpy, QueuedAfterReading));
#if INTERVAL
now = time_in_millis (); now = time_in_millis ();
/* printf ("\t\tbusy %d\n", now - busy_start); */ /* printf ("\t\tbusy %d\n", now - busy_start); */
timeout = INTERVAL - (now - last_update); timeout = INTERVAL - (now - last_update);
@ -954,11 +963,14 @@ main ()
if (n > 0 && (ufd.revents & POLLIN) && XEventsQueued (dpy, QueuedAfterReading)) if (n > 0 && (ufd.revents & POLLIN) && XEventsQueued (dpy, QueuedAfterReading))
continue; continue;
} }
#endif
if (allDamage) if (allDamage)
{ {
#if INTERVAL
int old_update = last_update; int old_update = last_update;
last_update = time_in_millis(); last_update = time_in_millis();
/* printf ("delta %d\n", last_update - old_update); */ /* printf ("delta %d\n", last_update - old_update); */
#endif
paint_all (dpy, allDamage); paint_all (dpy, allDamage);
allDamage = None; allDamage = None;
} }