aboutsummaryrefslogtreecommitdiff
path: root/sway/desktop
diff options
context:
space:
mode:
authorDamien Tardy-Panis <damien@tardypad.me>2020-05-05 18:35:03 +0200
committerBrian Ashworth <bosrsf04@gmail.com>2020-05-29 17:29:41 -0400
commit0cbd26f0dae32db38160a82d557017edab8bb632 (patch)
tree33d51bd6d990ca9606d0306e211e3d0e5f464494 /sway/desktop
parent8cdcb77e12bf9c52fb51ce9a7da7e6a850fa5a37 (diff)
downloadsway-0cbd26f0dae32db38160a82d557017edab8bb632.tar.xz
Add views idle inhibition status in get_tree output
Fixes #5286
Diffstat (limited to 'sway/desktop')
-rw-r--r--sway/desktop/idle_inhibit_v1.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/sway/desktop/idle_inhibit_v1.c b/sway/desktop/idle_inhibit_v1.c
index 73e46a8f..a5cfd5b2 100644
--- a/sway/desktop/idle_inhibit_v1.c
+++ b/sway/desktop/idle_inhibit_v1.c
@@ -77,6 +77,19 @@ struct sway_idle_inhibitor_v1 *sway_idle_inhibit_v1_user_inhibitor_for_view(
return NULL;
}
+struct sway_idle_inhibitor_v1 *sway_idle_inhibit_v1_application_inhibitor_for_view(
+ struct sway_view *view) {
+ struct sway_idle_inhibitor_v1 *inhibitor;
+ wl_list_for_each(inhibitor, &server.idle_inhibit_manager_v1->inhibitors,
+ link) {
+ if (inhibitor->view == view &&
+ inhibitor->mode == INHIBIT_IDLE_APPLICATION) {
+ return inhibitor;
+ }
+ }
+ return NULL;
+}
+
void sway_idle_inhibit_v1_user_inhibitor_destroy(
struct sway_idle_inhibitor_v1 *inhibitor) {
if (!inhibitor) {
@@ -89,7 +102,7 @@ void sway_idle_inhibit_v1_user_inhibitor_destroy(
destroy_inhibitor(inhibitor);
}
-static bool check_active(struct sway_idle_inhibitor_v1 *inhibitor) {
+bool sway_idle_inhibit_v1_is_active(struct sway_idle_inhibitor_v1 *inhibitor) {
switch (inhibitor->mode) {
case INHIBIT_IDLE_APPLICATION:
// If there is no view associated with the inhibitor, assume visible
@@ -122,7 +135,7 @@ void sway_idle_inhibit_v1_check_active(
struct sway_idle_inhibitor_v1 *inhibitor;
bool inhibited = false;
wl_list_for_each(inhibitor, &manager->inhibitors, link) {
- if ((inhibited = check_active(inhibitor))) {
+ if ((inhibited = sway_idle_inhibit_v1_is_active(inhibitor))) {
break;
}
}