aboutsummaryrefslogtreecommitdiffstats
path: root/sway/input/cursor.c
diff options
context:
space:
mode:
authorLibravatar Scott Leggett <scott@sl.id.au>2018-05-28 02:14:19 +1000
committerLibravatar Scott Leggett <scott@sl.id.au>2018-05-28 02:14:19 +1000
commit1b8de3928714950d715053523d99aa1572ac63e0 (patch)
tree85301eeb8d78e5f45ab464b8d9e95a06cc0b4995 /sway/input/cursor.c
parentRemove unused function. (diff)
downloadsway-1b8de3928714950d715053523d99aa1572ac63e0.tar.gz
sway-1b8de3928714950d715053523d99aa1572ac63e0.tar.zst
sway-1b8de3928714950d715053523d99aa1572ac63e0.zip
Move previous cursor_position inline.
Diffstat (limited to 'sway/input/cursor.c')
-rw-r--r--sway/input/cursor.c14
1 files changed, 3 insertions, 11 deletions
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}