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/tree | |
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/tree')
-rw-r--r-- | sway/tree/view.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/sway/tree/view.c b/sway/tree/view.c index 2b4b6c09..8e12a229 100644 --- a/sway/tree/view.c +++ b/sway/tree/view.c | |||
@@ -17,6 +17,7 @@ | |||
17 | #include "sway/commands.h" | 17 | #include "sway/commands.h" |
18 | #include "sway/desktop.h" | 18 | #include "sway/desktop.h" |
19 | #include "sway/desktop/transaction.h" | 19 | #include "sway/desktop/transaction.h" |
20 | #include "sway/desktop/idle_inhibit_v1.h" | ||
20 | #include "sway/input/cursor.h" | 21 | #include "sway/input/cursor.h" |
21 | #include "sway/ipc-server.h" | 22 | #include "sway/ipc-server.h" |
22 | #include "sway/output.h" | 23 | #include "sway/output.h" |
@@ -164,6 +165,29 @@ uint32_t view_configure(struct sway_view *view, double lx, double ly, int width, | |||
164 | return 0; | 165 | return 0; |
165 | } | 166 | } |
166 | 167 | ||
168 | bool view_inhibit_idle(struct sway_view *view) { | ||
169 | struct sway_idle_inhibitor_v1 *user_inhibitor = | ||
170 | sway_idle_inhibit_v1_user_inhibitor_for_view(view); | ||
171 | |||
172 | struct sway_idle_inhibitor_v1 *application_inhibitor = | ||
173 | sway_idle_inhibit_v1_application_inhibitor_for_view(view); | ||
174 | |||
175 | if (!user_inhibitor && !application_inhibitor) { | ||
176 | return false; | ||
177 | } | ||
178 | |||
179 | if (!user_inhibitor) { | ||
180 | return sway_idle_inhibit_v1_is_active(application_inhibitor); | ||
181 | } | ||
182 | |||
183 | if (!application_inhibitor) { | ||
184 | return sway_idle_inhibit_v1_is_active(user_inhibitor); | ||
185 | } | ||
186 | |||
187 | return sway_idle_inhibit_v1_is_active(user_inhibitor) | ||
188 | || sway_idle_inhibit_v1_is_active(application_inhibitor); | ||
189 | } | ||
190 | |||
167 | bool view_is_only_visible(struct sway_view *view) { | 191 | bool view_is_only_visible(struct sway_view *view) { |
168 | bool only_view = true; | 192 | bool only_view = true; |
169 | struct sway_container *con = view->container; | 193 | struct sway_container *con = view->container; |