diff options
-rw-r--r-- | examples/pointer.c | 12 | ||||
-rw-r--r-- | xcursor/wlr_cursor.c | 11 |
2 files changed, 21 insertions, 2 deletions
diff --git a/examples/pointer.c b/examples/pointer.c index 6bd91a9e..ef815785 100644 --- a/examples/pointer.c +++ b/examples/pointer.c @@ -48,9 +48,13 @@ static void handle_pointer_motion(struct pointer_state *pstate, state->cur_x += d_x; state->cur_y += d_y; + struct wlr_cursor_image *image = state->cursor->images[0]; + struct output_state *output; wl_list_for_each(output, &pstate->compositor->outputs, link) { - wlr_output_move_cursor(output->output, state->cur_x, state->cur_y); + wlr_output_move_cursor(output->output, + state->cur_x - image->hotspot_x, + state->cur_y - image->hotspot_y); } } @@ -60,9 +64,13 @@ static void handle_pointer_motion_absolute(struct pointer_state *pstate, state->cur_x = x; state->cur_y = y; + struct wlr_cursor_image *image = state->cursor->images[0]; + struct output_state *output; wl_list_for_each(output, &pstate->compositor->outputs, link) { - wlr_output_move_cursor(output->output, state->cur_x, state->cur_y); + wlr_output_move_cursor(output->output, + state->cur_x - image->hotspot_x, + state->cur_y - image->hotspot_y); } } diff --git a/xcursor/wlr_cursor.c b/xcursor/wlr_cursor.c index c42f3d02..3a7da05b 100644 --- a/xcursor/wlr_cursor.c +++ b/xcursor/wlr_cursor.c @@ -26,6 +26,7 @@ #define _XOPEN_SOURCE 500 #include <wlr/render.h> #include <wlr/xcursor.h> +#include <wlr/util/log.h> #include <stdio.h> #include <stdlib.h> #include <stdint.h> @@ -238,6 +239,16 @@ struct wlr_cursor_theme *wlr_cursor_theme_load(const char *name, int size) { load_default_theme(theme); } + wlr_log(L_DEBUG, "Loaded cursor theme '%s', available cursors:", + theme->name); + for (size_t i = 0; i < theme->cursor_count; ++i) { + struct wlr_cursor *c = theme->cursors[i]; + struct wlr_cursor_image *i = c->images[0]; + wlr_log(L_DEBUG, "%s (%u images) %dx%d+%d,%d", + c->name, c->image_count, + i->width, i->height, i->hotspot_x, i->hotspot_y); + } + return theme; out_error_name: |