if (XCheckTypedEvent(dpy, xrandr_base_event_type + RRScreenChangeNotify, &xev)) {
if (xrandr_base_event_type && XCheckTypedEvent(dpy, xrandr_base_event_type + RRScreenChangeNotify, &xev)) {
int check_xrandr_event(char *msg) {	XEvent xev;	if (subwin) {		return handle_subwin_resize(msg);	}#if LIBVNCSERVER_HAVE_LIBXRANDR	if (! xrandr || ! xrandr_present) {		return 0;	}	if (XCheckTypedEvent(dpy, xrandr_base_event_type +	    RRScreenChangeNotify, &xev)) {		int do_change;		XRRScreenChangeNotifyEvent *rev;		rev = (XRRScreenChangeNotifyEvent *) &xev;		rfbLog("check_xrandr_event():\n");		rfbLog("Detected XRANDR event at location '%s':\n", msg);		rfbLog("  serial:          %d\n", (int) rev->serial);		rfbLog("  timestamp:       %d\n", (int) rev->timestamp);		rfbLog("  cfg_timestamp:   %d\n", (int) rev->config_timestamp);		rfbLog("  size_id:         %d\n", (int) rev->size_index);		rfbLog("  sub_pixel:       %d\n", (int) rev->subpixel_order);		rfbLog("  rotation:        %d\n", (int) rev->rotation);		rfbLog("  width:           %d\n", (int) rev->width);		rfbLog("  height:          %d\n", (int) rev->height);		rfbLog("  mwidth:          %d mm\n", (int) rev->mwidth);		rfbLog("  mheight:         %d mm\n", (int) rev->mheight);		rfbLog("\n");		rfbLog("check_xrandr_event: previous WxH: %dx%d\n",		    wdpy_x, wdpy_y);		if (wdpy_x == rev->width && wdpy_y == rev->height &&		    xrandr_rotation == (int) rev->rotation) {		    rfbLog("check_xrandr_event: no change detected.\n");			do_change = 0;		} else {			do_change = 1;		}		xrandr_width  = rev->width;		xrandr_height = rev->height;		xrandr_timestamp = rev->timestamp;		xrandr_cfg_time  = rev->config_timestamp;		xrandr_rotation = (int) rev->rotation;		rfbLog("check_xrandr_event: updating config...\n");		XRRUpdateConfiguration(&xev);		if (do_change) {			X_UNLOCK;			handle_xrandr_change(rev->width, rev->height);		}		rfbLog("check_xrandr_event: current  WxH: %dx%d\n",		    XDisplayWidth(dpy, scr), XDisplayHeight(dpy, scr));		rfbLog("check_xrandr_event(): returning control to"		    " caller...\n");		return do_change;	}#endif	return 0;}