summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorShemig <hemigilad@gmail.com>2023-06-15 23:07:58 +0300
committerGitHub <noreply@github.com>2023-06-15 22:07:58 +0200
commit302ec1372c40cd4130101920c2f6c38cad6fc9dc (patch)
tree938ec8a213632576780ce2dd006f8257f982da92 /src
parentd768226de9281828c6346d7acff3ddc10b3e657f (diff)
Fix crash when screen size is 0x0 (#2523)
(When booting into laptop clam mode in dell XPS) and also ignore any screen with size 0x0 in the first place Co-authored-by: giladsx <gilad@spectalix.com>
Diffstat (limited to 'src')
-rw-r--r--src/events/Monitors.cpp5
-rw-r--r--src/render/OpenGL.cpp6
2 files changed, 8 insertions, 3 deletions
diff --git a/src/events/Monitors.cpp b/src/events/Monitors.cpp
index 23b41667..2360be56 100644
--- a/src/events/Monitors.cpp
+++ b/src/events/Monitors.cpp
@@ -57,6 +57,11 @@ void Events::listener_newOutput(wl_listener* listener, void* data) {
return;
}
+ if (OUTPUT->width <= 0 || OUTPUT->height <= 0) {
+ Debug::log(ERR, "New monitor has no dimensions?? Ignoring");
+ return;
+ }
+
if (g_pCompositor->m_bUnsafeState) {
Debug::log(WARN, "Recovering from an unsafe state. May you be lucky.");
}
diff --git a/src/render/OpenGL.cpp b/src/render/OpenGL.cpp
index 839ea59d..9e12610f 100644
--- a/src/render/OpenGL.cpp
+++ b/src/render/OpenGL.cpp
@@ -1165,7 +1165,7 @@ void CHyprOpenGLImpl::makeRawWindowSnapshot(CWindow* pWindow, CFramebuffer* pFra
// we trust the window is valid.
const auto PMONITOR = g_pCompositor->getMonitorFromID(pWindow->m_iMonitorID);
- if (!PMONITOR || !PMONITOR->output)
+ if (!PMONITOR || !PMONITOR->output || PMONITOR->vecPixelSize.x <= 0 || PMONITOR->vecPixelSize.y <= 0)
return;
wlr_output_attach_render(PMONITOR->output, nullptr);
@@ -1224,7 +1224,7 @@ void CHyprOpenGLImpl::makeWindowSnapshot(CWindow* pWindow) {
// we trust the window is valid.
const auto PMONITOR = g_pCompositor->getMonitorFromID(pWindow->m_iMonitorID);
- if (!PMONITOR || !PMONITOR->output)
+ if (!PMONITOR || !PMONITOR->output || PMONITOR->vecPixelSize.x <= 0 || PMONITOR->vecPixelSize.y <= 0)
return;
wlr_output_attach_render(PMONITOR->output, nullptr);
@@ -1288,7 +1288,7 @@ void CHyprOpenGLImpl::makeLayerSnapshot(SLayerSurface* pLayer) {
// we trust the window is valid.
const auto PMONITOR = g_pCompositor->getMonitorFromID(pLayer->monitorID);
- if (!PMONITOR || !PMONITOR->output)
+ if (!PMONITOR || !PMONITOR->output || PMONITOR->vecPixelSize.x <= 0 || PMONITOR->vecPixelSize.y <= 0)
return;
wlr_output_attach_render(PMONITOR->output, nullptr);