Merge branch 'cursor-priv' into 'master'

cursor: rename wlr_cursor_state to wlr_cursor_priv

See merge request wlroots/wlroots!4276
This commit is contained in:
Simon Ser 2023-07-28 17:49:50 +00:00
commit c8931d024e
2 changed files with 132 additions and 132 deletions

View file

@ -70,7 +70,7 @@ struct wlr_cursor_output_cursor {
struct wl_event_source *xcursor_timer;
};
struct wlr_cursor_state {
struct wlr_cursor_priv {
struct wlr_cursor cursor;
struct wl_list devices; // wlr_cursor_device::link
@ -104,17 +104,17 @@ struct wlr_cursor_state {
};
struct wlr_cursor *wlr_cursor_create(void) {
struct wlr_cursor_state *state = calloc(1, sizeof(struct wlr_cursor_state));
if (!state) {
wlr_log(WLR_ERROR, "Failed to allocate wlr_cursor_state");
struct wlr_cursor_priv *priv = calloc(1, sizeof(*priv));
if (!priv) {
wlr_log(WLR_ERROR, "Failed to allocate wlr_cursor");
return NULL;
}
struct wlr_cursor *cur = &state->cursor;
struct wlr_cursor *cur = &priv->cursor;
cur->state = state;
cur->priv = priv;
wl_list_init(&cur->state->devices);
wl_list_init(&cur->state->output_cursors);
wl_list_init(&cur->priv->devices);
wl_list_init(&cur->priv->output_cursors);
// pointer signals
wl_signal_init(&cur->events.motion);
@ -144,8 +144,8 @@ struct wlr_cursor *wlr_cursor_create(void) {
wl_signal_init(&cur->events.tablet_tool_button);
wl_signal_init(&cur->events.tablet_tool_proximity);
wl_list_init(&cur->state->surface_destroy.link);
wl_list_init(&cur->state->surface_commit.link);
wl_list_init(&cur->priv->surface_destroy.link);
wl_list_init(&cur->priv->surface_commit.link);
cur->x = 100;
cur->y = 100;
@ -164,21 +164,21 @@ static void output_cursor_destroy(struct wlr_cursor_output_cursor *output_cursor
}
static void cursor_detach_output_layout(struct wlr_cursor *cur) {
if (!cur->state->layout) {
if (!cur->priv->layout) {
return;
}
struct wlr_cursor_output_cursor *output_cursor, *tmp;
wl_list_for_each_safe(output_cursor, tmp, &cur->state->output_cursors,
wl_list_for_each_safe(output_cursor, tmp, &cur->priv->output_cursors,
link) {
output_cursor_destroy(output_cursor);
}
wl_list_remove(&cur->state->layout_destroy.link);
wl_list_remove(&cur->state->layout_change.link);
wl_list_remove(&cur->state->layout_add.link);
wl_list_remove(&cur->priv->layout_destroy.link);
wl_list_remove(&cur->priv->layout_change.link);
wl_list_remove(&cur->priv->layout_add.link);
cur->state->layout = NULL;
cur->priv->layout = NULL;
}
static void cursor_device_destroy(struct wlr_cursor_device *c_device) {
@ -216,26 +216,26 @@ static void cursor_device_destroy(struct wlr_cursor_device *c_device) {
}
static void cursor_reset_image(struct wlr_cursor *cur) {
wlr_buffer_unlock(cur->state->buffer);
cur->state->buffer = NULL;
wlr_buffer_unlock(cur->priv->buffer);
cur->priv->buffer = NULL;
if (cur->state->surface != NULL) {
if (cur->priv->surface != NULL) {
struct wlr_cursor_output_cursor *output_cursor;
wl_list_for_each(output_cursor, &cur->state->output_cursors, link) {
wlr_surface_send_leave(cur->state->surface,
wl_list_for_each(output_cursor, &cur->priv->output_cursors, link) {
wlr_surface_send_leave(cur->priv->surface,
output_cursor->output_cursor->output);
}
}
wl_list_remove(&cur->state->surface_destroy.link);
wl_list_remove(&cur->state->surface_commit.link);
wl_list_init(&cur->state->surface_destroy.link);
wl_list_init(&cur->state->surface_commit.link);
cur->state->surface = NULL;
wl_list_remove(&cur->priv->surface_destroy.link);
wl_list_remove(&cur->priv->surface_commit.link);
wl_list_init(&cur->priv->surface_destroy.link);
wl_list_init(&cur->priv->surface_commit.link);
cur->priv->surface = NULL;
cur->state->xcursor_manager = NULL;
free(cur->state->xcursor_name);
cur->state->xcursor_name = NULL;
cur->priv->xcursor_manager = NULL;
free(cur->priv->xcursor_name);
cur->priv->xcursor_name = NULL;
}
void wlr_cursor_destroy(struct wlr_cursor *cur) {
@ -243,17 +243,17 @@ void wlr_cursor_destroy(struct wlr_cursor *cur) {
cursor_detach_output_layout(cur);
struct wlr_cursor_device *device, *device_tmp = NULL;
wl_list_for_each_safe(device, device_tmp, &cur->state->devices, link) {
wl_list_for_each_safe(device, device_tmp, &cur->priv->devices, link) {
cursor_device_destroy(device);
}
free(cur->state);
free(cur->priv);
}
static struct wlr_cursor_device *get_cursor_device(struct wlr_cursor *cur,
struct wlr_input_device *device) {
struct wlr_cursor_device *c_device, *ret = NULL;
wl_list_for_each(c_device, &cur->state->devices, link) {
wl_list_for_each(c_device, &cur->priv->devices, link) {
if (c_device->device == device) {
ret = c_device;
break;
@ -265,16 +265,16 @@ static struct wlr_cursor_device *get_cursor_device(struct wlr_cursor *cur,
static void cursor_warp_unchecked(struct wlr_cursor *cur,
double lx, double ly) {
assert(cur->state->layout);
assert(cur->priv->layout);
if (!isfinite(lx) || !isfinite(ly)) {
assert(false);
return;
}
struct wlr_cursor_output_cursor *output_cursor;
wl_list_for_each(output_cursor, &cur->state->output_cursors, link) {
wl_list_for_each(output_cursor, &cur->priv->output_cursors, link) {
double output_x = lx, output_y = ly;
wlr_output_layout_output_coords(cur->state->layout,
wlr_output_layout_output_coords(cur->priv->layout,
output_cursor->output_cursor->output, &output_x, &output_y);
wlr_output_cursor_move(output_cursor->output_cursor,
output_x, output_y);
@ -300,7 +300,7 @@ static void cursor_warp_unchecked(struct wlr_cursor *cur,
*/
static void get_mapping(struct wlr_cursor *cur,
struct wlr_input_device *dev, struct wlr_box *box) {
assert(cur->state->layout);
assert(cur->priv->layout);
*box = (struct wlr_box){0};
@ -311,26 +311,26 @@ static void get_mapping(struct wlr_cursor *cur,
return;
}
if (c_device->mapped_output) {
wlr_output_layout_get_box(cur->state->layout,
wlr_output_layout_get_box(cur->priv->layout,
c_device->mapped_output, box);
return;
}
}
if (!wlr_box_empty(&cur->state->mapped_box)) {
*box = cur->state->mapped_box;
if (!wlr_box_empty(&cur->priv->mapped_box)) {
*box = cur->priv->mapped_box;
return;
}
if (cur->state->mapped_output) {
wlr_output_layout_get_box(cur->state->layout,
cur->state->mapped_output, box);
if (cur->priv->mapped_output) {
wlr_output_layout_get_box(cur->priv->layout,
cur->priv->mapped_output, box);
return;
}
}
bool wlr_cursor_warp(struct wlr_cursor *cur, struct wlr_input_device *dev,
double lx, double ly) {
assert(cur->state->layout);
assert(cur->priv->layout);
bool result = false;
struct wlr_box mapping;
@ -338,7 +338,7 @@ bool wlr_cursor_warp(struct wlr_cursor *cur, struct wlr_input_device *dev,
if (!wlr_box_empty(&mapping)) {
result = wlr_box_contains_point(&mapping, lx, ly);
} else {
result = wlr_output_layout_contains_point(cur->state->layout, NULL,
result = wlr_output_layout_contains_point(cur->priv->layout, NULL,
lx, ly);
}
@ -355,8 +355,8 @@ void wlr_cursor_warp_closest(struct wlr_cursor *cur,
get_mapping(cur, dev, &mapping);
if (!wlr_box_empty(&mapping)) {
wlr_box_closest_point(&mapping, lx, ly, &lx, &ly);
} else if (!wl_list_empty(&cur->state->layout->outputs)) {
wlr_output_layout_closest_point(cur->state->layout, NULL, lx, ly,
} else if (!wl_list_empty(&cur->priv->layout->outputs)) {
wlr_output_layout_closest_point(cur->priv->layout, NULL, lx, ly,
&lx, &ly);
} else {
/*
@ -376,12 +376,12 @@ void wlr_cursor_warp_closest(struct wlr_cursor *cur,
void wlr_cursor_absolute_to_layout_coords(struct wlr_cursor *cur,
struct wlr_input_device *dev, double x, double y,
double *lx, double *ly) {
assert(cur->state->layout);
assert(cur->priv->layout);
struct wlr_box mapping;
get_mapping(cur, dev, &mapping);
if (wlr_box_empty(&mapping)) {
wlr_output_layout_get_box(cur->state->layout, NULL, &mapping);
wlr_output_layout_get_box(cur->priv->layout, NULL, &mapping);
}
*lx = !isnan(x) ? mapping.width * x + mapping.x : cur->x;
@ -390,7 +390,7 @@ void wlr_cursor_absolute_to_layout_coords(struct wlr_cursor *cur,
void wlr_cursor_warp_absolute(struct wlr_cursor *cur,
struct wlr_input_device *dev, double x, double y) {
assert(cur->state->layout);
assert(cur->priv->layout);
double lx, ly;
wlr_cursor_absolute_to_layout_coords(cur, dev, x, y, &lx, &ly);
@ -400,7 +400,7 @@ void wlr_cursor_warp_absolute(struct wlr_cursor *cur,
void wlr_cursor_move(struct wlr_cursor *cur, struct wlr_input_device *dev,
double delta_x, double delta_y) {
assert(cur->state->layout);
assert(cur->priv->layout);
double lx = !isnan(delta_x) ? cur->x + delta_x : cur->x;
double ly = !isnan(delta_y) ? cur->y + delta_y : cur->y;
@ -424,20 +424,20 @@ static void cursor_update_outputs(struct wlr_cursor *cur);
void wlr_cursor_set_buffer(struct wlr_cursor *cur, struct wlr_buffer *buffer,
int32_t hotspot_x, int32_t hotspot_y, float scale) {
if (buffer == cur->state->buffer &&
hotspot_x == cur->state->buffer_hotspot.x &&
hotspot_y == cur->state->buffer_hotspot.y &&
scale == cur->state->buffer_scale) {
if (buffer == cur->priv->buffer &&
hotspot_x == cur->priv->buffer_hotspot.x &&
hotspot_y == cur->priv->buffer_hotspot.y &&
scale == cur->priv->buffer_scale) {
return;
}
cursor_reset_image(cur);
if (buffer != NULL) {
cur->state->buffer = wlr_buffer_lock(buffer);
cur->state->buffer_hotspot.x = hotspot_x;
cur->state->buffer_hotspot.y = hotspot_y;
cur->state->buffer_scale = scale;
cur->priv->buffer = wlr_buffer_lock(buffer);
cur->priv->buffer_hotspot.x = hotspot_x;
cur->priv->buffer_hotspot.y = hotspot_y;
cur->priv->buffer_scale = scale;
}
cursor_update_outputs(cur);
@ -493,7 +493,7 @@ static void output_cursor_output_handle_output_commit(
struct wlr_cursor_output_cursor *output_cursor =
wl_container_of(listener, output_cursor, output_commit);
const struct wlr_output_event_commit *event = data;
struct wlr_surface *surface = output_cursor->cursor->state->surface;
struct wlr_surface *surface = output_cursor->cursor->priv->surface;
assert(surface != NULL);
if (output_cursor->output_cursor->visible &&
@ -507,16 +507,16 @@ static void cursor_output_cursor_update(struct wlr_cursor_output_cursor *output_
cursor_output_cursor_reset_image(output_cursor);
if (cur->state->buffer != NULL) {
if (cur->priv->buffer != NULL) {
struct wlr_renderer *renderer = output_cursor->output_cursor->output->renderer;
if (!renderer) {
return;
}
struct wlr_buffer *buffer = cur->state->buffer;
int32_t hotspot_x = cur->state->buffer_hotspot.x;
int32_t hotspot_y = cur->state->buffer_hotspot.y;
float scale = cur->state->buffer_scale;
struct wlr_buffer *buffer = cur->priv->buffer;
int32_t hotspot_x = cur->priv->buffer_hotspot.x;
int32_t hotspot_y = cur->priv->buffer_hotspot.y;
float scale = cur->priv->buffer_scale;
struct wlr_texture *texture = NULL;
struct wlr_fbox src_box = {0};
@ -539,16 +539,16 @@ static void cursor_output_cursor_update(struct wlr_cursor_output_cursor *output_
output_cursor_set_texture(output_cursor->output_cursor, texture, true,
&src_box, dst_width, dst_height, WL_OUTPUT_TRANSFORM_NORMAL,
hotspot_x, hotspot_y);
} else if (cur->state->surface != NULL) {
struct wlr_surface *surface = cur->state->surface;
} else if (cur->priv->surface != NULL) {
struct wlr_surface *surface = cur->priv->surface;
wl_signal_add(&output_cursor->output_cursor->output->events.commit,
&output_cursor->output_commit);
output_cursor->output_commit.notify = output_cursor_output_handle_output_commit;
struct wlr_texture *texture = wlr_surface_get_texture(surface);
int32_t hotspot_x = cur->state->surface_hotspot.x;
int32_t hotspot_y = cur->state->surface_hotspot.y;
int32_t hotspot_x = cur->priv->surface_hotspot.x;
int32_t hotspot_y = cur->priv->surface_hotspot.y;
struct wlr_fbox src_box;
wlr_surface_get_buffer_source_box(surface, &src_box);
@ -565,9 +565,9 @@ static void cursor_output_cursor_update(struct wlr_cursor_output_cursor *output_
} else {
wlr_surface_send_leave(surface, output);
}
} else if (cur->state->xcursor_name != NULL) {
struct wlr_xcursor_manager *manager = cur->state->xcursor_manager;
const char *name = cur->state->xcursor_name;
} else if (cur->priv->xcursor_name != NULL) {
struct wlr_xcursor_manager *manager = cur->priv->xcursor_manager;
const char *name = cur->priv->xcursor_name;
float scale = output_cursor->output_cursor->output->scale;
wlr_xcursor_manager_load(manager, scale);
@ -585,41 +585,41 @@ static void cursor_output_cursor_update(struct wlr_cursor_output_cursor *output_
static void cursor_update_outputs(struct wlr_cursor *cur) {
struct wlr_cursor_output_cursor *output_cursor;
wl_list_for_each(output_cursor, &cur->state->output_cursors, link) {
wl_list_for_each(output_cursor, &cur->priv->output_cursors, link) {
cursor_output_cursor_update(output_cursor);
}
}
void wlr_cursor_set_xcursor(struct wlr_cursor *cur,
struct wlr_xcursor_manager *manager, const char *name) {
if (manager == cur->state->xcursor_manager &&
cur->state->xcursor_name != NULL &&
strcmp(name, cur->state->xcursor_name) == 0) {
if (manager == cur->priv->xcursor_manager &&
cur->priv->xcursor_name != NULL &&
strcmp(name, cur->priv->xcursor_name) == 0) {
return;
}
cursor_reset_image(cur);
cur->state->xcursor_manager = manager;
cur->state->xcursor_name = strdup(name);
cur->priv->xcursor_manager = manager;
cur->priv->xcursor_name = strdup(name);
cursor_update_outputs(cur);
}
static void cursor_handle_surface_destroy(struct wl_listener *listener, void *data) {
struct wlr_cursor_state *state = wl_container_of(listener, state, surface_destroy);
assert(state->surface != NULL);
wlr_cursor_unset_image(&state->cursor);
struct wlr_cursor_priv *priv = wl_container_of(listener, priv, surface_destroy);
assert(priv->surface != NULL);
wlr_cursor_unset_image(&priv->cursor);
}
static void cursor_handle_surface_commit(struct wl_listener *listener, void *data) {
struct wlr_cursor_state *state = wl_container_of(listener, state, surface_commit);
struct wlr_surface *surface = state->surface;
struct wlr_cursor_priv *priv = wl_container_of(listener, priv, surface_commit);
struct wlr_surface *surface = priv->surface;
state->surface_hotspot.x -= surface->current.dx;
state->surface_hotspot.y -= surface->current.dy;
priv->surface_hotspot.x -= surface->current.dx;
priv->surface_hotspot.y -= surface->current.dy;
cursor_update_outputs(&state->cursor);
cursor_update_outputs(&priv->cursor);
}
void wlr_cursor_set_surface(struct wlr_cursor *cur, struct wlr_surface *surface,
@ -629,26 +629,26 @@ void wlr_cursor_set_surface(struct wlr_cursor *cur, struct wlr_surface *surface,
return;
}
if (surface == cur->state->surface &&
hotspot_x == cur->state->surface_hotspot.x &&
hotspot_y == cur->state->surface_hotspot.y) {
if (surface == cur->priv->surface &&
hotspot_x == cur->priv->surface_hotspot.x &&
hotspot_y == cur->priv->surface_hotspot.y) {
return;
}
if (surface != cur->state->surface) {
if (surface != cur->priv->surface) {
// Only send wl_surface.leave if the surface changes
cursor_reset_image(cur);
cur->state->surface = surface;
cur->priv->surface = surface;
wl_signal_add(&surface->events.destroy, &cur->state->surface_destroy);
cur->state->surface_destroy.notify = cursor_handle_surface_destroy;
wl_signal_add(&surface->events.commit, &cur->state->surface_commit);
cur->state->surface_commit.notify = cursor_handle_surface_commit;
wl_signal_add(&surface->events.destroy, &cur->priv->surface_destroy);
cur->priv->surface_destroy.notify = cursor_handle_surface_destroy;
wl_signal_add(&surface->events.commit, &cur->priv->surface_commit);
cur->priv->surface_commit.notify = cursor_handle_surface_commit;
}
cur->state->surface_hotspot.x = hotspot_x;
cur->state->surface_hotspot.y = hotspot_y;
cur->priv->surface_hotspot.x = hotspot_x;
cur->priv->surface_hotspot.y = hotspot_y;
cursor_update_outputs(cur);
}
@ -711,8 +711,8 @@ static struct wlr_output *get_mapped_output(struct wlr_cursor_device *cursor_dev
struct wlr_cursor *cursor = cursor_device->cursor;
assert(cursor);
if (cursor->state->mapped_output) {
return cursor->state->mapped_output;
if (cursor->priv->mapped_output) {
return cursor->priv->mapped_output;
}
return NULL;
}
@ -1012,7 +1012,7 @@ static struct wlr_cursor_device *cursor_device_create(
c_device->tablet_tool_button.notify = handle_tablet_tool_button;
}
wl_list_insert(&cursor->state->devices, &c_device->link);
wl_list_insert(&cursor->priv->devices, &c_device->link);
return c_device;
}
@ -1029,7 +1029,7 @@ void wlr_cursor_attach_input_device(struct wlr_cursor *cur,
// make sure it is not already attached
struct wlr_cursor_device *_dev;
wl_list_for_each(_dev, &cur->state->devices, link) {
wl_list_for_each(_dev, &cur->priv->devices, link) {
if (_dev->device == dev) {
return;
}
@ -1041,7 +1041,7 @@ void wlr_cursor_attach_input_device(struct wlr_cursor *cur,
void wlr_cursor_detach_input_device(struct wlr_cursor *cur,
struct wlr_input_device *dev) {
struct wlr_cursor_device *c_device, *tmp = NULL;
wl_list_for_each_safe(c_device, tmp, &cur->state->devices, link) {
wl_list_for_each_safe(c_device, tmp, &cur->priv->devices, link) {
if (c_device->device == dev) {
cursor_device_destroy(c_device);
}
@ -1049,9 +1049,9 @@ void wlr_cursor_detach_input_device(struct wlr_cursor *cur,
}
static void handle_layout_destroy(struct wl_listener *listener, void *data) {
struct wlr_cursor_state *state =
wl_container_of(listener, state, layout_destroy);
cursor_detach_output_layout(&state->cursor);
struct wlr_cursor_priv *priv =
wl_container_of(listener, priv, layout_destroy);
cursor_detach_output_layout(&priv->cursor);
}
static void handle_layout_output_destroy(struct wl_listener *listener,
@ -1062,10 +1062,10 @@ static void handle_layout_output_destroy(struct wl_listener *listener,
output_cursor_destroy(output_cursor);
}
static void layout_add(struct wlr_cursor_state *state,
static void layout_add(struct wlr_cursor_priv *priv,
struct wlr_output_layout_output *l_output) {
struct wlr_cursor_output_cursor *output_cursor;
wl_list_for_each(output_cursor, &state->output_cursors, link) {
wl_list_for_each(output_cursor, &priv->output_cursors, link) {
if (output_cursor->output_cursor->output == l_output->output) {
return; // already added
}
@ -1076,7 +1076,7 @@ static void layout_add(struct wlr_cursor_state *state,
wlr_log(WLR_ERROR, "Failed to allocate wlr_cursor_output_cursor");
return;
}
output_cursor->cursor = &state->cursor;
output_cursor->cursor = &priv->cursor;
wl_list_init(&output_cursor->output_commit.link);
@ -1091,32 +1091,32 @@ static void layout_add(struct wlr_cursor_state *state,
wl_signal_add(&l_output->events.destroy,
&output_cursor->layout_output_destroy);
wl_list_insert(&state->output_cursors, &output_cursor->link);
wl_list_insert(&priv->output_cursors, &output_cursor->link);
cursor_output_cursor_update(output_cursor);
}
static void handle_layout_add(struct wl_listener *listener, void *data) {
struct wlr_cursor_state *state =
wl_container_of(listener, state, layout_add);
struct wlr_cursor_priv *priv =
wl_container_of(listener, priv, layout_add);
struct wlr_output_layout_output *l_output = data;
layout_add(state, l_output);
layout_add(priv, l_output);
}
static void handle_layout_change(struct wl_listener *listener, void *data) {
struct wlr_cursor_state *state =
wl_container_of(listener, state, layout_change);
struct wlr_cursor_priv *priv =
wl_container_of(listener, priv, layout_change);
struct wlr_output_layout *layout = data;
if (!wlr_output_layout_contains_point(layout, NULL, state->cursor.x,
state->cursor.y) && !wl_list_empty(&layout->outputs)) {
if (!wlr_output_layout_contains_point(layout, NULL, priv->cursor.x,
priv->cursor.y) && !wl_list_empty(&layout->outputs)) {
// the output we were on has gone away so go to the closest boundary
// point (unless the layout is empty; compare warp_closest())
double x, y;
wlr_output_layout_closest_point(layout, NULL, state->cursor.x,
state->cursor.y, &x, &y);
wlr_output_layout_closest_point(layout, NULL, priv->cursor.x,
priv->cursor.y, &x, &y);
cursor_warp_unchecked(&state->cursor, x, y);
cursor_warp_unchecked(&priv->cursor, x, y);
}
}
@ -1128,24 +1128,24 @@ void wlr_cursor_attach_output_layout(struct wlr_cursor *cur,
return;
}
wl_signal_add(&l->events.add, &cur->state->layout_add);
cur->state->layout_add.notify = handle_layout_add;
wl_signal_add(&l->events.change, &cur->state->layout_change);
cur->state->layout_change.notify = handle_layout_change;
wl_signal_add(&l->events.destroy, &cur->state->layout_destroy);
cur->state->layout_destroy.notify = handle_layout_destroy;
wl_signal_add(&l->events.add, &cur->priv->layout_add);
cur->priv->layout_add.notify = handle_layout_add;
wl_signal_add(&l->events.change, &cur->priv->layout_change);
cur->priv->layout_change.notify = handle_layout_change;
wl_signal_add(&l->events.destroy, &cur->priv->layout_destroy);
cur->priv->layout_destroy.notify = handle_layout_destroy;
cur->state->layout = l;
cur->priv->layout = l;
struct wlr_output_layout_output *l_output;
wl_list_for_each(l_output, &l->outputs, link) {
layout_add(cur->state, l_output);
layout_add(cur->priv, l_output);
}
}
void wlr_cursor_map_to_output(struct wlr_cursor *cur,
struct wlr_output *output) {
cur->state->mapped_output = output;
cur->priv->mapped_output = output;
}
void wlr_cursor_map_input_to_output(struct wlr_cursor *cur,
@ -1162,20 +1162,20 @@ void wlr_cursor_map_input_to_output(struct wlr_cursor *cur,
void wlr_cursor_map_to_region(struct wlr_cursor *cur,
const struct wlr_box *box) {
cur->state->mapped_box = (struct wlr_box){0};
cur->priv->mapped_box = (struct wlr_box){0};
if (box) {
if (wlr_box_empty(box)) {
wlr_log(WLR_ERROR, "cannot map cursor to an empty region");
return;
}
cur->state->mapped_box = *box;
cur->priv->mapped_box = *box;
}
}
void wlr_cursor_map_input_to_region(struct wlr_cursor *cur,
struct wlr_input_device *dev, const struct wlr_box *box) {
cur->state->mapped_box = (struct wlr_box){0};
cur->priv->mapped_box = (struct wlr_box){0};
struct wlr_cursor_device *c_device = get_cursor_device(cur, dev);
if (!c_device) {