diff options
author | Drew DeVault <sir@cmpwn.com> | 2017-08-08 11:44:44 -0400 |
---|---|---|
committer | Drew DeVault <sir@cmpwn.com> | 2017-08-08 11:44:44 -0400 |
commit | 9383aaf89ea468fc6eb1aff413bfe456c9aed739 (patch) | |
tree | 47b34f66640cc7a9b03f56eabc07773f1857f1a4 /examples | |
parent | afd058b754e568728fbc7e2e34651dab9a8a827f (diff) |
Accomodate for hotspot in cursor position
Diffstat (limited to 'examples')
-rw-r--r-- | examples/pointer.c | 12 |
1 files changed, 10 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); } } |