From 152a559e30244e64d4d61b9c87db442dfa04ee52 Mon Sep 17 00:00:00 2001 From: Kenny Levinsen Date: Sat, 20 Mar 2021 12:30:53 +0100 Subject: idle_inhibit: Store wlr inhibitor instead of view When an application inhibited idle, a view pointer was stored and a destroy listener was registered to the wlr inhibitor. As the wlr inhibitor lives longer than the view, this lead to a dangling view pointer between view unmap and inhibitor destroy. Store a pointer to the wlr inhibitor instead of to the view, and look up the view when needed, which may at any point be NULL. This also allows for an inhibitor to remain functional if a surface is re-mapped. --- include/sway/desktop/idle_inhibit_v1.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include/sway/desktop/idle_inhibit_v1.h') diff --git a/include/sway/desktop/idle_inhibit_v1.h b/include/sway/desktop/idle_inhibit_v1.h index 0adafdb9..58d54c68 100644 --- a/include/sway/desktop/idle_inhibit_v1.h +++ b/include/sway/desktop/idle_inhibit_v1.h @@ -22,6 +22,7 @@ struct sway_idle_inhibit_manager_v1 { struct sway_idle_inhibitor_v1 { struct sway_idle_inhibit_manager_v1 *manager; + struct wlr_idle_inhibitor_v1 *wlr_inhibitor; struct sway_view *view; enum sway_idle_inhibit_mode mode; -- cgit v1.2.3