mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-22 22:45:58 +01:00
monitors: fix outputmgr nullptr crash (#4738)
This commit is contained in:
parent
683a4b07c5
commit
7e8bcd675d
3 changed files with 13 additions and 2 deletions
|
@ -881,6 +881,16 @@ CMonitor* CCompositor::getMonitorFromOutput(wlr_output* out) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CMonitor* CCompositor::getRealMonitorFromOutput(wlr_output* out) {
|
||||||
|
for (auto& m : m_vRealMonitors) {
|
||||||
|
if (m->output == out) {
|
||||||
|
return m.get();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
void CCompositor::focusWindow(CWindow* pWindow, wlr_surface* pSurface) {
|
void CCompositor::focusWindow(CWindow* pWindow, wlr_surface* pSurface) {
|
||||||
|
|
||||||
static auto* const PFOLLOWMOUSE = &g_pConfigManager->getConfigValuePtr("input:follow_mouse")->intValue;
|
static auto* const PFOLLOWMOUSE = &g_pConfigManager->getConfigValuePtr("input:follow_mouse")->intValue;
|
||||||
|
|
|
@ -142,6 +142,7 @@ class CCompositor {
|
||||||
wlr_surface* vectorWindowToSurface(const Vector2D&, CWindow*, Vector2D& sl);
|
wlr_surface* vectorWindowToSurface(const Vector2D&, CWindow*, Vector2D& sl);
|
||||||
Vector2D vectorToSurfaceLocal(const Vector2D&, CWindow*, wlr_surface*);
|
Vector2D vectorToSurfaceLocal(const Vector2D&, CWindow*, wlr_surface*);
|
||||||
CMonitor* getMonitorFromOutput(wlr_output*);
|
CMonitor* getMonitorFromOutput(wlr_output*);
|
||||||
|
CMonitor* getRealMonitorFromOutput(wlr_output*);
|
||||||
CWindow* getWindowForPopup(wlr_xdg_popup*);
|
CWindow* getWindowForPopup(wlr_xdg_popup*);
|
||||||
CWindow* getWindowFromSurface(wlr_surface*);
|
CWindow* getWindowFromSurface(wlr_surface*);
|
||||||
CWindow* getWindowFromHandle(uint32_t);
|
CWindow* getWindowFromHandle(uint32_t);
|
||||||
|
|
|
@ -1340,8 +1340,6 @@ void CHyprRenderer::outputMgrApplyTest(wlr_output_configuration_v1* config, bool
|
||||||
|
|
||||||
std::string commandForCfg = "";
|
std::string commandForCfg = "";
|
||||||
const auto OUTPUT = head->state.output;
|
const auto OUTPUT = head->state.output;
|
||||||
const auto PMONITOR = g_pCompositor->getMonitorFromOutput(OUTPUT);
|
|
||||||
RASSERT(PMONITOR, "nullptr monitor in outputMgrApplyTest");
|
|
||||||
|
|
||||||
commandForCfg += std::string(OUTPUT->name) + ",";
|
commandForCfg += std::string(OUTPUT->name) + ",";
|
||||||
|
|
||||||
|
@ -1352,6 +1350,8 @@ void CHyprRenderer::outputMgrApplyTest(wlr_output_configuration_v1* config, bool
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const auto PMONITOR = g_pCompositor->getRealMonitorFromOutput(OUTPUT);
|
||||||
|
RASSERT(PMONITOR, "nullptr monitor in outputMgrApplyTest");
|
||||||
wlr_output_state_set_enabled(PMONITOR->state.wlr(), head->state.enabled);
|
wlr_output_state_set_enabled(PMONITOR->state.wlr(), head->state.enabled);
|
||||||
|
|
||||||
if (head->state.mode)
|
if (head->state.mode)
|
||||||
|
|
Loading…
Reference in a new issue