From 576c3c435c1abc28b30fae0c74a4d875744d6a03 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Sat, 14 Aug 2004 21:39:51 +0000 Subject: [PATCH] Remove abort call as it's just annoying. Add -a flag to just use Automatic compositing. No glitz, but no screen mangling either. --- ChangeLog | 7 +++++++ xcompmgr.c | 45 +++++++++++++++++++++++++++++---------------- 2 files changed, 36 insertions(+), 16 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0d75401..0a87f12 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2004-08-14 Keith Packard + + * xcompmgr.c: (error), (usage), (main): + Remove abort call as it's just annoying. + Add -a flag to just use Automatic compositing. No glitz, but no + screen mangling either. + 2004-08-13 Keith Packard * xcompmgr.c: (paint_all), (repair_win), (map_win), diff --git a/xcompmgr.c b/xcompmgr.c index 7a603bb..3d78783 100644 --- a/xcompmgr.c +++ b/xcompmgr.c @@ -168,6 +168,8 @@ int fade_delta = 10; int fade_time = 0; Bool fadeWindows; +Bool autoRedirect = False; + int get_time_in_milliseconds () { @@ -1543,7 +1545,7 @@ error (Display *dpy, XErrorEvent *ev) printf ("error %d request %d minor %d serial %d\n", ev->error_code, ev->request_code, ev->minor_code, ev->serial); - abort (); +/* abort (); this is just annoying to most people */ return 0; } @@ -1612,7 +1614,7 @@ ev_window (XEvent *ev) void usage (char *program) { - fprintf (stderr, "usage: %s [-d display] [-n] [-s] [-c]\n", program); + fprintf (stderr, "usage: %s [-d display] [-n] [-s] [-c] [-a]\n", program); exit (1); } @@ -1640,7 +1642,7 @@ main (int argc, char **argv) char *display = 0; int o; - while ((o = getopt (argc, argv, "d:scnfS")) != -1) + while ((o = getopt (argc, argv, "d:scnfaS")) != -1) { switch (o) { case 'd': @@ -1658,6 +1660,9 @@ main (int argc, char **argv) case 'f': fadeWindows = True; break; + case 'a': + autoRedirect = True; + break; case 'S': synchronize = True; break; @@ -1728,24 +1733,32 @@ main (int argc, char **argv) allDamage = None; clipChanged = True; XGrabServer (dpy); - XCompositeRedirectSubwindows (dpy, root, CompositeRedirectManual); - XSelectInput (dpy, root, - SubstructureNotifyMask| - ExposureMask| - StructureNotifyMask| - PropertyChangeMask); - XQueryTree (dpy, root, &root_return, &parent_return, &children, &nchildren); - for (i = 0; i < nchildren; i++) - add_win (dpy, children[i], i ? children[i-1] : None); - XFree (children); + if (autoRedirect) + XCompositeRedirectSubwindows (dpy, root, CompositeRedirectAutomatic); + else + { + XCompositeRedirectSubwindows (dpy, root, CompositeRedirectManual); + XSelectInput (dpy, root, + SubstructureNotifyMask| + ExposureMask| + StructureNotifyMask| + PropertyChangeMask); + XQueryTree (dpy, root, &root_return, &parent_return, &children, &nchildren); + for (i = 0; i < nchildren; i++) + add_win (dpy, children[i], i ? children[i-1] : None); + XFree (children); + } XUngrabServer (dpy); ufd.fd = ConnectionNumber (dpy); ufd.events = POLLIN; - paint_all (dpy, None); + if (!autoRedirect) + paint_all (dpy, None); for (;;) { /* dump_wins (); */ do { + if (autoRedirect) + XFlush (dpy); if (!QLength (dpy)) { if (poll (&ufd, 1, fade_timeout()) == 0) @@ -1762,7 +1775,7 @@ main (int argc, char **argv) printf ("event %10.10s serial 0x%08x window 0x%08x\n", ev_name(&ev), ev_serial (&ev), ev_window (&ev)); #endif - switch (ev.type) { + if (!autoRedirect) switch (ev.type) { case CreateNotify: add_win (dpy, ev.xcreatewindow.window, 0); break; @@ -1850,7 +1863,7 @@ main (int argc, char **argv) break; } } while (QLength (dpy)); - if (allDamage) + if (allDamage && !autoRedirect) { static int paint; paint_all (dpy, allDamage);