diff options
-rw-r--r-- | include/sway/input/cursor.h | 8 | ||||
-rw-r--r-- | sway/input/cursor.c | 14 |
2 files changed, 6 insertions, 16 deletions
diff --git a/include/sway/input/cursor.h b/include/sway/input/cursor.h index 03cb8b83..5dd109ca 100644 --- a/include/sway/input/cursor.h +++ b/include/sway/input/cursor.h | |||
@@ -6,7 +6,9 @@ | |||
6 | struct sway_cursor { | 6 | struct sway_cursor { |
7 | struct sway_seat *seat; | 7 | struct sway_seat *seat; |
8 | struct wlr_cursor *cursor; | 8 | struct wlr_cursor *cursor; |
9 | struct cursor_position *previous; | 9 | struct { |
10 | double x, y; | ||
11 | } previous; | ||
10 | struct wlr_xcursor_manager *xcursor_manager; | 12 | struct wlr_xcursor_manager *xcursor_manager; |
11 | 13 | ||
12 | struct wl_client *image_client; | 14 | struct wl_client *image_client; |
@@ -28,10 +30,6 @@ struct sway_cursor { | |||
28 | struct wl_listener request_set_cursor; | 30 | struct wl_listener request_set_cursor; |
29 | }; | 31 | }; |
30 | 32 | ||
31 | struct cursor_position { | ||
32 | double x, y; | ||
33 | }; | ||
34 | |||
35 | void sway_cursor_destroy(struct sway_cursor *cursor); | 33 | void sway_cursor_destroy(struct sway_cursor *cursor); |
36 | struct sway_cursor *sway_cursor_create(struct sway_seat *seat); | 34 | struct sway_cursor *sway_cursor_create(struct sway_seat *seat); |
37 | void cursor_send_pointer_motion(struct sway_cursor *cursor, uint32_t time_msec, | 35 | void cursor_send_pointer_motion(struct sway_cursor *cursor, uint32_t time_msec, |
diff --git a/sway/input/cursor.c b/sway/input/cursor.c index 1fa5be34..3e8fd5d8 100644 --- a/sway/input/cursor.c +++ b/sway/input/cursor.c | |||
@@ -147,10 +147,10 @@ void cursor_send_pointer_motion(struct sway_cursor *cursor, uint32_t time_msec, | |||
147 | 147 | ||
148 | // Find the container the pointer was previously over | 148 | // Find the container the pointer was previously over |
149 | struct sway_container *prev_c = container_at_coords(cursor->seat, | 149 | struct sway_container *prev_c = container_at_coords(cursor->seat, |
150 | cursor->previous->x, cursor->previous->y, &surface, &sx, &sy); | 150 | cursor->previous.x, cursor->previous.y, &surface, &sx, &sy); |
151 | // Update the stored previous position | 151 | // Update the stored previous position |
152 | cursor->previous->x = cursor->cursor->x; | 152 | cursor->previous.x = cursor->cursor->x; |
153 | cursor->previous->y = cursor->cursor->y; | 153 | cursor->previous.y = cursor->cursor->y; |
154 | 154 | ||
155 | struct sway_container *c = container_at_coords(cursor->seat, | 155 | struct sway_container *c = container_at_coords(cursor->seat, |
156 | cursor->cursor->x, cursor->cursor->y, &surface, &sx, &sy); | 156 | cursor->cursor->x, cursor->cursor->y, &surface, &sx, &sy); |
@@ -476,15 +476,8 @@ struct sway_cursor *sway_cursor_create(struct sway_seat *seat) { | |||
476 | return NULL; | 476 | return NULL; |
477 | } | 477 | } |
478 | 478 | ||
479 | struct cursor_position *previous = calloc(1, sizeof(struct cursor_position)); | ||
480 | if (!sway_assert(previous, "could not allocate sway cursor position")) { | ||
481 | free(cursor); | ||
482 | return NULL; | ||
483 | } | ||
484 | |||
485 | struct wlr_cursor *wlr_cursor = wlr_cursor_create(); | 479 | struct wlr_cursor *wlr_cursor = wlr_cursor_create(); |
486 | if (!sway_assert(wlr_cursor, "could not allocate wlr cursor")) { | 480 | if (!sway_assert(wlr_cursor, "could not allocate wlr cursor")) { |
487 | free(previous); | ||
488 | free(cursor); | 481 | free(cursor); |
489 | return NULL; | 482 | return NULL; |
490 | } | 483 | } |
@@ -535,7 +528,6 @@ struct sway_cursor *sway_cursor_create(struct sway_seat *seat) { | |||
535 | cursor->request_set_cursor.notify = handle_request_set_cursor; | 528 | cursor->request_set_cursor.notify = handle_request_set_cursor; |
536 | 529 | ||
537 | cursor->cursor = wlr_cursor; | 530 | cursor->cursor = wlr_cursor; |
538 | cursor->previous = previous; | ||
539 | 531 | ||
540 | return cursor; | 532 | return cursor; |
541 | } | 533 | } |