xorg-x11-server/p_xnest-ignore-getimage-errors.diff

36 lines
1.2 KiB
Diff
Raw Normal View History

Index: programs/Xserver/hw/xnest/GCOps.c
===================================================================
RCS file: /cvs/xorg/xc/programs/Xserver/hw/xnest/GCOps.c,v
retrieving revision 1.6
diff -u -p -r1.6 GCOps.c
--- programs/Xserver/hw/xnest/GCOps.c 14 Jul 2005 03:36:43 -0000 1.6
+++ programs/Xserver/hw/xnest/GCOps.c 7 Jun 2006 13:40:01 -0000
@@ -96,6 +96,13 @@ xnestPutImage(DrawablePtr pDrawable, GCP
}
}
+static int
+xnestIgnoreErrorHandler (Display *display,
+ XErrorEvent *event)
+{
+ return False; /* return value is ignored */
+}
+
void
xnestGetImage(DrawablePtr pDrawable, int x, int y, int w, int h,
unsigned int format, unsigned long planeMask,
@@ -103,9 +110,13 @@ xnestGetImage(DrawablePtr pDrawable, int
{
XImage *ximage;
int length;
+ int (*old_handler)(Display*, XErrorEvent*);
+ /* we may get BadMatch error when xnest window is minimized */
+ old_handler = XSetErrorHandler (xnestIgnoreErrorHandler);
ximage = XGetImage(xnestDisplay, xnestDrawable(pDrawable),
x, y, w, h, planeMask, format);
+ XSetErrorHandler (old_handler);
if (ximage) {
length = ximage->bytes_per_line * ximage->height;