aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/hw/xnest/GCOps.c
diff options
context:
space:
mode:
Diffstat (limited to 'xorg-server/hw/xnest/GCOps.c')
-rw-r--r--xorg-server/hw/xnest/GCOps.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/xorg-server/hw/xnest/GCOps.c b/xorg-server/hw/xnest/GCOps.c
index e26a1363b..7b1956de0 100644
--- a/xorg-server/hw/xnest/GCOps.c
+++ b/xorg-server/hw/xnest/GCOps.c
@@ -94,15 +94,29 @@ xnestPutImage(DrawablePtr pDrawable, GCPtr pGC, int depth, int x, int y,
}
}
+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, char *pImage)
{
XImage *ximage;
int length;
+ int (*old_handler)(Display*, XErrorEvent*);
+
+ /* we may get BadMatch error when xnest window is minimized */
+ XSync(xnestDisplay, False);
+ old_handler = XSetErrorHandler (xnestIgnoreErrorHandler);
ximage = XGetImage(xnestDisplay, xnestDrawable(pDrawable),
x, y, w, h, planeMask, format);
+ XSync(xnestDisplay, False);
+ XSetErrorHandler(old_handler);
if (ximage) {
length = ximage->bytes_per_line * ximage->height;