Improve input sensitivity

We now use doubles until the last minute, which makes it so we can move
the pointer more precisely. This also includes a fix for tablet tools,
which move absolutely and sometimes do not update the X or Y axis.
This commit is contained in:
Drew DeVault 2017-11-04 01:35:12 -04:00
parent 86b8729998
commit 6d8e1abfc0
5 changed files with 20 additions and 6 deletions

View file

@ -261,8 +261,8 @@ void wlr_cursor_warp_absolute(struct wlr_cursor *cur,
mapping = wlr_output_layout_get_box(cur->state->layout, NULL);
}
double x = mapping->width * x_mm + mapping->x;
double y = mapping->height * y_mm + mapping->y;
double x = x_mm > 0 ? mapping->width * x_mm + mapping->x : cur->x;
double y = y_mm > 0 ? mapping->height * y_mm + mapping->y : cur->y;
wlr_cursor_warp_unchecked(cur, x, y);
}

View file

@ -472,9 +472,11 @@ void wlr_output_cursor_set_surface(struct wlr_output_cursor *cursor,
}
}
bool wlr_output_cursor_move(struct wlr_output_cursor *cursor, int x, int y) {
bool wlr_output_cursor_move(struct wlr_output_cursor *cursor,
double x, double y) {
x *= cursor->output->scale;
y *= cursor->output->scale;
wlr_log(L_DEBUG, "Moving cursor to %f,%f", x, y);
cursor->x = x;
cursor->y = y;
@ -486,7 +488,7 @@ bool wlr_output_cursor_move(struct wlr_output_cursor *cursor, int x, int y) {
if (!cursor->output->impl->move_cursor) {
return false;
}
return cursor->output->impl->move_cursor(cursor->output, x, y);
return cursor->output->impl->move_cursor(cursor->output, (int)x, (int)y);
}
struct wlr_output_cursor *wlr_output_cursor_create(struct wlr_output *output) {