From 397476244c4d4e7b50b7a9f391e325f6f4158e2d Mon Sep 17 00:00:00 2001 From: outfoxxed Date: Sun, 1 Sep 2024 19:00:13 -0700 Subject: [PATCH] x11/panelwindow: add option to disable Xinerama aware struts Breaks bad WMs less. --- src/x11/panel_window.cpp | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/src/x11/panel_window.cpp b/src/x11/panel_window.cpp index b5afab44..3f0aa279 100644 --- a/src/x11/panel_window.cpp +++ b/src/x11/panel_window.cpp @@ -10,6 +10,7 @@ #include #include #include +#include #include #include #include @@ -386,6 +387,11 @@ void XPanelWindow::getExclusion(int& side, quint32& exclusiveZone) { } } +// Disable xinerama structs to break multi monitor configurations with bad WMs less. +// Usually this results in one monitor at the top left corner of the root window working +// perfectly and all others being broken semi randomly. +static bool XINERAMA_STRUTS = qEnvironmentVariableIsEmpty("QS_NO_XINERAMA_STRUTS"); // NOLINT + void XPanelWindow::updateStrut(bool propagate) { if (this->window == nullptr || this->window->handle() == nullptr) return; auto* conn = x11Connection(); @@ -405,12 +411,14 @@ void XPanelWindow::updateStrut(bool propagate) { auto screenGeometry = this->window->screen()->geometry(); auto horizontal = side == 0 || side == 1; - switch (side) { - case 0: exclusiveZone += screenGeometry.left(); break; - case 1: exclusiveZone += rootGeometry.right() - screenGeometry.right(); break; - case 2: exclusiveZone += screenGeometry.top(); break; - case 3: exclusiveZone += rootGeometry.bottom() - screenGeometry.bottom(); break; - default: break; + if (XINERAMA_STRUTS) { + switch (side) { + case 0: exclusiveZone += screenGeometry.left(); break; + case 1: exclusiveZone += rootGeometry.right() - screenGeometry.right(); break; + case 2: exclusiveZone += screenGeometry.top(); break; + case 3: exclusiveZone += rootGeometry.bottom() - screenGeometry.bottom(); break; + default: break; + } } auto data = std::array();