From 7af3b6e62060ad7f6daf7b1997556f2775b374b7 Mon Sep 17 00:00:00 2001 From: Michail Vourlakos Date: Fri, 30 Dec 2016 20:24:21 +0200 Subject: [PATCH] support DodgeActive --add localDockGeometry to be used for the intersect situation --- app/nowdockview.cpp | 21 +++++++++++++++++++ app/nowdockview.h | 5 ++++- app/visibilitymanager.cpp | 10 +++------ app/xwindowinterface.cpp | 3 +-- containment/contents/ui/VisibilityManager.qml | 4 ++++ 5 files changed, 33 insertions(+), 10 deletions(-) diff --git a/app/nowdockview.cpp b/app/nowdockview.cpp index 026ece423..5eb12e9cc 100644 --- a/app/nowdockview.cpp +++ b/app/nowdockview.cpp @@ -72,6 +72,10 @@ NowDockView::NowDockView(Plasma::Corona *corona, QScreen *targetScreen) m_lockGeometry.setSingleShot(true); m_lockGeometry.setInterval(700); + + connect(this, SIGNAL(localDockGeometryChanged()), this, SLOT(updateAbsDockGeometry())); + connect(this, SIGNAL(xChanged(int)), this, SLOT(updateAbsDockGeometry())); + connect(this, SIGNAL(yChanged(int)), this, SLOT(updateAbsDockGeometry())); connect(this, &NowDockView::containmentChanged , this, [&]() { @@ -286,6 +290,23 @@ void NowDockView::resizeWindow() } } +void NowDockView::setLocalDockGeometry(QRect geometry) +{ + if (geometry == m_localDockGeometry) { + return; + } + + m_localDockGeometry = geometry; + + emit localDockGeometryChanged(); +} + +void NowDockView::updateAbsDockGeometry() +{ + QRect absoluteGeometry = {x() + m_localDockGeometry.x(), y() + m_localDockGeometry.y(), m_localDockGeometry.width(), m_localDockGeometry.height()}; + m_visibility->updateDockGeometry(absoluteGeometry); +} + inline void NowDockView::updateDockPosition() { if (!containment()) diff --git a/app/nowdockview.h b/app/nowdockview.h index 7e54c84cb..a5c6010b2 100644 --- a/app/nowdockview.h +++ b/app/nowdockview.h @@ -109,6 +109,7 @@ public slots: Q_INVOKABLE QList freeEdges() const; Q_INVOKABLE void initialize(); Q_INVOKABLE void removeDock(); + Q_INVOKABLE void setLocalDockGeometry(QRect geometry); void resizeWindow(); void restoreConfig(); void saveConfig(); @@ -129,6 +130,7 @@ signals: void compositingChanged(); void heightChanged(); void lengthChanged(); + void localDockGeometryChanged(); void maskAreaChanged(); void maxLengthChanged(); void maxThicknessChanged(); @@ -139,6 +141,7 @@ signals: public Q_SLOTS: void updateDockPositionSlot(); + void updateAbsDockGeometry(); private: bool m_secondInitPass; @@ -148,7 +151,7 @@ private: int m_length{0}; int m_maxLength{INT_MAX}; - QRect m_dockGeometry; + QRect m_localDockGeometry; QRect m_maskArea; QPointer m_configView; diff --git a/app/visibilitymanager.cpp b/app/visibilitymanager.cpp index 4a0f9b992..9a7065037 100644 --- a/app/visibilitymanager.cpp +++ b/app/visibilitymanager.cpp @@ -144,10 +144,8 @@ inline void VisibilityManagerPrivate::raiseDock(bool raise) if (raise) { timerHide.stop(); - if (!timerShow.isActive() && mode != Dock::AutoHide) { + if (!timerShow.isActive()) { timerShow.start(); - } else { - emit q->mustBeShown(); } } else { timerShow.stop(); @@ -179,7 +177,7 @@ void VisibilityManagerPrivate::dodgeActive(WId wid) if (!winfo.isValid() || !winfo.isOnCurrentDesktop() || winfo.isMinimized()) return; - raiseDock(intersects(winfo)); + raiseDock(!intersects(winfo)); } void VisibilityManagerPrivate::dodgeMaximized(WId wid) @@ -270,9 +268,7 @@ bool VisibilityManagerPrivate::event(QEvent *ev) containsMouse = true; emit q->containsMouseChanged(); - if (mode == Dock::AutoHide) - raiseDock(true); - + emit q->mustBeShown(); } else if (ev->type() == QEvent::Leave && containsMouse) { containsMouse = false; emit q->containsMouseChanged(); diff --git a/app/xwindowinterface.cpp b/app/xwindowinterface.cpp index 3ad11b39c..b25b7c7d4 100644 --- a/app/xwindowinterface.cpp +++ b/app/xwindowinterface.cpp @@ -122,7 +122,7 @@ WindowInfoWrap XWindowInterface::requestInfoActive() WindowInfoWrap XWindowInterface::requestInfo(WId wid) { - const KWindowInfo winfo{wid, NET::WMDesktop | NET::WMFrameExtents | NET::WMWindowType | NET::WMState}; + const KWindowInfo winfo{wid, NET::WMDesktop | NET::WMFrameExtents | NET::WMWindowType | NET::WMGeometry | NET::WMState}; WindowInfoWrap winfoWrap; @@ -172,4 +172,3 @@ void XWindowInterface::windowChangedProxy(WId wid, NET::Properties prop1, NET::P } } - diff --git a/containment/contents/ui/VisibilityManager.qml b/containment/contents/ui/VisibilityManager.qml index 5625812ed..7ccb99a67 100644 --- a/containment/contents/ui/VisibilityManager.qml +++ b/containment/contents/ui/VisibilityManager.qml @@ -241,6 +241,10 @@ Item{ } dock.maskArea = newMaskArea; + + if(normalState && !dock.visibility.isHidden){ + dock.setLocalDockGeometry(newMaskArea); + } } }