aboutsummaryrefslogtreecommitdiffstats
path: root/sway/input/cursor.c
diff options
context:
space:
mode:
authorLibravatar Rouven Czerwinski <rouven@czerwinskis.de>2019-02-26 20:46:25 +0100
committerLibravatar Brian Ashworth <bosrsf04@gmail.com>2019-02-27 00:35:51 -0500
commit4e028dba47f924b7a9133920fe8ebad4668ce9b7 (patch)
tree658bdf8061b9597f70efa8d17bdae2e8c9976239 /sway/input/cursor.c
parentcursor: remove unused node assignement (diff)
downloadsway-4e028dba47f924b7a9133920fe8ebad4668ce9b7.tar.gz
sway-4e028dba47f924b7a9133920fe8ebad4668ce9b7.tar.zst
sway-4e028dba47f924b7a9133920fe8ebad4668ce9b7.zip
cursor: intitialize sx and sy to zero
If node_at_coords does an early return without setting these values, they can be used uninitialized later. Initialize both to zero.
Diffstat (limited to 'sway/input/cursor.c')
-rw-r--r--sway/input/cursor.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sway/input/cursor.c b/sway/input/cursor.c
index 210e6144..87811550 100644
--- a/sway/input/cursor.c
+++ b/sway/input/cursor.c
@@ -280,7 +280,7 @@ static void cursor_do_rebase(struct sway_cursor *cursor, uint32_t time_msec,
280void cursor_rebase(struct sway_cursor *cursor) { 280void cursor_rebase(struct sway_cursor *cursor) {
281 uint32_t time_msec = get_current_time_msec(); 281 uint32_t time_msec = get_current_time_msec();
282 struct wlr_surface *surface = NULL; 282 struct wlr_surface *surface = NULL;
283 double sx, sy; 283 double sx = 0.0, sy = 0.0;
284 cursor->previous.node = node_at_coords(cursor->seat, 284 cursor->previous.node = node_at_coords(cursor->seat,
285 cursor->cursor->x, cursor->cursor->y, &surface, &sx, &sy); 285 cursor->cursor->x, cursor->cursor->y, &surface, &sx, &sy);
286 cursor_do_rebase(cursor, time_msec, cursor->previous.node, surface, sx, sy); 286 cursor_do_rebase(cursor, time_msec, cursor->previous.node, surface, sx, sy);
@@ -476,7 +476,7 @@ static void cursor_motion_absolute(struct sway_cursor *cursor,
476 dx, dy, dx, dy); 476 dx, dy, dx, dy);
477 477
478 struct wlr_surface *surface = NULL; 478 struct wlr_surface *surface = NULL;
479 double sx, sy; 479 double sx = 0.0, sy = 0.0;
480 struct sway_node *node = node_at_coords(cursor->seat, 480 struct sway_node *node = node_at_coords(cursor->seat,
481 lx, ly, &surface, &sx, &sy); 481 lx, ly, &surface, &sx, &sy);
482 482