1010#include < qqmllist.h>
1111#include < qquickwindow.h>
1212#include < qscreen.h>
13+ #include < qtenvironmentvariables.h>
1314#include < qtimer.h>
1415#include < qtmetamacros.h>
1516#include < qtypes.h>
@@ -386,6 +387,11 @@ void XPanelWindow::getExclusion(int& side, quint32& exclusiveZone) {
386387 }
387388}
388389
390+ // Disable xinerama structs to break multi monitor configurations with bad WMs less.
391+ // Usually this results in one monitor at the top left corner of the root window working
392+ // perfectly and all others being broken semi randomly.
393+ static bool XINERAMA_STRUTS = qEnvironmentVariableIsEmpty(" QS_NO_XINERAMA_STRUTS" ); // NOLINT
394+
389395void XPanelWindow::updateStrut (bool propagate) {
390396 if (this ->window == nullptr || this ->window ->handle () == nullptr ) return ;
391397 auto * conn = x11Connection ();
@@ -405,12 +411,14 @@ void XPanelWindow::updateStrut(bool propagate) {
405411 auto screenGeometry = this ->window ->screen ()->geometry ();
406412 auto horizontal = side == 0 || side == 1 ;
407413
408- switch (side) {
409- case 0 : exclusiveZone += screenGeometry.left (); break ;
410- case 1 : exclusiveZone += rootGeometry.right () - screenGeometry.right (); break ;
411- case 2 : exclusiveZone += screenGeometry.top (); break ;
412- case 3 : exclusiveZone += rootGeometry.bottom () - screenGeometry.bottom (); break ;
413- default : break ;
414+ if (XINERAMA_STRUTS) {
415+ switch (side) {
416+ case 0 : exclusiveZone += screenGeometry.left (); break ;
417+ case 1 : exclusiveZone += rootGeometry.right () - screenGeometry.right (); break ;
418+ case 2 : exclusiveZone += screenGeometry.top (); break ;
419+ case 3 : exclusiveZone += rootGeometry.bottom () - screenGeometry.bottom (); break ;
420+ default : break ;
421+ }
414422 }
415423
416424 auto data = std::array<quint32, 12 >();
0 commit comments