aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/managers/ThreadManager.cpp
blob: 6f8e0c9abc33d2d87ec45eceab0b8e957883ee32 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#include "ThreadManager.hpp"
#include "../debug/HyprCtl.hpp"
#include "../Compositor.hpp"
#include "../config/ConfigValue.hpp"

int slowUpdate = 0;

int handleTimer(void* data) {
    const auto  PTM = (CThreadManager*)data;

    static auto PDISABLECFGRELOAD = CConfigValue<Hyprlang::INT>("misc:disable_autoreload");

    if (*PDISABLECFGRELOAD != 1)
        g_pConfigManager->tick();

    wl_event_source_timer_update(PTM->m_esConfigTimer, 1000);

    return 0;
}

CThreadManager::CThreadManager() {
    m_esConfigTimer = wl_event_loop_add_timer(g_pCompositor->m_sWLEventLoop, handleTimer, this);

    wl_event_source_timer_update(m_esConfigTimer, 1000);
}

CThreadManager::~CThreadManager() {
    if (m_esConfigTimer)
        wl_event_source_remove(m_esConfigTimer);
}