mirror of
https://github.com/hyprwm/Hyprland
synced 2024-12-22 13:49:49 +01:00
fix dynamic monitor disables corrupting pmosthz
This commit is contained in:
parent
8c094b0eec
commit
6749c8abd7
4 changed files with 20 additions and 21 deletions
|
@ -15,9 +15,7 @@
|
|||
// //
|
||||
// --------------------------------------------------------- //
|
||||
|
||||
CMonitor* pMostHzMonitor = nullptr;
|
||||
|
||||
void Events::listener_change(wl_listener* listener, void* data) {
|
||||
void Events::listener_change(wl_listener* listener, void* data) {
|
||||
// layout got changed, let's update monitors.
|
||||
const auto CONFIG = wlr_output_configuration_v1_create();
|
||||
|
||||
|
@ -80,8 +78,8 @@ void Events::listener_newOutput(wl_listener* listener, void* data) {
|
|||
|
||||
PNEWMONITOR->onConnect(false);
|
||||
|
||||
if ((!pMostHzMonitor || PNEWMONITOR->refreshRate > pMostHzMonitor->refreshRate) && PNEWMONITOR->m_bEnabled)
|
||||
pMostHzMonitor = PNEWMONITOR;
|
||||
if ((!g_pHyprRenderer->m_pMostHzMonitor || PNEWMONITOR->refreshRate > g_pHyprRenderer->m_pMostHzMonitor->refreshRate) && PNEWMONITOR->m_bEnabled)
|
||||
g_pHyprRenderer->m_pMostHzMonitor = PNEWMONITOR;
|
||||
|
||||
// ready to process cuz we have a monitor
|
||||
if (PNEWMONITOR->m_bEnabled) {
|
||||
|
@ -140,7 +138,7 @@ void Events::listener_monitorFrame(void* owner, void* data) {
|
|||
}
|
||||
|
||||
// checks //
|
||||
if (PMONITOR->ID == pMostHzMonitor->ID ||
|
||||
if (PMONITOR->ID == g_pHyprRenderer->m_pMostHzMonitor->ID ||
|
||||
!*PNOVFR) { // unfortunately with VFR we don't have the guarantee mostHz is going to be updated all the time, so we have to ignore that
|
||||
g_pCompositor->sanityCheckWorkspaces();
|
||||
g_pAnimationManager->tick();
|
||||
|
@ -340,20 +338,6 @@ void Events::listener_monitorDestroy(void* owner, void* data) {
|
|||
Debug::log(LOG, "Removing monitor %s from realMonitors", pMonitor->output->name);
|
||||
|
||||
std::erase_if(g_pCompositor->m_vRealMonitors, [&](std::shared_ptr<CMonitor>& el) { return el.get() == pMonitor; });
|
||||
|
||||
if (pMostHzMonitor == pMonitor) {
|
||||
int mostHz = 0;
|
||||
CMonitor* pMonitorMostHz = nullptr;
|
||||
|
||||
for (auto& m : g_pCompositor->m_vMonitors) {
|
||||
if (m->refreshRate > mostHz) {
|
||||
pMonitorMostHz = m.get();
|
||||
mostHz = m->refreshRate;
|
||||
}
|
||||
}
|
||||
|
||||
pMostHzMonitor = pMonitorMostHz;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -239,6 +239,20 @@ void CMonitor::onDisconnect() {
|
|||
if (g_pCompositor->m_pLastMonitor == this)
|
||||
g_pCompositor->setActiveMonitor(BACKUPMON);
|
||||
|
||||
if (g_pHyprRenderer->m_pMostHzMonitor == this) {
|
||||
int mostHz = 0;
|
||||
CMonitor* pMonitorMostHz = nullptr;
|
||||
|
||||
for (auto& m : g_pCompositor->m_vMonitors) {
|
||||
if (m->refreshRate > mostHz && m.get() != this) {
|
||||
pMonitorMostHz = m.get();
|
||||
mostHz = m->refreshRate;
|
||||
}
|
||||
}
|
||||
|
||||
g_pHyprRenderer->m_pMostHzMonitor = pMonitorMostHz;
|
||||
}
|
||||
|
||||
std::erase_if(g_pCompositor->m_vMonitors, [&](std::shared_ptr<CMonitor>& el) { return el.get() == this; });
|
||||
}
|
||||
|
||||
|
|
|
@ -49,6 +49,7 @@ class CHyprRenderer {
|
|||
bool m_bWindowRequestedCursorHide = false;
|
||||
bool m_bBlockSurfaceFeedback = false;
|
||||
CWindow* m_pLastScanout = nullptr;
|
||||
CMonitor* m_pMostHzMonitor = nullptr;
|
||||
|
||||
DAMAGETRACKINGMODES damageTrackingModeFromStr(const std::string&);
|
||||
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit dc7cc98cf21a8dc19ab8895505500e3700646af0
|
||||
Subproject commit 3ea1a3aee0ee1ee25935043aa4b4ecd4bc977556
|
Loading…
Reference in a new issue