From a92150c2b752b72b6ab64bc18f9d1b0f105b10f9 Mon Sep 17 00:00:00 2001 From: Bastien Nocera Date: Mon, 10 Aug 2020 15:31:02 +0200 Subject: [PATCH] main: Fix transitions if one profile is inhibited When transitioning from one profile to another, we only want to stop the active profile from changing if the target profile is inhibited, which it might not be if we want to switch to, say, the power-saver profile. This was broken since drivers could handle more than one profile. --- src/power-profiles-daemon.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/power-profiles-daemon.c b/src/power-profiles-daemon.c index 00e3ace..7502a23 100644 --- a/src/power-profiles-daemon.c +++ b/src/power-profiles-daemon.c @@ -247,13 +247,14 @@ set_selected_profile (PpdApp *data, return FALSE; } - g_debug ("Transitioning from '%s' to '%s'", + g_debug ("Transitioning selected profile from '%s' to '%s'", ppd_profile_to_str (data->selected_profile), profile); data->selected_profile = target_profile; - if (ppd_driver_is_inhibited (SELECTED_DRIVER)) { + if (target_profile == PPD_PROFILE_PERFORMANCE && + ppd_driver_is_inhibited (SELECTED_DRIVER)) { send_dbus_event (data, PROP_SELECTED_PROFILE); - g_debug ("Not transitioning to '%s' as inhibited", profile); + g_debug ("Not transitioning active profile to '%s' as inhibited", profile); return TRUE; }