Remove abort call as it's just annoying. Add -a flag to just use Automatic

compositing. No glitz, but no screen mangling either.
This commit is contained in:
Keith Packard 2004-08-14 21:39:51 +00:00
parent 018fc12ad4
commit 576c3c435c
2 changed files with 36 additions and 16 deletions

View File

@ -1,3 +1,10 @@
2004-08-14 Keith Packard <keithp@keithp.com>
* 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 <keithp@keithp.com> 2004-08-13 Keith Packard <keithp@keithp.com>
* xcompmgr.c: (paint_all), (repair_win), (map_win), * xcompmgr.c: (paint_all), (repair_win), (map_win),

View File

@ -168,6 +168,8 @@ int fade_delta = 10;
int fade_time = 0; int fade_time = 0;
Bool fadeWindows; Bool fadeWindows;
Bool autoRedirect = False;
int int
get_time_in_milliseconds () get_time_in_milliseconds ()
{ {
@ -1543,7 +1545,7 @@ error (Display *dpy, XErrorEvent *ev)
printf ("error %d request %d minor %d serial %d\n", printf ("error %d request %d minor %d serial %d\n",
ev->error_code, ev->request_code, ev->minor_code, ev->serial); ev->error_code, ev->request_code, ev->minor_code, ev->serial);
abort (); /* abort (); this is just annoying to most people */
return 0; return 0;
} }
@ -1612,7 +1614,7 @@ ev_window (XEvent *ev)
void void
usage (char *program) 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); exit (1);
} }
@ -1640,7 +1642,7 @@ main (int argc, char **argv)
char *display = 0; char *display = 0;
int o; int o;
while ((o = getopt (argc, argv, "d:scnfS")) != -1) while ((o = getopt (argc, argv, "d:scnfaS")) != -1)
{ {
switch (o) { switch (o) {
case 'd': case 'd':
@ -1658,6 +1660,9 @@ main (int argc, char **argv)
case 'f': case 'f':
fadeWindows = True; fadeWindows = True;
break; break;
case 'a':
autoRedirect = True;
break;
case 'S': case 'S':
synchronize = True; synchronize = True;
break; break;
@ -1728,6 +1733,10 @@ main (int argc, char **argv)
allDamage = None; allDamage = None;
clipChanged = True; clipChanged = True;
XGrabServer (dpy); XGrabServer (dpy);
if (autoRedirect)
XCompositeRedirectSubwindows (dpy, root, CompositeRedirectAutomatic);
else
{
XCompositeRedirectSubwindows (dpy, root, CompositeRedirectManual); XCompositeRedirectSubwindows (dpy, root, CompositeRedirectManual);
XSelectInput (dpy, root, XSelectInput (dpy, root,
SubstructureNotifyMask| SubstructureNotifyMask|
@ -1738,14 +1747,18 @@ main (int argc, char **argv)
for (i = 0; i < nchildren; i++) for (i = 0; i < nchildren; i++)
add_win (dpy, children[i], i ? children[i-1] : None); add_win (dpy, children[i], i ? children[i-1] : None);
XFree (children); XFree (children);
}
XUngrabServer (dpy); XUngrabServer (dpy);
ufd.fd = ConnectionNumber (dpy); ufd.fd = ConnectionNumber (dpy);
ufd.events = POLLIN; ufd.events = POLLIN;
if (!autoRedirect)
paint_all (dpy, None); paint_all (dpy, None);
for (;;) for (;;)
{ {
/* dump_wins (); */ /* dump_wins (); */
do { do {
if (autoRedirect)
XFlush (dpy);
if (!QLength (dpy)) if (!QLength (dpy))
{ {
if (poll (&ufd, 1, fade_timeout()) == 0) 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", printf ("event %10.10s serial 0x%08x window 0x%08x\n",
ev_name(&ev), ev_serial (&ev), ev_window (&ev)); ev_name(&ev), ev_serial (&ev), ev_window (&ev));
#endif #endif
switch (ev.type) { if (!autoRedirect) switch (ev.type) {
case CreateNotify: case CreateNotify:
add_win (dpy, ev.xcreatewindow.window, 0); add_win (dpy, ev.xcreatewindow.window, 0);
break; break;
@ -1850,7 +1863,7 @@ main (int argc, char **argv)
break; break;
} }
} while (QLength (dpy)); } while (QLength (dpy));
if (allDamage) if (allDamage && !autoRedirect)
{ {
static int paint; static int paint;
paint_all (dpy, allDamage); paint_all (dpy, allDamage);