From 63e45bf3217a484775f24f14c05d228c79348b7a Mon Sep 17 00:00:00 2001
From: Some Chinese Guy <freemancrowbar100500@gmail.com>
Date: Sat, 28 Mar 2020 23:49:35 +0300
Subject: [PATCH] switched to setting focus with seat_set_focus

---
 sway/input/cursor.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/sway/input/cursor.c b/sway/input/cursor.c
index 5dc7290d..878a8e99 100644
--- a/sway/input/cursor.c
+++ b/sway/input/cursor.c
@@ -352,7 +352,7 @@ static void handle_touch_down(struct wl_listener *listener, void *data) {
 	wlr_cursor_absolute_to_layout_coords(cursor->cursor, event->device,
 			event->x, event->y, &lx, &ly);
 	double sx, sy;
-	node_at_coords(seat, lx, ly, &surface, &sx, &sy);
+	struct sway_node *focused_node = node_at_coords(seat, lx, ly, &surface, &sx, &sy);
 
 	seat->touch_id = event->touch_id;
 	seat->touch_x = lx;
@@ -369,11 +369,7 @@ static void handle_touch_down(struct wl_listener *listener, void *data) {
 		cursor_hide(cursor);
 	}
 
-	//move cursor so focus follows touch
-	float delta_x = lx - cursor->cursor->x;
-	float delta_y = ly - cursor->cursor->y;
-	cursor_motion(cursor, 0, event->device, delta_x,
-		      delta_y, delta_x, delta_y);
+	seat_set_focus(seat, focused_node);
 }
 
 static void handle_touch_up(struct wl_listener *listener, void *data) {