idle_inhibit: Listen for destroy instead of unmap

The protocol does not specify that we should tear down the idle
inhibitor on unmap, so there is no point doing so. However, we do need
to tear it down on destroy, which we failed to do.

Move the handler from unmap to destroy.
This commit is contained in:
Kenny Levinsen 2021-03-16 21:58:40 +01:00
parent adf7a6f892
commit a4f0fcede1

View file

@ -59,7 +59,7 @@ void sway_idle_inhibit_v1_user_inhibitor_register(struct sway_view *view,
wl_list_insert(&inhibitor->manager->inhibitors, &inhibitor->link); wl_list_insert(&inhibitor->manager->inhibitors, &inhibitor->link);
inhibitor->destroy.notify = handle_destroy; inhibitor->destroy.notify = handle_destroy;
wl_signal_add(&view->events.unmap, &inhibitor->destroy); wl_signal_add(&view->events.destroy, &inhibitor->destroy);
sway_idle_inhibit_v1_check_active(inhibitor->manager); sway_idle_inhibit_v1_check_active(inhibitor->manager);
} }
@ -122,7 +122,6 @@ bool sway_idle_inhibit_v1_is_active(struct sway_idle_inhibitor_v1 *inhibitor) {
container_is_fullscreen_or_child(inhibitor->view->container) && container_is_fullscreen_or_child(inhibitor->view->container) &&
view_is_visible(inhibitor->view); view_is_visible(inhibitor->view);
case INHIBIT_IDLE_OPEN: case INHIBIT_IDLE_OPEN:
// Inhibitor is destroyed on unmap so it must be open/mapped
return true; return true;
case INHIBIT_IDLE_VISIBLE: case INHIBIT_IDLE_VISIBLE:
return view_is_visible(inhibitor->view); return view_is_visible(inhibitor->view);