mirror of
https://github.com/hyprwm/Hyprland.git
synced 2025-08-06 15:11:57 -07:00
fix lockup on reloading config
This commit is contained in:
@@ -24,6 +24,7 @@ CConfigManager::CConfigManager() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CConfigManager::init() {
|
void CConfigManager::init() {
|
||||||
|
|
||||||
loadConfigLoadVars();
|
loadConfigLoadVars();
|
||||||
|
|
||||||
const char* const ENVHOME = getenv("HOME");
|
const char* const ENVHOME = getenv("HOME");
|
||||||
@@ -289,7 +290,8 @@ void CConfigManager::tick() {
|
|||||||
struct stat fileStat;
|
struct stat fileStat;
|
||||||
int err = stat(CONFIGPATH.c_str(), &fileStat);
|
int err = stat(CONFIGPATH.c_str(), &fileStat);
|
||||||
if (err != 0) {
|
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
|
// check if we need to reload cfg
|
||||||
|
@@ -14,15 +14,21 @@ CThreadManager::~CThreadManager() {
|
|||||||
//
|
//
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int slowUpdate = 0;
|
||||||
|
|
||||||
void CThreadManager::handle() {
|
void CThreadManager::handle() {
|
||||||
|
|
||||||
g_pConfigManager->init();
|
g_pConfigManager->init();
|
||||||
|
|
||||||
while (3.1415f) {
|
while (3.1415f) {
|
||||||
|
slowUpdate++;
|
||||||
|
if (slowUpdate >= g_pConfigManager->getInt("general:max_fps")){
|
||||||
g_pConfigManager->tick();
|
g_pConfigManager->tick();
|
||||||
|
slowUpdate = 0;
|
||||||
|
}
|
||||||
|
|
||||||
HyprCtl::tickHyprCtl();
|
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")));
|
||||||
}
|
}
|
||||||
}
|
}
|
Reference in New Issue
Block a user