mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-07 15:05:58 +01:00
fix lockup on reloading config
This commit is contained in:
parent
db56e01c63
commit
2e9bd86c8b
2 changed files with 13 additions and 5 deletions
|
@ -13,8 +13,8 @@
|
|||
CConfigManager::CConfigManager() {
|
||||
configValues["general:max_fps"].intValue = 240;
|
||||
configValues["general:sensitivity"].floatValue = 0.25f;
|
||||
configValues["general:main_mod"].strValue = "SUPER"; // exposed to the user for easier configuring
|
||||
configValues["general:main_mod_internal"].intValue = g_pKeybindManager->stringToModMask("SUPER"); // actually used and automatically calculated
|
||||
configValues["general:main_mod"].strValue = "SUPER"; // exposed to the user for easier configuring
|
||||
configValues["general:main_mod_internal"].intValue = g_pKeybindManager->stringToModMask("SUPER"); // actually used and automatically calculated
|
||||
|
||||
configValues["general:border_size"].intValue = 1;
|
||||
configValues["general:gaps_in"].intValue = 5;
|
||||
|
@ -24,6 +24,7 @@ CConfigManager::CConfigManager() {
|
|||
}
|
||||
|
||||
void CConfigManager::init() {
|
||||
|
||||
loadConfigLoadVars();
|
||||
|
||||
const char* const ENVHOME = getenv("HOME");
|
||||
|
@ -289,7 +290,8 @@ void CConfigManager::tick() {
|
|||
struct stat fileStat;
|
||||
int err = stat(CONFIGPATH.c_str(), &fileStat);
|
||||
if (err != 0) {
|
||||
Debug::log(WARN, "Error at ticking config, error %i", errno);
|
||||
Debug::log(WARN, "Error at ticking config at %s, error %i: %s", CONFIGPATH.c_str(), err, strerror(err));
|
||||
return;
|
||||
}
|
||||
|
||||
// check if we need to reload cfg
|
||||
|
|
|
@ -14,15 +14,21 @@ CThreadManager::~CThreadManager() {
|
|||
//
|
||||
}
|
||||
|
||||
int slowUpdate = 0;
|
||||
|
||||
void CThreadManager::handle() {
|
||||
|
||||
g_pConfigManager->init();
|
||||
|
||||
while (3.1415f) {
|
||||
g_pConfigManager->tick();
|
||||
slowUpdate++;
|
||||
if (slowUpdate >= g_pConfigManager->getInt("general:max_fps")){
|
||||
g_pConfigManager->tick();
|
||||
slowUpdate = 0;
|
||||
}
|
||||
|
||||
HyprCtl::tickHyprCtl();
|
||||
|
||||
std::this_thread::sleep_for(std::chrono::microseconds(1000000 / g_pConfigManager->getInt("max_fps")));
|
||||
std::this_thread::sleep_for(std::chrono::microseconds(1000000 / g_pConfigManager->getInt("general:max_fps")));
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue