/* xscreensaver, Copyright (c) 1998, 1999, 2006
* by Jamie Zawinski <jwz@jwz.org>
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation. No representations are made about the suitability of this
* software for any purpose. It is provided "as is" without express or
/* The XDBE (Double Buffering) extension is pretty tricky to use, since you
can get X errors at inconvenient times during initialization. This file
contains a utility routine to make it easier to deal with.
#include "resources.h" /* for get_string_resource() */
# include <X11/Xmu/Error.h>
#ifdef HAVE_DOUBLE_BUFFER_EXTENSION /* whole file */
static Bool xdbe_got_x_error
= False
;
xdbe_ehandler (Display
*dpy
, XErrorEvent
*error
)
fprintf (stderr
, "\n%s: ignoring X error from DOUBLE-BUFFER:\n", progname
);
XmuPrintDefaultErrorMessage (dpy
, error
, stderr
);
xdbe_get_backbuffer (Display
*dpy
, Window window
,
XErrorHandler old_handler
;
if (!get_boolean_resource(dpy
, "useDBE", "Boolean"))
if (!XdbeQueryExtension (dpy
, &maj
, &min
))
xdbe_got_x_error
= False
;
old_handler
= XSetErrorHandler (xdbe_ehandler
);
b
= XdbeAllocateBackBufferName(dpy
, window
, XdbeUndefined
);
XSetErrorHandler (old_handler
);
#endif /* HAVE_DOUBLE_BUFFER_EXTENSION */