mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2025-11-21 06:59:44 -05:00
parent
b2d478a418
commit
641d08ce7e
10 changed files with 65 additions and 29 deletions
|
|
@ -131,15 +131,6 @@ static struct wlr_cursor_device *get_cursor_device(struct wlr_cursor *cur,
|
|||
static void wlr_cursor_warp_unchecked(struct wlr_cursor *cur,
|
||||
double x, double y) {
|
||||
assert(cur->state->layout);
|
||||
int hotspot_x = 0;
|
||||
int hotspot_y = 0;
|
||||
|
||||
if (cur->state->xcursor && cur->state->xcursor->image_count > 0) {
|
||||
struct wlr_xcursor_image *image = cur->state->xcursor->images[0];
|
||||
hotspot_x = image->hotspot_x;
|
||||
hotspot_y = image->hotspot_y;
|
||||
}
|
||||
|
||||
|
||||
struct wlr_output_layout_output *l_output;
|
||||
wl_list_for_each(l_output, &cur->state->layout->outputs, link) {
|
||||
|
|
@ -148,8 +139,9 @@ static void wlr_cursor_warp_unchecked(struct wlr_cursor *cur,
|
|||
|
||||
wlr_output_layout_output_coords(cur->state->layout,
|
||||
l_output->output, &output_x, &output_y);
|
||||
wlr_output_move_cursor(l_output->output, output_x - hotspot_x,
|
||||
output_y - hotspot_y);
|
||||
wlr_output_move_cursor(l_output->output,
|
||||
output_x - l_output->output->cursor.hotspot_x,
|
||||
output_y - l_output->output->cursor.hotspot_y);
|
||||
}
|
||||
|
||||
cur->x = x;
|
||||
|
|
|
|||
|
|
@ -125,9 +125,11 @@ void wlr_output_transform(struct wlr_output *output,
|
|||
}
|
||||
|
||||
bool wlr_output_set_cursor(struct wlr_output *output,
|
||||
const uint8_t *buf, int32_t stride, uint32_t width, uint32_t height) {
|
||||
const uint8_t *buf, int32_t stride, uint32_t width, uint32_t height,
|
||||
int32_t hotspot_x, int32_t hotspot_y) {
|
||||
if (output->impl->set_cursor
|
||||
&& output->impl->set_cursor(output, buf, stride, width, height)) {
|
||||
&& output->impl->set_cursor(output, buf, stride, width, height,
|
||||
hotspot_x, hotspot_y)) {
|
||||
output->cursor.is_sw = false;
|
||||
return true;
|
||||
}
|
||||
|
|
@ -137,6 +139,8 @@ bool wlr_output_set_cursor(struct wlr_output *output,
|
|||
output->cursor.is_sw = true;
|
||||
output->cursor.width = width;
|
||||
output->cursor.height = height;
|
||||
output->cursor.hotspot_x = hotspot_x;
|
||||
output->cursor.hotspot_y = hotspot_y;
|
||||
|
||||
if (!output->cursor.renderer) {
|
||||
/* NULL egl is okay given that we are only using pixel buffers */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue