mirror of
https://github.com/hyprwm/Hyprland
synced 2024-12-23 00:09:49 +01:00
fix monitor reload crash
This commit is contained in:
parent
7c36dd6e6c
commit
5fa916e6f2
3 changed files with 27 additions and 1 deletions
|
@ -139,6 +139,13 @@ void Events::listener_monitorFrame(void* owner, void* data) {
|
||||||
g_pConfigManager->performMonitorReload();
|
g_pConfigManager->performMonitorReload();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (PMONITOR->needsFrameSkip) {
|
||||||
|
PMONITOR->needsFrameSkip = false;
|
||||||
|
wlr_output_schedule_frame(PMONITOR->output);
|
||||||
|
g_pLayoutManager->getCurrentLayout()->recalculateMonitor(PMONITOR->ID);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
timespec now;
|
timespec now;
|
||||||
clock_gettime(CLOCK_MONOTONIC, &now);
|
clock_gettime(CLOCK_MONOTONIC, &now);
|
||||||
|
|
||||||
|
|
|
@ -25,6 +25,7 @@ struct SMonitor {
|
||||||
wlr_output* output = nullptr;
|
wlr_output* output = nullptr;
|
||||||
float refreshRate = 60;
|
float refreshRate = 60;
|
||||||
wlr_output_damage* damage = nullptr;
|
wlr_output_damage* damage = nullptr;
|
||||||
|
bool needsFrameSkip = false;
|
||||||
|
|
||||||
// Double-linked list because we need to have constant mem addresses for signals
|
// 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
|
// 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(monitorFrame);
|
||||||
DYNLISTENER(monitorDestroy);
|
DYNLISTENER(monitorDestroy);
|
||||||
|
DYNLISTENER(monitorMode);
|
||||||
|
|
||||||
// hack: a group = workspaces on a monitor.
|
// hack: a group = workspaces on a monitor.
|
||||||
// I don't really care lol :P
|
// I don't really care lol :P
|
||||||
|
|
|
@ -494,6 +494,8 @@ DAMAGETRACKINGMODES CHyprRenderer::damageTrackingModeFromStr(const std::string&
|
||||||
|
|
||||||
void CHyprRenderer::applyMonitorRule(SMonitor* pMonitor, SMonitorRule* pMonitorRule, bool force) {
|
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
|
// 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) {
|
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());
|
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);
|
Debug::log(ERR, "Couldn't commit output named %s", pMonitor->output->name);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue