This commit is contained in:
vaxerski 2022-07-20 18:45:11 +02:00
parent 641aaff998
commit 3fa0992148
3 changed files with 9 additions and 0 deletions

View file

@ -72,6 +72,8 @@ public:
std::string m_szInstanceSignature = ""; std::string m_szInstanceSignature = "";
std::string m_szCurrentSplash = "error"; std::string m_szCurrentSplash = "error";
std::mutex m_mtxEventLoopMutex;
std::vector<std::unique_ptr<SMonitor>> m_vMonitors; std::vector<std::unique_ptr<SMonitor>> m_vMonitors;
std::vector<std::unique_ptr<CWindow>> m_vWindows; std::vector<std::unique_ptr<CWindow>> m_vWindows;
std::deque<std::unique_ptr<CWindow>> m_dUnmanagedX11Windows; std::deque<std::unique_ptr<CWindow>> m_dUnmanagedX11Windows;

View file

@ -592,12 +592,16 @@ std::string getRequestFromThread(std::string rq) {
static auto *const PNOVFR = &g_pConfigManager->getConfigValuePtr("misc:no_vfr")->intValue; static auto *const PNOVFR = &g_pConfigManager->getConfigValuePtr("misc:no_vfr")->intValue;
g_pCompositor->m_mtxEventLoopMutex.lock();
// TODO: is this safe...? // TODO: is this safe...?
// this might be a race condition // this might be a race condition
// tested with 2 instances of `watch -n 0.1 hyprctl splash` and seems to not crash so I'll take that as a yes // tested with 2 instances of `watch -n 0.1 hyprctl splash` and seems to not crash so I'll take that as a yes
if (!*PNOVFR) if (!*PNOVFR)
g_pCompositor->scheduleFrameForMonitor(g_pCompositor->m_vMonitors.front().get()); g_pCompositor->scheduleFrameForMonitor(g_pCompositor->m_vMonitors.front().get());
g_pCompositor->m_mtxEventLoopMutex.unlock();
while (HyprCtl::request != "" || HyprCtl::requestMade || HyprCtl::requestReady) { while (HyprCtl::request != "" || HyprCtl::requestMade || HyprCtl::requestReady) {
std::this_thread::sleep_for(std::chrono::milliseconds(5)); std::this_thread::sleep_for(std::chrono::milliseconds(5));
} }

View file

@ -2,10 +2,13 @@
#include "MiscFunctions.hpp" #include "MiscFunctions.hpp"
#include <string> #include <string>
#include "../debug/Log.hpp" #include "../debug/Log.hpp"
#include "../Compositor.hpp"
void handleWrapped(wl_listener* listener, void* data) { void handleWrapped(wl_listener* listener, void* data) {
CHyprWLListener* pListener = wl_container_of(listener, pListener, m_sListener); CHyprWLListener* pListener = wl_container_of(listener, pListener, m_sListener);
std::lock_guard<std::mutex> lg(g_pCompositor->m_mtxEventLoopMutex);
pListener->emit(data); pListener->emit(data);
} }