static void twin_fbdev_switch(twin_fbdev_t *tf, int activate)
{
	tf->vt_active = activate;

	DEBUG("console switch: %sactivating\n", activate ? "" : "de");

	/* Upon activation */
	if (activate) {
		/* Switch complete */
		ioctl(tf->vt_fd, VT_RELDISP, VT_ACKACQ);		

		/* Restore fbdev settings */
		if (twin_fbdev_apply_config(tf)) {
			tf->active = 1;

			/* Mark entire screen for refresh */
			if (tf->screen)
				twin_screen_damage (tf->screen, 0, 0,
						    tf->screen->width,
						    tf->screen->height);
		}
	} else {
		/* Allow switch. Maybe we want to expose some option
		 * to disallow them ?
		 */
		ioctl(tf->vt_fd, VT_RELDISP, 1);

		tf->active = 0;

		if (tf->fb_base != MAP_FAILED)
			munmap(tf->fb_base, tf->fb_len);
		tf->fb_base = MAP_FAILED;
	}
}
void
twin_screen_set_background (twin_screen_t *screen, twin_pixmap_t *pixmap)
{
    if (screen->background)
	twin_pixmap_destroy (screen->background);
    screen->background = pixmap;
    twin_screen_damage (screen, 0, 0, screen->width, screen->height);
}
void
twin_screen_resize (twin_screen_t *screen, 
		    twin_coord_t width, twin_coord_t height)
{
    screen->width = width;
    screen->height = height;
    twin_screen_damage (screen, 0, 0, screen->width, screen->height);
}
static void
twin_screen_damage_cursor(twin_screen_t *screen)
{
    twin_screen_damage (screen,
			screen->cursor->x,
			screen->cursor->y,
			screen->cursor->x + screen->cursor->width,
			screen->cursor->y + screen->cursor->height);
}
Ejemplo n.º 5
0
void
twin_pixmap_damage (twin_pixmap_t   *pixmap,
		    twin_coord_t    left,	twin_coord_t top,
		    twin_coord_t    right,	twin_coord_t bottom)
{
    if (pixmap->screen)
	twin_screen_damage (pixmap->screen,
			    left + pixmap->x,
			    top + pixmap->y,
			    right + pixmap->x,
			    bottom + pixmap->y);
}