From cc858e605a465a40abfce0fb53a70e59a79c248d Mon Sep 17 00:00:00 2001
From: Rouven Czerwinski <rouven@czerwinskis.de>
Date: Mon, 7 Jan 2019 13:23:28 +0100
Subject: seat: unhide the cursor if it is warped to focus

Unhide the cursor if container warping is enabled.
Also set the image_surface to NULL during view_unmap, otherwise the cursor will
try to access the surface which is currently being unmapped.
---
 sway/input/seat.c | 4 ++++
 sway/tree/view.c  | 1 +
 2 files changed, 5 insertions(+)

diff --git a/sway/input/seat.c b/sway/input/seat.c
index 9422713d..52790039 100644
--- a/sway/input/seat.c
+++ b/sway/input/seat.c
@@ -1231,4 +1231,8 @@ void seat_consider_warp_to_focus(struct sway_seat *seat) {
 	} else {
 		cursor_warp_to_workspace(seat->cursor, focus->sway_workspace);
 	}
+	if (seat->cursor->hidden){
+		cursor_unhide(seat->cursor);
+		wl_event_source_timer_update(seat->cursor->hide_source, cursor_get_timeout(seat->cursor));
+	}
 }
diff --git a/sway/tree/view.c b/sway/tree/view.c
index 28728420..5371ee20 100644
--- a/sway/tree/view.c
+++ b/sway/tree/view.c
@@ -654,6 +654,7 @@ void view_unmap(struct sway_view *view) {
 
 	struct sway_seat *seat;
 	wl_list_for_each(seat, &server.input->seats, link) {
+		seat->cursor->image_surface = NULL;
 		seat_consider_warp_to_focus(seat);
 	}
 
-- 
cgit v1.2.3