mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-26 07:05:58 +01:00
tick hyprctl separately
This commit is contained in:
parent
4610b3d864
commit
edac94bed1
5 changed files with 24 additions and 13 deletions
|
@ -1,6 +1,7 @@
|
|||
#include "Compositor.hpp"
|
||||
#include "helpers/Splashes.hpp"
|
||||
#include <random>
|
||||
#include "debug/HyprCtl.hpp"
|
||||
|
||||
int handleCritSignal(int signo, void* data) {
|
||||
Debug::log(LOG, "Hyprland received signal %d", signo);
|
||||
|
@ -1477,4 +1478,21 @@ CWindow* CCompositor::getWindowByRegex(const std::string& regexp) {
|
|||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
wl_event_source* hyprCtlTickSource = nullptr;
|
||||
|
||||
int hyprCtlTick(void* data) {
|
||||
HyprCtl::tickHyprCtl(); // so that we dont get that race condition multithread bullshit
|
||||
|
||||
wl_event_source_timer_update(hyprCtlTickSource, 16); // tick it 60/s, should be enough.
|
||||
}
|
||||
|
||||
void CCompositor::startHyprCtlTick() {
|
||||
if (hyprCtlTickSource)
|
||||
return;
|
||||
|
||||
hyprCtlTickSource = wl_event_loop_add_timer(m_sWLEventLoop, hyprCtlTick, nullptr);
|
||||
|
||||
wl_event_source_timer_update(hyprCtlTickSource, 16);
|
||||
}
|
|
@ -154,9 +154,11 @@ public:
|
|||
|
||||
std::string explicitConfigPath;
|
||||
|
||||
void startHyprCtlTick();
|
||||
|
||||
private:
|
||||
void initAllSignals();
|
||||
void setRandomSplash();
|
||||
void setRandomSplash();
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -592,16 +592,7 @@ void HyprCtl::tickHyprCtl() {
|
|||
}
|
||||
|
||||
std::string getRequestFromThread(std::string rq) {
|
||||
// we need to do something to wake hyprland up if VFR is enabled
|
||||
|
||||
static auto *const PNOVFR = &g_pConfigManager->getConfigValuePtr("misc:no_vfr")->intValue;
|
||||
|
||||
// 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());
|
||||
|
||||
|
||||
while (HyprCtl::request != "" || HyprCtl::requestMade || HyprCtl::requestReady) {
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(5));
|
||||
}
|
||||
|
|
|
@ -120,8 +120,6 @@ void Events::listener_monitorFrame(void* owner, void* data) {
|
|||
g_pCompositor->sanityCheckWorkspaces();
|
||||
g_pAnimationManager->tick();
|
||||
|
||||
HyprCtl::tickHyprCtl(); // so that we dont get that race condition multithread bullshit
|
||||
|
||||
g_pConfigManager->dispatchExecOnce(); // We exec-once when at least one monitor starts refreshing, meaning stuff has init'd
|
||||
|
||||
if (g_pConfigManager->m_bWantsMonitorReload)
|
||||
|
|
|
@ -19,6 +19,8 @@ CThreadManager::CThreadManager() {
|
|||
|
||||
HyprCtl::startHyprCtlSocket();
|
||||
|
||||
g_pCompositor->startHyprCtlTick();
|
||||
|
||||
m_esConfigTimer = wl_event_loop_add_timer(g_pCompositor->m_sWLEventLoop, handleTimer, this);
|
||||
|
||||
wl_event_source_timer_update(m_esConfigTimer, 1000);
|
||||
|
|
Loading…
Reference in a new issue