backends: Update inhibited state for the monitor and respect that state

The inhibited state of the monitor was after the initializiation never
updated. meta_idle_monitor_reset_idletime didn't respect the inhibited
state, so it set timeouts if it shouldn't have.

Fixes: https://gitlab.gnome.org/GNOME/mutter/issues/573
This commit is contained in:
Tim Klocke 2019-10-09 10:24:54 +02:00 committed by Jonas Ådahl
parent 658c741420
commit 81ee8886ce

View File

@ -207,6 +207,8 @@ update_inhibited (MetaIdleMonitor *monitor,
if (inhibited == monitor->inhibited) if (inhibited == monitor->inhibited)
return; return;
monitor->inhibited = inhibited;
g_hash_table_foreach (monitor->watches, g_hash_table_foreach (monitor->watches,
update_inhibited_watch, update_inhibited_watch,
monitor); monitor);
@ -516,9 +518,16 @@ meta_idle_monitor_reset_idletime (MetaIdleMonitor *monitor)
} }
else else
{ {
g_source_set_ready_time (watch->timeout_source, if (monitor->inhibited)
monitor->last_event_time + {
watch->timeout_msec * 1000); g_source_set_ready_time (watch->timeout_source, -1);
}
else
{
g_source_set_ready_time (watch->timeout_source,
monitor->last_event_time +
watch->timeout_msec * 1000);
}
} }
} }