fix ticks not firing

This commit is contained in:
vaxerski 2022-07-31 17:30:14 +02:00
parent c3eba7ea3c
commit 9926c0f69e
2 changed files with 6 additions and 6 deletions

View File

@ -29,14 +29,14 @@ void CHyprpaper::init() {
if (m_bIPCEnabled) {
std::thread([&]() { // we dispatch wl events cuz we have to
while (wl_display_dispatch(m_sDisplay) != -1) {
tick();
tick(true);
}
m_bShouldExit = true;
}).detach();
while (1) { // we also tick every 1ms for socket and other shit's updates
tick();
tick(false);
std::this_thread::sleep_for(std::chrono::milliseconds(1));
@ -45,17 +45,17 @@ void CHyprpaper::init() {
}
} else {
while (wl_display_dispatch(m_sDisplay) != -1) {
tick();
tick(true);
}
}
}
void CHyprpaper::tick() {
void CHyprpaper::tick(bool force) {
std::lock_guard<std::mutex> lg(m_mtTickMutex);
bool reload = g_pIPCSocket->mainThreadParseRequest();
if (!reload)
if (!reload && !force)
return;
preloadAllWallpapersFromConfig();

View File

@ -20,7 +20,7 @@ public:
// init the utility
CHyprpaper();
void init();
void tick();
void tick(bool force);
std::unordered_map<std::string, CWallpaperTarget> m_mWallpaperTargets;
std::unordered_map<std::string, std::string> m_mMonitorActiveWallpapers;