rem: if (gx + gw >= WidthOfScreen(DefaultScreenOfDisplay(dpy))) { gw = WidthOfScreen(DefaultScreenOfDisplay(dpy)) - gx;
add: if (gx + gw >= WidthOfScreen(DefaultScreenOfDisplay(vdpy))) { gw = WidthOfScreen(DefaultScreenOfDisplay(vdpy)) - gx;
context: updateImage(BufferData *data, int rx, int ry){    int gx, gy, gw, gh;    int x, y;    int xoffs, yoffs;    int changedPixels = 0;    XImage *image;    gw = data->width;    gh = data->height;        gx = rx - gw/2;    gy = ry - gh/2;        xoffs = yoffs = 0;    if (gx < 0) {	xoffs = abs(gx);	gw += gx;	gx = 0;    }    if (gx + gw >= WidthOfScreen(DefaultScreenOfDisplay(dpy))) {	gw = WidthOfScreen(DefaultScreenOfDisplay(dpy)) - gx;    }    if (gy < 0) {	yoffs = abs(gy);	gh += gy;	gy = 0;    }    if (gy + gh >= HeightOfScreen(DefaultScreenOfDisplay(dpy))) {	gh = HeightOfScreen(DefaultScreenOfDisplay(dpy)) - gy;    }    image = XGetImage(dpy, DefaultRootWindow(dpy), gx, gy, gw, gh,		      AllPlanes, ZPixmap);    for (y = 0; y < data->height; y++) {	for (x = 0; x < data->width; x++) {	    unsigned long pixel;	    pixel = getpix(image, x-xoffs, y-yoffs, xoffs, yoffs);	    if (drawpoint(data, pixel, x, y))		changedPixels++;	}    }    /* flush the point cache */    drawpoint(data, 0, -1, -1);    XDestroyImage(image);        if (data->markPointerHotspot && !data->frozen) {	XRectangle rects[4];	rects[0].x = (data->width/2 - 3)*data->magfactor;	rects[0].y = (data->height/2)*data->magfactor;	rects[0].width = 2*data->magfactor;	rects[0].height = data->magfactor;	rects[1].x = (data->width/2 + 2)*data->magfactor;	rects[1].y = (data->height/2)*data->magfactor;	rects[1].width = 2*data->magfactor;	rects[1].height = data->magfactor;	XFillRectangles(dpy, data->d, WMColorGC(cursorColor1), rects, 2);	rects[2].y = (data->height/2 - 3)*data->magfactor;	rects[2].x = (data->width/2)*data->magfactor;	rects[2].height = 2*data->magfactor;	rects[2].width = data->magfactor;	rects[3].y = (data->height/2 + 2)*data->magfactor;	rects[3].x = (data->width/2)*data->magfactor;	rects[3].height = 2*data->magfactor;	rects[3].width = data->magfactor;	XFillRectangles(dpy, data->d, WMColorGC(cursorColor2), rects + 2, 2);    }    if (changedPixels > 0) {	WMRedisplayWidget(data->label);    }        data->firstDraw = False;}