blob: 0715594b63335b56cf54aca557c3be7c47e0c6c7 (
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
|
#include "PropRefresher.hpp"
#include "../../../managers/eventLoop/EventLoopManager.hpp"
#include "../../../managers/input/InputManager.hpp"
#include "../../../render/Renderer.hpp"
#include "../../../Compositor.hpp"
#include "../../../layout/supplementary/WorkspaceAlgoMatcher.hpp"
#include "../../../layout/LayoutManager.hpp"
#include "../../../layout/space/Space.hpp"
#include "../../../desktop/rule/Engine.hpp"
#include "../../shared/monitor/MonitorRuleManager.hpp"
using namespace Config;
using namespace Config::Supplementary;
UP<CPropRefresher>& Supplementary::refresher() {
static UP<CPropRefresher> p = makeUnique<CPropRefresher>();
return p;
}
void CPropRefresher::scheduleRefresh(PropRefreshBits prop) {
static auto PZOOMFACTOR = CConfigValue<Config::FLOAT>("cursor.zoom_factor");
m_propsTripped |= prop;
if (!m_scheduled) {
g_pEventLoopManager->doLater([this, weak = WP<CPropRefresher>{refresher()}] {
if (!weak)
return;
if (m_propsTripped & REFRESH_INPUT_DEVICES) {
g_pInputManager->setKeyboardLayout(); // update kb layout
g_pInputManager->setPointerConfigs(); // update mouse cfgs
g_pInputManager->setTouchDeviceConfigs(); // update touch device cfgs
g_pInputManager->setTabletConfigs(); // update tablets
}
if (m_propsTripped & REFRESH_SCREEN_SHADER)
g_pHyprRenderer->m_reloadScreenShader = true;
if (m_propsTripped & REFRESH_BLUR_FB) {
for (auto const& m : g_pCompositor->m_monitors) {
if (m)
m->m_blurFBDirty = true;
}
}
if (m_propsTripped & REFRESH_WINDOW_STATES) {
Desktop::Rule::ruleEngine()->updateAllRules();
for (const auto& ws : g_pCompositor->getWorkspaces()) {
if (!ws)
continue;
ws->updateWindows();
ws->updateWindowData();
ws->updateWindowDecos();
}
g_pCompositor->updateAllWindowsAnimatedDecorationValues();
}
if (m_propsTripped & REFRESH_MONITOR_STATES) {
Config::monitorRuleMgr()->scheduleReload();
Config::monitorRuleMgr()->ensureVRR();
for (const auto& m : g_pCompositor->m_monitors) {
if (!m)
continue;
g_layoutManager->recalculateMonitor(m);
}
g_pCompositor->ensurePersistentWorkspacesPresent();
}
if (m_propsTripped & REFRESH_LAYOUTS) {
Layout::Supplementary::algoMatcher()->updateWorkspaceLayouts();
for (auto const& m : g_pCompositor->m_monitors) {
g_layoutManager->recalculateMonitor(m);
g_pHyprRenderer->damageMonitor(m);
}
}
if (m_propsTripped & REFRESH_CURSOR_ZOOMS) {
for (auto const& m : g_pCompositor->m_monitors) {
*(m->m_cursorZoom) = *PZOOMFACTOR;
if (m->m_activeWorkspace)
m->m_activeWorkspace->m_space->recalculate();
}
}
m_scheduled = false;
m_propsTripped = 0;
});
m_scheduled = true;
}
}
|