summaryrefslogtreecommitdiff
path: root/xcompmgr.c
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2004-08-14 21:39:51 +0000
committerKeith Packard <keithp@keithp.com>2004-08-14 21:39:51 +0000
commit576c3c435c1abc28b30fae0c74a4d875744d6a03 (patch)
treeb9f95f513348530a270414a4e034e2eaf9417441 /xcompmgr.c
parent018fc12ad45c012781a3e0fae297f4139b7b7b26 (diff)
Remove abort call as it's just annoying. Add -a flag to just use Automatic
compositing. No glitz, but no screen mangling either.
Diffstat (limited to 'xcompmgr.c')
-rw-r--r--xcompmgr.c45
1 files changed, 29 insertions, 16 deletions
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);