diff --git a/src/x11/panel_window.cpp b/src/x11/panel_window.cpp index d0781937..b5afab44 100644 --- a/src/x11/panel_window.cpp +++ b/src/x11/panel_window.cpp @@ -239,11 +239,28 @@ void XPanelWindow::connectScreen() { this, &XPanelWindow::updateDimensionsSlot ); + + QObject::connect( + this->mTrackedScreen, + &QScreen::virtualGeometryChanged, + this, + &XPanelWindow::onScreenVirtualGeometryChanged + + ); } this->updateDimensions(); } +// For some reason this gets sent multiple times with the same value. +void XPanelWindow::onScreenVirtualGeometryChanged() { + auto geometry = this->mTrackedScreen->virtualGeometry(); + if (geometry != this->lastScreenVirtualGeometry) { + this->lastScreenVirtualGeometry = geometry; + this->updateStrut(false); + } +} + void XPanelWindow::updateDimensionsSlot() { this->updateDimensions(); } void XPanelWindow::updateDimensions(bool propagate) { @@ -384,16 +401,22 @@ void XPanelWindow::updateStrut(bool propagate) { return; } - // Due to missing headers it isn't even possible to do this right. - // We assume a single xinerama monitor with a matching size root. + auto rootGeometry = this->window->screen()->virtualGeometry(); 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; + } + auto data = std::array(); data[side] = exclusiveZone; - auto start = horizontal ? screenGeometry.top() + this->window->y() - : screenGeometry.left() + this->window->x(); + auto start = horizontal ? this->window->y() : this->window->x(); data[4 + side * 2] = start; data[5 + side * 2] = start + (horizontal ? this->window->height() : this->window->width()); diff --git a/src/x11/panel_window.hpp b/src/x11/panel_window.hpp index 40d9a9bf..9bcaf64d 100644 --- a/src/x11/panel_window.hpp +++ b/src/x11/panel_window.hpp @@ -81,6 +81,7 @@ private slots: void xInit(); void updatePanelStack(); void updateDimensionsSlot(); + void onScreenVirtualGeometryChanged(); private: void connectScreen(); @@ -97,6 +98,8 @@ private: Margins mMargins; qint32 mExclusiveZone = 0; ExclusionMode::Enum mExclusionMode = ExclusionMode::Auto; + + QRect lastScreenVirtualGeometry; XPanelEventFilter eventFilter; friend class XPanelStack;