Transform hotspot with cursor

Fix #188
This commit is contained in:
Versus Void 2017-10-06 09:07:08 +03:00
parent b2d478a418
commit 641d08ce7e
10 changed files with 65 additions and 29 deletions

View file

@ -53,7 +53,8 @@ static void wlr_wl_output_transform(struct wlr_output *_output,
}
static bool wlr_wl_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) {
struct wlr_wl_backend_output *output = (struct wlr_wl_backend_output *)_output;
struct wlr_wl_backend *backend = output->backend;
@ -110,7 +111,8 @@ static bool wlr_wl_output_set_cursor(struct wlr_output *_output,
wl_surface_damage(output->cursor_surface, 0, 0, width, height);
wl_surface_commit(output->cursor_surface);
wlr_wl_output_update_cursor(output, output->enter_serial);
wlr_wl_output_update_cursor(output, output->enter_serial,
hotspot_x, hotspot_y);
return true;
}
@ -143,10 +145,11 @@ static void wlr_wl_output_destroy(struct wlr_output *_output) {
free(output);
}
void wlr_wl_output_update_cursor(struct wlr_wl_backend_output *output, uint32_t serial) {
void wlr_wl_output_update_cursor(struct wlr_wl_backend_output *output,
uint32_t serial, int32_t hotspot_x, int32_t hotspot_y) {
if (output->cursor_surface && output->backend->pointer && serial) {
wl_pointer_set_cursor(output->backend->pointer, serial,
output->cursor_surface, 0, 0);
output->cursor_surface, hotspot_x, hotspot_y);
}
}

View file

@ -24,7 +24,7 @@ static void pointer_handle_enter(void *data, struct wl_pointer *wl_pointer,
assert(output);
wlr_wl_pointer->current_output = output;
wlr_wl_pointer->current_output->enter_serial = serial;
wlr_wl_output_update_cursor(wlr_wl_pointer->current_output, serial);
wlr_wl_output_update_cursor(wlr_wl_pointer->current_output, serial, 0, 0);
}
static void pointer_handle_leave(void *data, struct wl_pointer *wl_pointer,