diff --git a/panels/dock/dockpanel.cpp b/panels/dock/dockpanel.cpp index e16c2a418..c11da8463 100644 --- a/panels/dock/dockpanel.cpp +++ b/panels/dock/dockpanel.cpp @@ -181,6 +181,11 @@ QRect DockPanel::geometry() } QRect DockPanel::frontendWindowRect() +{ + return frontendWindowRect(0, 0); +} + +QRect DockPanel::frontendWindowRect(int transformOffsetX, int transformOffsetY) { if(!window()) return QRect(); @@ -192,17 +197,19 @@ QRect DockPanel::frontendWindowRect() switch (position()) { case Top: xOffset = (screenGeometry.width() - geometry.width()) / 2; + yOffset = transformOffsetY; break; case Bottom: xOffset = (screenGeometry.width() - geometry.width()) / 2; - yOffset = screenGeometry.height() - geometry.height(); + yOffset = screenGeometry.height() - geometry.height() + transformOffsetY; break; case Right: - xOffset = screenGeometry.width() - geometry.width(); + xOffset = screenGeometry.width() - geometry.width() + transformOffsetX; yOffset = (screenGeometry.height() - geometry.height()) / 2; break; case Left: - yOffset = screenGeometry.height() - geometry.height(); + xOffset = transformOffsetX; + yOffset = (screenGeometry.height() - geometry.height()) / 2; break; } @@ -337,6 +344,11 @@ void DockPanel::openDockSettings() const .call(); } +void DockPanel::notifyDockPositionChanged(int offsetX, int offsetY) +{ + Q_EMIT frontendWindowRectChanged(frontendWindowRect(offsetX, offsetY)); +} + void DockPanel::launcherVisibleChanged(bool visible) { if (visible == m_launcherShown) return; diff --git a/panels/dock/package/main.qml b/panels/dock/package/main.qml index 958d66cfc..2cf46c292 100644 --- a/panels/dock/package/main.qml +++ b/panels/dock/package/main.qml @@ -114,6 +114,40 @@ Window { } } + Connections { + target: dockTransform + enabled: Qt.platform.pluginName === "xcb" && hideShowAnimation.running + + function onXChanged() { + if (dock.useColumnLayout) { + Panel.notifyDockPositionChanged(dockTransform.x, 0) + } + } + + function onYChanged() { + if (!dock.useColumnLayout) { + Panel.notifyDockPositionChanged(0, dockTransform.y) + } + } + } + + Connections { + target: dock + enabled: Qt.platform.pluginName !== "xcb" && hideShowAnimation.running + + function onWidthChanged() { + if (dock.useColumnLayout) { + Panel.notifyDockPositionChanged() + } + } + + function onHeightChanged() { + if (!dock.useColumnLayout) { + Panel.notifyDockPositionChanged() + } + } + } + Timer { id: hideTimer interval: 500