stop polling in main thread

This commit is contained in:
vaxerski 2022-11-02 21:41:32 +00:00
parent 707ae57d44
commit 1f55dda5e2
2 changed files with 5 additions and 21 deletions

View file

@ -25,28 +25,10 @@ void CHyprpaper::init() {
wl_registry *registry = wl_display_get_registry(m_sDisplay);
wl_registry_add_listener(registry, &Events::registryListener, nullptr);
if (m_bIPCEnabled) {
std::thread([&]() { // we dispatch wl events cuz we have to
while (wl_display_dispatch(m_sDisplay) != -1) {
tick(true);
}
m_bShouldExit = true;
}).detach();
while (true) { // we also tick every 1ms for socket and other shit's updates
tick(false);
std::this_thread::sleep_for(std::chrono::milliseconds(1));
if (m_bShouldExit)
break;
}
} else {
while (wl_display_dispatch(m_sDisplay) != -1) {
tick(true);
}
while (wl_display_dispatch(m_sDisplay) != -1) {
tick(true);
}
}
void CHyprpaper::tick(bool force) {

View file

@ -65,6 +65,8 @@ void CIPCSocket::initialize() {
m_szRequest = request;
m_bRequestReady = true;
g_pHyprpaper->tick(true);
while (1) {
if (m_bReplyReady)
break;