|
|
|
@ -64,18 +64,11 @@ void wlr_cursor_set_xcursor(struct wlr_cursor *cur, struct wlr_xcursor *xcur) {
|
|
|
|
|
cur->state->xcursor = xcur;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void wlr_cursor_warp(struct wlr_cursor *cur, double x, double y) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void wlr_cursor_move(struct wlr_cursor *cur, double delta_x, double delta_y) {
|
|
|
|
|
//struct wlr_output *current_output;
|
|
|
|
|
//current_output = wlr_output_layout_output_at(cur->state->layout, cur->x, cur->y);
|
|
|
|
|
|
|
|
|
|
// TODO handle no layout
|
|
|
|
|
assert(cur->state->layout);
|
|
|
|
|
bool wlr_cursor_warp(struct wlr_cursor *cur, double x, double y) {
|
|
|
|
|
if (!wlr_output_layout_output_at(cur->state->layout, x, y)) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
double new_x = cur->x + delta_x;
|
|
|
|
|
double new_y = cur->y + delta_y;
|
|
|
|
|
int hotspot_x = 0;
|
|
|
|
|
int hotspot_y = 0;
|
|
|
|
|
|
|
|
|
@ -85,18 +78,11 @@ void wlr_cursor_move(struct wlr_cursor *cur, double delta_x, double delta_y) {
|
|
|
|
|
hotspot_y = image->hotspot_y;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!wlr_output_layout_output_at(cur->state->layout, new_x, new_y)) {
|
|
|
|
|
int closest_x, closest_y;
|
|
|
|
|
wlr_output_layout_closest_boundary(cur->state->layout, new_x, new_y,
|
|
|
|
|
&closest_x, &closest_y);
|
|
|
|
|
new_x = closest_x;
|
|
|
|
|
new_y = closest_y;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
struct wlr_output_layout_output *l_output;
|
|
|
|
|
wl_list_for_each(l_output, &cur->state->layout->outputs, link) {
|
|
|
|
|
int output_x = new_x;
|
|
|
|
|
int output_y = new_y;
|
|
|
|
|
int output_x = x;
|
|
|
|
|
int output_y = y;
|
|
|
|
|
|
|
|
|
|
// TODO fix double to int rounding issues
|
|
|
|
|
wlr_output_layout_output_coords(cur->state->layout,
|
|
|
|
@ -105,8 +91,28 @@ void wlr_cursor_move(struct wlr_cursor *cur, double delta_x, double delta_y) {
|
|
|
|
|
output_y - hotspot_y);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
cur->x = new_x;
|
|
|
|
|
cur->y = new_y;
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void wlr_cursor_move(struct wlr_cursor *cur, double delta_x, double delta_y) {
|
|
|
|
|
// TODO handle no layout
|
|
|
|
|
assert(cur->state->layout);
|
|
|
|
|
|
|
|
|
|
int x = cur->x + delta_x;
|
|
|
|
|
int y = cur->y + delta_y;
|
|
|
|
|
|
|
|
|
|
if (!wlr_output_layout_output_at(cur->state->layout, x, y)) {
|
|
|
|
|
int closest_x, closest_y;
|
|
|
|
|
wlr_output_layout_closest_boundary(cur->state->layout, x, y, &closest_x,
|
|
|
|
|
&closest_y);
|
|
|
|
|
x = closest_x;
|
|
|
|
|
y = closest_y;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (wlr_cursor_warp(cur, x, y)) {
|
|
|
|
|
cur->x = x;
|
|
|
|
|
cur->y = y;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void handle_pointer_motion(struct wl_listener *listener, void *data) {
|
|
|
|
|