예제 #1
0
static void
xf86_crtc_set_cursor_position(xf86CrtcPtr crtc, int x, int y)
{
    ScrnInfoPtr scrn = crtc->scrn;
    xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
    xf86CursorInfoPtr cursor_info = xf86_config->cursor_info;
    DisplayModePtr mode = &crtc->mode;
    int crtc_x = x, crtc_y = y;

    /*
     * Transform position of cursor on screen
     */
    if (crtc->rotation != RR_Rotate_0)
        xf86_crtc_transform_cursor_position(crtc, &crtc_x, &crtc_y);
    else {
        crtc_x -= crtc->x;
        crtc_y -= crtc->y;
    }

    /*
     * Disable the cursor when it is outside the viewport
     */
    if (crtc_x >= mode->HDisplay || crtc_y >= mode->VDisplay ||
        crtc_x <= -cursor_info->MaxWidth || crtc_y <= -cursor_info->MaxHeight) {
        crtc->cursor_in_range = FALSE;
        xf86_crtc_hide_cursor(crtc);
    } else {
        crtc->cursor_in_range = TRUE;
        if (crtc->driverIsPerformingTransform & XF86DriverTransformCursorPosition)
            crtc->funcs->set_cursor_position(crtc, x, y);
        else
            crtc->funcs->set_cursor_position(crtc, crtc_x, crtc_y);
        xf86_crtc_show_cursor(crtc);
    }
}
예제 #2
0
void
xf86_show_cursors(ScrnInfoPtr scrn)
{
    xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
    int c;

    xf86_config->cursor_on = TRUE;
    for (c = 0; c < xf86_config->num_crtc; c++) {
        xf86CrtcPtr crtc = xf86_config->crtc[c];

        if (crtc->enabled)
            xf86_crtc_show_cursor(crtc);
    }
}
예제 #3
0
static void
xf86_crtc_set_cursor_position(xf86CrtcPtr crtc, int x, int y)
{
    ScrnInfoPtr scrn = crtc->scrn;
    xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
    xf86CursorInfoPtr cursor_info = xf86_config->cursor_info;
    DisplayModePtr mode = &crtc->mode;
    Bool in_range;

    /*
     * Transform position of cursor on screen
     */
    if (crtc->transform_in_use && !crtc->driverIsPerformingTransform)
        xf86CrtcTransformCursorPos(crtc, &x, &y);
    else {
        x -= crtc->x;
        y -= crtc->y;
    }

    /*
     * Disable the cursor when it is outside the viewport
     */
    in_range = TRUE;
    if (x >= mode->HDisplay || y >= mode->VDisplay ||
        x <= -cursor_info->MaxWidth || y <= -cursor_info->MaxHeight) {
        in_range = FALSE;
        x = 0;
        y = 0;
    }

    crtc->cursor_in_range = in_range;

    if (in_range) {
        crtc->funcs->set_cursor_position(crtc, x, y);
        xf86_crtc_show_cursor(crtc);
    }
    else
        xf86_crtc_hide_cursor(crtc);
}
static void
xf86_crtc_set_cursor_position (xf86CrtcPtr crtc, int x, int y)
{
    ScrnInfoPtr		scrn = crtc->scrn;
    xf86CrtcConfigPtr   xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
    xf86CursorInfoPtr	cursor_info = xf86_config->cursor_info;
    DisplayModePtr	mode = &crtc->mode;
    Bool		in_range;
    int			dx, dy;

    /*
     * Transform position of cursor on screen
     */
    if (crtc->transform_in_use)
    {
	ScreenPtr	screen = scrn->pScreen;
	xf86CursorScreenPtr ScreenPriv =
	    (xf86CursorScreenPtr)dixLookupPrivate(&screen->devPrivates,
						  xf86CursorScreenKey);
	struct pict_f_vector   v;

	v.v[0] = (x + ScreenPriv->HotX) + 0.5;
	v.v[1] = (y + ScreenPriv->HotY) + 0.5;
	v.v[2] = 1;
	pixman_f_transform_point (&crtc->f_framebuffer_to_crtc, &v);
	/* cursor will have 0.5 added to it already so floor is sufficent */
	x = floor (v.v[0]);
	y = floor (v.v[1]);
	/*
	 * Transform position of cursor upper left corner
	 */
	xf86_crtc_rotate_coord_back (crtc->rotation,
				     cursor_info->MaxWidth,
				     cursor_info->MaxHeight,
				     ScreenPriv->HotX, ScreenPriv->HotY, &dx, &dy);
	x -= dx;
	y -= dy;
   }
    else
    {
	x -= crtc->x;
	y -= crtc->y;
    }

    /*
     * Disable the cursor when it is outside the viewport
     */
    in_range = TRUE;
    if (x >= mode->HDisplay || y >= mode->VDisplay ||
	x <= -cursor_info->MaxWidth || y <= -cursor_info->MaxHeight) 
    {
	in_range = FALSE;
	x = 0;
	y = 0;
    }

    crtc->cursor_in_range = in_range;
    
    if (in_range)
    {
	crtc->funcs->set_cursor_position (crtc, x, y);
	xf86_crtc_show_cursor (crtc);
    }
    else
	xf86_crtc_hide_cursor (crtc);
}
예제 #5
0
static void
xf86_crtc_set_cursor_position (xf86CrtcPtr crtc, int x, int y)
{
    ScrnInfoPtr		scrn = crtc->scrn;
    xf86CrtcConfigPtr   xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
    xf86CursorInfoPtr	cursor_info = xf86_config->cursor_info;
    DisplayModePtr	mode = &crtc->mode;
    int			x_temp;
    int			y_temp;
    Bool		in_range;

    /* 
     * Move to crtc coordinate space
     */
    x -= crtc->x;
    y -= crtc->y;
    
    /*
     * Rotate
     */
    switch ((crtc->rotation) & 0xf) {
    case RR_Rotate_0:
	break;
    case RR_Rotate_90:
	x_temp = y;
	y_temp = mode->VDisplay - cursor_info->MaxWidth - x;
	x = x_temp;
	y = y_temp;
	break;
    case RR_Rotate_180:
	x_temp = mode->HDisplay - cursor_info->MaxWidth - x;
	y_temp = mode->VDisplay - cursor_info->MaxHeight - y;
	x = x_temp;
	y = y_temp;
	break;
    case RR_Rotate_270:
	x_temp = mode->HDisplay - cursor_info->MaxHeight -  y;
	y_temp = x;
	x = x_temp;
	y = y_temp;
	break;
    }
    
    /*
     * Reflect
     */
    if (crtc->rotation & RR_Reflect_X)
	x = mode->HDisplay - cursor_info->MaxWidth - x;
    if (crtc->rotation & RR_Reflect_Y)
	y = mode->VDisplay - cursor_info->MaxHeight - y;

    /*
     * Disable the cursor when it is outside the viewport
     */
    in_range = TRUE;
    if (x >= mode->HDisplay || y >= mode->VDisplay ||
	x <= -cursor_info->MaxWidth || y <= -cursor_info->MaxHeight) 
    {
	in_range = FALSE;
	x = 0;
	y = 0;
    }

    crtc->cursor_in_range = in_range;
    
    if (in_range)
    {
	crtc->funcs->set_cursor_position (crtc, x, y);
	xf86_crtc_show_cursor (crtc);
    }
    else
	xf86_crtc_hide_cursor (crtc);
}