xfree86/modes: Simplify in_range logic in xf86_crtc_set_cursor_position
Consolidate to a single if/else statement and eliminate the redundant local variable in_range and assignments to x/y. Reviewed-by: Adam Jackson <ajax@redhat.com>
This commit is contained in:
parent
a991b1ec30
commit
263c5333a5
@ -395,7 +395,6 @@ xf86_crtc_set_cursor_position(xf86CrtcPtr crtc, int x, int y)
|
|||||||
xf86CursorInfoPtr cursor_info = xf86_config->cursor_info;
|
xf86CursorInfoPtr cursor_info = xf86_config->cursor_info;
|
||||||
DisplayModePtr mode = &crtc->mode;
|
DisplayModePtr mode = &crtc->mode;
|
||||||
int crtc_x = x, crtc_y = y;
|
int crtc_x = x, crtc_y = y;
|
||||||
Bool in_range;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Transform position of cursor on screen
|
* Transform position of cursor on screen
|
||||||
@ -410,25 +409,18 @@ xf86_crtc_set_cursor_position(xf86CrtcPtr crtc, int x, int y)
|
|||||||
/*
|
/*
|
||||||
* Disable the cursor when it is outside the viewport
|
* Disable the cursor when it is outside the viewport
|
||||||
*/
|
*/
|
||||||
in_range = TRUE;
|
|
||||||
if (crtc_x >= mode->HDisplay || crtc_y >= mode->VDisplay ||
|
if (crtc_x >= mode->HDisplay || crtc_y >= mode->VDisplay ||
|
||||||
crtc_x <= -cursor_info->MaxWidth || crtc_y <= -cursor_info->MaxHeight) {
|
crtc_x <= -cursor_info->MaxWidth || crtc_y <= -cursor_info->MaxHeight) {
|
||||||
in_range = FALSE;
|
crtc->cursor_in_range = FALSE;
|
||||||
x = 0;
|
xf86_crtc_hide_cursor(crtc);
|
||||||
y = 0;
|
} else {
|
||||||
}
|
crtc->cursor_in_range = TRUE;
|
||||||
|
|
||||||
crtc->cursor_in_range = in_range;
|
|
||||||
|
|
||||||
if (in_range) {
|
|
||||||
if (crtc->driverIsPerformingTransform & XF86DriverTransformCursorPosition)
|
if (crtc->driverIsPerformingTransform & XF86DriverTransformCursorPosition)
|
||||||
crtc->funcs->set_cursor_position(crtc, x, y);
|
crtc->funcs->set_cursor_position(crtc, x, y);
|
||||||
else
|
else
|
||||||
crtc->funcs->set_cursor_position(crtc, crtc_x, crtc_y);
|
crtc->funcs->set_cursor_position(crtc, crtc_x, crtc_y);
|
||||||
xf86_crtc_show_cursor(crtc);
|
xf86_crtc_show_cursor(crtc);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
xf86_crtc_hide_cursor(crtc);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
Loading…
Reference in New Issue
Block a user