mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-29 14:45:58 +01:00
output-layout: fix wlroots display handling (#3718)
This commit is contained in:
parent
91cbe93cf8
commit
1bfd4a2bff
5 changed files with 22 additions and 10 deletions
|
@ -22,10 +22,13 @@ void Events::listener_change(wl_listener* listener, void* data) {
|
|||
if (!CONFIG)
|
||||
return;
|
||||
|
||||
for (auto& m : g_pCompositor->m_vMonitors) {
|
||||
for (auto& m : g_pCompositor->m_vRealMonitors) {
|
||||
if (!m->output)
|
||||
continue;
|
||||
|
||||
if (g_pCompositor->m_pUnsafeOutput == m.get())
|
||||
continue;
|
||||
|
||||
const auto CONFIGHEAD = wlr_output_configuration_head_v1_create(CONFIG, m->output);
|
||||
|
||||
CBox BOX;
|
||||
|
@ -195,7 +198,7 @@ void Events::listener_monitorDestroy(void* owner, void* data) {
|
|||
|
||||
Debug::log(LOG, "Destroy called for monitor {}", pMonitor->output->name);
|
||||
|
||||
pMonitor->onDisconnect();
|
||||
pMonitor->onDisconnect(true);
|
||||
|
||||
pMonitor->output = nullptr;
|
||||
pMonitor->m_bRenderingInitPassed = false;
|
||||
|
|
|
@ -188,7 +188,7 @@ void CMonitor::onConnect(bool noRule) {
|
|||
g_pCompositor->scheduleFrameForMonitor(this);
|
||||
}
|
||||
|
||||
void CMonitor::onDisconnect() {
|
||||
void CMonitor::onDisconnect(bool destroy) {
|
||||
|
||||
if (renderTimer) {
|
||||
wl_event_source_remove(renderTimer);
|
||||
|
@ -276,6 +276,7 @@ void CMonitor::onDisconnect() {
|
|||
|
||||
activeWorkspace = -1;
|
||||
|
||||
if (!destroy)
|
||||
wlr_output_layout_remove(g_pCompositor->m_sWLROutputLayout, output);
|
||||
|
||||
wlr_output_enable(output, false);
|
||||
|
@ -298,7 +299,6 @@ void CMonitor::onDisconnect() {
|
|||
|
||||
g_pHyprRenderer->m_pMostHzMonitor = pMonitorMostHz;
|
||||
}
|
||||
|
||||
std::erase_if(g_pCompositor->m_vMonitors, [&](std::shared_ptr<CMonitor>& el) { return el.get() == this; });
|
||||
}
|
||||
|
||||
|
|
|
@ -110,7 +110,7 @@ class CMonitor {
|
|||
|
||||
// methods
|
||||
void onConnect(bool noRule);
|
||||
void onDisconnect();
|
||||
void onDisconnect(bool destroy = false);
|
||||
void addDamage(const pixman_region32_t* rg);
|
||||
void addDamage(const CRegion* rg);
|
||||
void addDamage(const CBox* box);
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
#include "../Compositor.hpp"
|
||||
#include "linux-dmabuf-unstable-v1-protocol.h"
|
||||
#include "../helpers/Region.hpp"
|
||||
#include <algorithm>
|
||||
|
||||
CHyprRenderer::CHyprRenderer() {
|
||||
const auto ENV = getenv("WLR_DRM_NO_ATOMIC");
|
||||
|
@ -1287,13 +1288,22 @@ void CHyprRenderer::outputMgrApplyTest(wlr_output_configuration_v1* config, bool
|
|||
break;
|
||||
}
|
||||
|
||||
if (!test)
|
||||
if (!test) {
|
||||
g_pConfigManager->m_bWantsMonitorReload = true; // for monitor keywords
|
||||
// if everything is disabled, performMonitorReload won't be called from renderMonitor
|
||||
bool allDisabled = std::all_of(g_pCompositor->m_vMonitors.begin(), g_pCompositor->m_vMonitors.end(),
|
||||
[](const auto m) { return !m->m_bEnabled || g_pCompositor->m_pUnsafeOutput == m.get(); });
|
||||
if (allDisabled) {
|
||||
Debug::log(LOG, "OutputMgr apply: All monitors disabled; performing monitor reload.");
|
||||
g_pConfigManager->performMonitorReload();
|
||||
}
|
||||
}
|
||||
|
||||
if (ok)
|
||||
wlr_output_configuration_v1_send_succeeded(config);
|
||||
else
|
||||
wlr_output_configuration_v1_send_failed(config);
|
||||
|
||||
wlr_output_configuration_v1_destroy(config);
|
||||
|
||||
Debug::log(LOG, "OutputMgr Applied/Tested.");
|
||||
|
@ -1645,7 +1655,6 @@ bool CHyprRenderer::applyMonitorRule(CMonitor* pMonitor, SMonitorRule* pMonitorR
|
|||
|
||||
// if it's disabled, disable and ignore
|
||||
if (pMonitorRule->disabled) {
|
||||
|
||||
if (pMonitor->m_bEnabled)
|
||||
pMonitor->onDisconnect();
|
||||
|
||||
|
|
Loading…
Reference in a new issue