diff options
author | vaxerski <[email protected]> | 2022-04-21 18:11:28 +0200 |
---|---|---|
committer | vaxerski <[email protected]> | 2022-04-21 18:11:28 +0200 |
commit | 5fa916e6f2a7dd2a7a900a8311679b646a022acc (patch) | |
tree | 51360758820db144567addbe735bea9c49b1306e | |
parent | 7c36dd6e6cd25d978908a41faeb56cbb7900bee1 (diff) | |
download | Hyprland-5fa916e6f2a7dd2a7a900a8311679b646a022acc.tar.gz Hyprland-5fa916e6f2a7dd2a7a900a8311679b646a022acc.zip |
fix monitor reload crash
-rw-r--r-- | src/events/Monitors.cpp | 7 | ||||
-rw-r--r-- | src/helpers/Monitor.hpp | 2 | ||||
-rw-r--r-- | src/render/Renderer.cpp | 19 |
3 files changed, 27 insertions, 1 deletions
diff --git a/src/events/Monitors.cpp b/src/events/Monitors.cpp index 6de80d5c..840602bd 100644 --- a/src/events/Monitors.cpp +++ b/src/events/Monitors.cpp @@ -139,6 +139,13 @@ void Events::listener_monitorFrame(void* owner, void* data) { g_pConfigManager->performMonitorReload(); } + if (PMONITOR->needsFrameSkip) { + PMONITOR->needsFrameSkip = false; + wlr_output_schedule_frame(PMONITOR->output); + g_pLayoutManager->getCurrentLayout()->recalculateMonitor(PMONITOR->ID); + return; + } + timespec now; clock_gettime(CLOCK_MONOTONIC, &now); diff --git a/src/helpers/Monitor.hpp b/src/helpers/Monitor.hpp index fb318c17..81367850 100644 --- a/src/helpers/Monitor.hpp +++ b/src/helpers/Monitor.hpp @@ -25,6 +25,7 @@ struct SMonitor { wlr_output* output = nullptr; float refreshRate = 60; wlr_output_damage* damage = nullptr; + bool needsFrameSkip = false; // Double-linked list because we need to have constant mem addresses for signals // We have to store pointers and use raw new/delete because they might be moved between them @@ -33,6 +34,7 @@ struct SMonitor { DYNLISTENER(monitorFrame); DYNLISTENER(monitorDestroy); + DYNLISTENER(monitorMode); // hack: a group = workspaces on a monitor. // I don't really care lol :P diff --git a/src/render/Renderer.cpp b/src/render/Renderer.cpp index 3969b7b4..7b8a0e40 100644 --- a/src/render/Renderer.cpp +++ b/src/render/Renderer.cpp @@ -494,6 +494,8 @@ DAMAGETRACKINGMODES CHyprRenderer::damageTrackingModeFromStr(const std::string& void CHyprRenderer::applyMonitorRule(SMonitor* pMonitor, SMonitorRule* pMonitorRule, bool force) { + Debug::log(LOG, "Applying monitor rule for %s", pMonitor->szName.c_str()); + // Check if the rule isn't already applied if (!force && DELTALESSTHAN(pMonitor->vecSize.x, pMonitorRule->resolution.x, 1) && DELTALESSTHAN(pMonitor->vecSize.y, pMonitorRule->resolution.y, 1) && DELTALESSTHAN(pMonitor->refreshRate, pMonitorRule->refreshRate, 1) && pMonitor->scale == pMonitorRule->scale) { Debug::log(LOG, "Not applying a new rule to %s because it's already applied!", pMonitor->szName.c_str()); @@ -563,4 +565,19 @@ void CHyprRenderer::applyMonitorRule(SMonitor* pMonitor, SMonitorRule* pMonitorR Debug::log(ERR, "Couldn't commit output named %s", pMonitor->output->name); return; } -}
\ No newline at end of file + + wlr_output_layout_add(g_pCompositor->m_sWLROutputLayout, pMonitor->output, (int)pMonitorRule->offset.x, (int)pMonitorRule->offset.y); + + //wlr_output_damage_add_whole(pMonitor->damage); + + wlr_output_enable(pMonitor->output, true); + + // updato wlroots + Events::listener_change(nullptr, nullptr); + + // updato us + arrangeLayersForMonitor(pMonitor->ID); + + // frame skip + pMonitor->needsFrameSkip = true; +} |