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

View file

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