diff options
author | Damien Tardy-Panis <damien@tardypad.me> | 2020-05-05 18:35:03 +0200 |
---|---|---|
committer | Brian Ashworth <bosrsf04@gmail.com> | 2020-05-29 17:29:41 -0400 |
commit | 0cbd26f0dae32db38160a82d557017edab8bb632 (patch) | |
tree | 33d51bd6d990ca9606d0306e211e3d0e5f464494 /sway/desktop/idle_inhibit_v1.c | |
parent | seat_cmd_cursor: emit frame events (diff) | |
download | sway-0cbd26f0dae32db38160a82d557017edab8bb632.tar.gz sway-0cbd26f0dae32db38160a82d557017edab8bb632.tar.zst sway-0cbd26f0dae32db38160a82d557017edab8bb632.zip |
Add views idle inhibition status in get_tree output
Fixes #5286
Diffstat (limited to 'sway/desktop/idle_inhibit_v1.c')
-rw-r--r-- | sway/desktop/idle_inhibit_v1.c | 17 |
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( | |||
77 | return NULL; | 77 | return NULL; |
78 | } | 78 | } |
79 | 79 | ||
80 | struct sway_idle_inhibitor_v1 *sway_idle_inhibit_v1_application_inhibitor_for_view( | ||
81 | struct sway_view *view) { | ||
82 | struct sway_idle_inhibitor_v1 *inhibitor; | ||
83 | wl_list_for_each(inhibitor, &server.idle_inhibit_manager_v1->inhibitors, | ||
84 | link) { | ||
85 | if (inhibitor->view == view && | ||
86 | inhibitor->mode == INHIBIT_IDLE_APPLICATION) { | ||
87 | return inhibitor; | ||
88 | } | ||
89 | } | ||
90 | return NULL; | ||
91 | } | ||
92 | |||
80 | void sway_idle_inhibit_v1_user_inhibitor_destroy( | 93 | void sway_idle_inhibit_v1_user_inhibitor_destroy( |
81 | struct sway_idle_inhibitor_v1 *inhibitor) { | 94 | struct sway_idle_inhibitor_v1 *inhibitor) { |
82 | if (!inhibitor) { | 95 | if (!inhibitor) { |
@@ -89,7 +102,7 @@ void sway_idle_inhibit_v1_user_inhibitor_destroy( | |||
89 | destroy_inhibitor(inhibitor); | 102 | destroy_inhibitor(inhibitor); |
90 | } | 103 | } |
91 | 104 | ||
92 | static bool check_active(struct sway_idle_inhibitor_v1 *inhibitor) { | 105 | bool sway_idle_inhibit_v1_is_active(struct sway_idle_inhibitor_v1 *inhibitor) { |
93 | switch (inhibitor->mode) { | 106 | switch (inhibitor->mode) { |
94 | case INHIBIT_IDLE_APPLICATION: | 107 | case INHIBIT_IDLE_APPLICATION: |
95 | // If there is no view associated with the inhibitor, assume visible | 108 | // If there is no view associated with the inhibitor, assume visible |
@@ -122,7 +135,7 @@ void sway_idle_inhibit_v1_check_active( | |||
122 | struct sway_idle_inhibitor_v1 *inhibitor; | 135 | struct sway_idle_inhibitor_v1 *inhibitor; |
123 | bool inhibited = false; | 136 | bool inhibited = false; |
124 | wl_list_for_each(inhibitor, &manager->inhibitors, link) { | 137 | wl_list_for_each(inhibitor, &manager->inhibitors, link) { |
125 | if ((inhibited = check_active(inhibitor))) { | 138 | if ((inhibited = sway_idle_inhibit_v1_is_active(inhibitor))) { |
126 | break; | 139 | break; |
127 | } | 140 | } |
128 | } | 141 | } |