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_szCurrentSplash = "error";
std::mutex m_mtxEventLoopMutex;
std::vector<std::unique_ptr<SMonitor>> m_vMonitors;
std::vector<std::unique_ptr<CWindow>> m_vWindows;
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;
g_pCompositor->m_mtxEventLoopMutex.lock();
// TODO: is this safe...?
// 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
if (!*PNOVFR)
g_pCompositor->scheduleFrameForMonitor(g_pCompositor->m_vMonitors.front().get());
g_pCompositor->m_mtxEventLoopMutex.unlock();
while (HyprCtl::request != "" || HyprCtl::requestMade || HyprCtl::requestReady) {
std::this_thread::sleep_for(std::chrono::milliseconds(5));
}

View File

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