From 80668d77adcae59f6cf59478864b554fe1ae1ec7 Mon Sep 17 00:00:00 2001 From: Vulpine05 Date: Sun, 9 Oct 2022 20:09:56 -0500 Subject: [PATCH 1/2] Modify preferences if idle time to suspend and suspend when idle overlap. --- lib/prefs.cpp | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/lib/prefs.cpp b/lib/prefs.cpp index 6a781e18e19..ddceac8dab1 100644 --- a/lib/prefs.cpp +++ b/lib/prefs.cpp @@ -1,6 +1,6 @@ // This file is part of BOINC. // http://boinc.berkeley.edu -// Copyright (C) 2008 University of California +// Copyright (C) 2022 University of California // // BOINC is free software; you can redistribute it and/or modify it // under the terms of the GNU Lesser General Public License @@ -408,6 +408,21 @@ int GLOBAL_PREFS::parse_override( if (!mask.niu_suspend_cpu_usage) { niu_suspend_cpu_usage = suspend_cpu_usage; } + // Checks for a condition where no computing could occur if suspend until idle and + // suspend after being idle overlap. + if (mask.idle_time_to_run && mask.suspend_if_no_recent_input) { + if ((idle_time_to_run - suspend_if_no_recent_input + 0.005) >= 0) { + // It is more likely the user will notice BOINC operating while computer is in + // use. Therefore setting idle time to run to 0 should give the user an indication that one + // of the settings did not apply. + idle_time_to_run = 0; + mask.idle_time_to_run = false; + run_if_user_active = true; + mask.run_if_user_active = true; + run_gpu_if_user_active = true; + mask.run_gpu_if_user_active = true; + } + } return 0; } if (in_venue) { @@ -765,7 +780,7 @@ void GLOBAL_PREFS::write_day_prefs(MIOFILE& f) { bool net_present = net_times.week.days[i].present; //write only when needed if (net_present || cpu_present) { - + f.printf(" \n"); f.printf(" %d\n", i); if (cpu_present) { From c5f1a3c930b1b51a75e55421fdc89149ede10822 Mon Sep 17 00:00:00 2001 From: Vulpine05 Date: Fri, 23 Dec 2022 21:18:07 -0600 Subject: [PATCH 2/2] Add client messages to parse_override --- lib/prefs.cpp | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/lib/prefs.cpp b/lib/prefs.cpp index ddceac8dab1..1b61bb40acd 100644 --- a/lib/prefs.cpp +++ b/lib/prefs.cpp @@ -32,8 +32,9 @@ #include "error_numbers.h" #include "str_replace.h" #include "parse.h" +#include "str_util.h" #include "util.h" - +#include "..\client\client_msgs.h" #include "prefs.h" void GLOBAL_PREFS_MASK::set_all() { @@ -410,17 +411,10 @@ int GLOBAL_PREFS::parse_override( } // Checks for a condition where no computing could occur if suspend until idle and // suspend after being idle overlap. + // if (mask.idle_time_to_run && mask.suspend_if_no_recent_input) { if ((idle_time_to_run - suspend_if_no_recent_input + 0.005) >= 0) { - // It is more likely the user will notice BOINC operating while computer is in - // use. Therefore setting idle time to run to 0 should give the user an indication that one - // of the settings did not apply. - idle_time_to_run = 0; - mask.idle_time_to_run = false; - run_if_user_active = true; - mask.run_if_user_active = true; - run_gpu_if_user_active = true; - mask.run_gpu_if_user_active = true; + msg_printf(NULL, MSG_USER_ALERT, "%s", "Test message."); } } return 0;