diff --git a/src/Hyprpaper.cpp b/src/Hyprpaper.cpp index 8548ad9..373abcb 100644 --- a/src/Hyprpaper.cpp +++ b/src/Hyprpaper.cpp @@ -26,13 +26,12 @@ void CHyprpaper::init() { wl_registry_add_listener(registry, &Events::registryListener, nullptr); while (wl_display_dispatch(m_sDisplay) != -1) { + std::lock_guard lg(m_mtTickMutex); tick(true); } } void CHyprpaper::tick(bool force) { - std::lock_guard lg(m_mtTickMutex); - bool reload = g_pIPCSocket->mainThreadParseRequest(); if (!reload && !force) diff --git a/src/events/Events.cpp b/src/events/Events.cpp index 1852ae4..7d7591b 100644 --- a/src/events/Events.cpp +++ b/src/events/Events.cpp @@ -16,6 +16,7 @@ void Events::done(void *data, wl_output *wl_output) { PMONITOR->readyForLS = true; + std::lock_guard lg(g_pHyprpaper->m_mtTickMutex); g_pHyprpaper->tick(true); } @@ -151,6 +152,7 @@ void Events::handlePreferredScale(void *data, wp_fractional_scale_v1* fractional if (pLS->fScale != SCALE) { pLS->fScale = SCALE; + std::lock_guard lg(g_pHyprpaper->m_mtTickMutex); g_pHyprpaper->tick(true); } } diff --git a/src/ipc/Socket.cpp b/src/ipc/Socket.cpp index 252e1d5..366d0ef 100644 --- a/src/ipc/Socket.cpp +++ b/src/ipc/Socket.cpp @@ -57,6 +57,8 @@ void CIPCSocket::initialize() { break; } + std::lock_guard lg(g_pHyprpaper->m_mtTickMutex); + auto messageSize = read(ACCEPTEDCONNECTION, readBuffer, 1024); readBuffer[messageSize == 1024 ? 1023 : messageSize] = '\0';