aboutsummaryrefslogtreecommitdiffstats
path: root/sway/desktop/idle_inhibit_v1.c
diff options
context:
space:
mode:
Diffstat (limited to 'sway/desktop/idle_inhibit_v1.c')
-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(
77 return NULL; 77 return NULL;
78} 78}
79 79
80struct 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
80void sway_idle_inhibit_v1_user_inhibitor_destroy( 93void 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
92static bool check_active(struct sway_idle_inhibitor_v1 *inhibitor) { 105bool 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 }