[gnome-settings-daemon/benzea/fix-vm-autologout: 4/4] power: Only disable Suspend/Hibernate actions inside VM
- From: Benjamin Berg <bberg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-settings-daemon/benzea/fix-vm-autologout: 4/4] power: Only disable Suspend/Hibernate actions inside VM
- Date: Tue, 7 May 2019 14:05:57 +0000 (UTC)
commit c07ea84b54964ef95461047c53d358f4570e8808
Author: Benjamin Berg <bberg redhat com>
Date: Tue May 7 15:40:20 2019 +0200
power: Only disable Suspend/Hibernate actions inside VM
While we theoretically only want a different default value inside a VM,
we currently hack this by never doing a suspend action inside VMs.
However, that also breaks automatic logout, which is an unintended side
effect.
Move the check to not install the corresponding timeout (preventing
sleep warnings from being displayed) and also only enforce the VM
specific hack for the Suspend and Hibernate actions.
plugins/power/gsd-power-manager.c | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
---
diff --git a/plugins/power/gsd-power-manager.c b/plugins/power/gsd-power-manager.c
index 94e86a3d..7d5dc71b 100644
--- a/plugins/power/gsd-power-manager.c
+++ b/plugins/power/gsd-power-manager.c
@@ -1524,13 +1524,6 @@ idle_set_mode (GsdPowerManager *manager, GsdPowerIdleMode mode)
return;
}
- /* don't do any power saving if we're a VM */
- if (manager->is_virtual_machine) {
- g_debug ("ignoring state transition to %s as virtual machine",
- idle_mode_to_string (mode));
- return;
- }
-
manager->current_idle_mode = mode;
g_debug ("Doing a state transition: %s", idle_mode_to_string (mode));
@@ -1731,6 +1724,14 @@ idle_configure (GsdPowerManager *manager)
clear_idle_watch (manager->idle_monitor,
&manager->idle_sleep_warning_id);
+ /* don't do any power saving if we're a VM */
+ if (manager->is_virtual_machine &&
+ (action_type == GSD_POWER_ACTION_SUSPEND ||
+ action_type == GSD_POWER_ACTION_HIBERNATE)) {
+ g_debug ("Ignoring sleep timeout with suspend action inside VM");
+ timeout_sleep = 0;
+ }
+
if (timeout_sleep != 0) {
g_debug ("setting up sleep callback %is", timeout_sleep);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]