Пример #1
0
static void v4l_fmt(char *fmt) {
	if (v4l1_setfmt(raw_fb_fd, fmt)) {
		v4l_requery();

		ignore_all = 1;
		do_new_fb(1);
		ignore_all = 0;
	}
}
Пример #2
0
static void handle_xrandr_change(int new_x, int new_y) {
	rfbClientIteratorPtr iter;
	rfbClientPtr cl;

	RAWFB_RET_VOID

	/* assumes no X_LOCK */

	/* sanity check xrandr_mode */
	if (! xrandr_mode) {
		xrandr_mode = strdup("default");
	} else if (! known_xrandr_mode(xrandr_mode)) {
		free(xrandr_mode);
		xrandr_mode = strdup("default");
	}
	rfbLog("xrandr_mode: %s\n", xrandr_mode);
	if (!strcmp(xrandr_mode, "exit")) {
		close_all_clients();
		rfbLog("  shutting down due to XRANDR event.\n");
		clean_up_exit(0);
	}
	if (!strcmp(xrandr_mode, "newfbsize") && screen) {
		iter = rfbGetClientIterator(screen);
		while( (cl = rfbClientIteratorNext(iter)) ) {
			if (cl->useNewFBSize) {
				continue;
			}
			rfbLog("  closing client %s (no useNewFBSize"
			    " support).\n", cl->host);
			rfbCloseClient(cl);
			rfbClientConnectionGone(cl);
		}
		rfbReleaseClientIterator(iter);
	}
	
	/* default, resize, and newfbsize create a new fb: */
	rfbLog("check_xrandr_event: trying to create new framebuffer...\n");
	if (new_x < wdpy_x || new_y < wdpy_y) {
		check_black_fb();
	}
	do_new_fb(1);
	rfbLog("check_xrandr_event: fb       WxH: %dx%d\n", wdpy_x, wdpy_y);
}
Пример #3
0
static void v4l_sz(int b) {
#ifdef V4L_OK
	int w_old = v4l1_window.width;
	int h_old = v4l1_window.height;
	int w, h;

	if (w_old == 0) {
		w_old = 160;
	}
	if (h_old == 0) {
		h_old = 120;
	}

	if (b == 1) {
		w = w_old + (int) (0.15 * w_old); 
		h = h_old + (int) (0.15 * h_old); 
	} else if (b == -1) {
		w = w_old - (int) (0.15 * w_old); 
		h = h_old - (int) (0.15 * h_old); 
	} else {
		return;
	}

	if (! v4l1_resize(raw_fb_fd, w, h)) {
		return;
	}

	v4l_requery();

	push_black_screen(4);

	ignore_all = 1;
	do_new_fb(1);
	ignore_all = 0;
#else
	if (!b) {}
#endif
}
Пример #4
0
static int XIOerr(Display *d) {
	static int reopen = 0, rmax = 1;
	X_UNLOCK;

	if (getenv("X11VNC_REOPEN_DISPLAY")) {
		rmax = atoi(getenv("X11VNC_REOPEN_DISPLAY"));
	}

#if !NO_X11
	if (reopen < rmax && getenv("X11VNC_REOPEN_DISPLAY")) {
		int db = getenv("X11VNC_REOPEN_DEBUG") ? 1 : 0;
		int sleepmax = 10, i;
		Display *save_dpy = dpy;
		char *dstr = strdup(DisplayString(save_dpy));
		reopen++;	
		if (getenv("X11VNC_REOPEN_SLEEP_MAX")) {
			sleepmax = atoi(getenv("X11VNC_REOPEN_SLEEP_MAX"));
		}
		rfbLog("*** XIO error: Trying to reopen[%d/%d] display '%s'\n", reopen, rmax, dstr);
		rfbLog("*** XIO error: Note the reopened state may be unstable.\n");
		for (i=0; i < sleepmax; i++) {
			usleep (1000 * 1000);
			dpy = XOpenDisplay_wr(dstr);
			rfbLog("dpy[%d/%d]: %p\n", i+1, sleepmax, dpy);
			if (dpy) {
				break;
			}
		}
		last_open_xdisplay = time(NULL);
		if (dpy) {
			rfbLog("*** XIO error: Reopened display '%s' successfully.\n", dstr);
			if (db) rfbLog("*** XIO error: '%s' 0x%x\n", dstr, dpy);
			scr = DefaultScreen(dpy);
			rootwin = RootWindow(dpy, scr);
			if (db) rfbLog("*** XIO error: disable_grabserver\n");
			disable_grabserver(dpy, 0);
			if (db) rfbLog("*** XIO error: xrecord\n");
			zerodisp_xrecord();
			initialize_xrecord();
			if (db) rfbLog("*** XIO error: xdamage\n");
			create_xdamage_if_needed(1);
			if (db) rfbLog("*** XIO error: do_new_fb\n");
			if (using_shm) {
				if (db) rfbLog("*** XIO error: clean_shm\n");
				clean_shm(1);
			}
			do_new_fb(1);
			if (db) rfbLog("*** XIO error: check_xevents\n");
			check_xevents(1);

			/* sadly, we can never return... */
			if (db) rfbLog("*** XIO error: watch_loop\n");
			watch_loop();
			clean_up_exit(1);	
		}
	}
#endif

	interrupted(-1);

	if (d) {} /* unused vars warning: */

	return (*XIOerr_def)(d);
}