From 219958898e3da50c81e4e0b9ac20067dcbfb0e81 Mon Sep 17 00:00:00 2001 From: Nick Bolton Date: Thu, 17 Oct 2024 00:19:02 +0100 Subject: [PATCH] chore: Replace assert with warning for screen boundary issue --- src/lib/server/Server.cpp | 33 +++++++++++++++++++++++++++------ 1 file changed, 27 insertions(+), 6 deletions(-) diff --git a/src/lib/server/Server.cpp b/src/lib/server/Server.cpp index f6d68ba25..6300028c4 100644 --- a/src/lib/server/Server.cpp +++ b/src/lib/server/Server.cpp @@ -428,13 +428,34 @@ void Server::switchScreen( BaseClientProxy *dst, SInt32 x, SInt32 y, bool forScreensaver) { assert(dst != NULL); -#ifndef NDEBUG - { - SInt32 dx, dy, dw, dh; - dst->getShape(dx, dy, dw, dh); - assert(x >= dx && y >= dy && x < dx + dw && y < dy + dh); + SInt32 dx, dy, dw, dh; + dst->getShape(dx, dy, dw, dh); + + // any of these conditions seem to trigger when the portal permission dialog + // is visible on wayland. this was previously an assert, but that's pretty + // annoying since it makes the mouse unusable on the server and you'll have to + // ssh into your machine to kill it. better to just log a warning. + if (x < dx) { + LOG_WARN( + "on switch, x (%d) is less than the left boundary dx (%d)", // + x, dx); } -#endif + if (y < dy) { + LOG_WARN( + "on switch, y (%d) is less than the top boundary dy (%d)", // + y, dy); + } + if (x >= dx + dw) { + LOG_WARN( + "on switch, x (%d) exceeds the right boundary (dx + width = %d)", // + x, dx + dw); + } + if (y >= dy + dh) { + LOG_WARN( + "on switch, y (%d) exceeds the bottom boundary (dy + height = %d)", // + y, dy + dh); + } + assert(m_active != NULL); LOG(