static void check_user_input3(double dt, double dtr, int tile_diffs) {
static void check_user_input3(double dt) {
static void check_user_input3(double dt, double dtr, int tile_diffs) {	int allowed_misses, miss_tweak, i, g, g_in;	int last_was_miss, consecutive_misses;	double spin, spin_max, tm, to, dtm;	int rfb_wait_ms = 2;	static double dt_cut = 0.075;	int gcnt, ginput;	static int first = 1;	if (first) {		char *p = getenv("SPIN");		if (p) {			double junk;			sscanf(p, "%lf,%lf", &dt_cut, &junk);		}		first = 0;	}	if (!got_pointer_input) {		return;	}	if (dt < dt_cut) {		dt = dt_cut;	/* this is to try to avoid early exit */	}	spin_max = 0.5;	spin = 0.0;		/* amount of time spinning */	allowed_misses = 10;	/* number of ptr inputs we can miss */	miss_tweak = 8;	last_was_miss = 0;	consecutive_misses = 1;	gcnt = 0;	ginput = 0;	tm = 0.0;		/* timer variable */	dtime(&tm);	to = tm;	/* last time we did rfbPE() */	g = g_in = got_pointer_input;	while (1) {		int got_input = 0;		gcnt++;		if (button_mask) {			drag_in_progress = 1;		}		rfbCFD(screen, rfb_wait_ms * 1000);		dtm = dtime(&tm);		spin += dtm;		if (got_pointer_input == g) {			if (last_was_miss) {				consecutive_misses++;			}			last_was_miss = 1;		} else {			ginput++;			if (ginput % miss_tweak == 0) {				allowed_misses++;			}			consecutive_misses = 1;			last_was_miss = 0;		}		if (spin > spin_max) {			/* get out if spin time over limit */			break;		} else if (got_pointer_input > g) {			/* received some input, flush to display. */			got_input = 1;			g = got_pointer_input;			X_LOCK;			XFlush(dpy);			X_UNLOCK;		} else if (--allowed_misses <= 0) {			/* too many misses */			break;		} else if (consecutive_misses >=3) {			/* too many misses */			break;		} else {			/* these are misses */			int wms = 0;			if (gcnt == 1 && button_mask) {				/*				 * missed our first input, wait				 * for a defer time. (e.g. on				 * slow link) hopefully client				 * will batch them.				 */				wms = 50;			} else if (button_mask) {				wms = 10;			} else {			}			if (wms) {				usleep(wms * 1000);			}		}	}	if (ginput >= 2) {		/* try for a couple more quick ones */		for (i=0; i<2; i++) {			rfbCFD(screen, rfb_wait_ms * 1000);		}	}	drag_in_progress = 0;}