mirror of
https://github.com/KDE/latte-dock.git
synced 2024-12-24 17:33:50 +03:00
support DodgeActive
--add localDockGeometry to be used for the intersect situation
This commit is contained in:
parent
dfbfbd13c9
commit
7af3b6e620
@ -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())
|
||||
|
@ -109,6 +109,7 @@ public slots:
|
||||
Q_INVOKABLE QList<int> 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<PlasmaQuick::ConfigView> m_configView;
|
||||
|
||||
|
@ -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();
|
||||
|
@ -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
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -241,6 +241,10 @@ Item{
|
||||
}
|
||||
|
||||
dock.maskArea = newMaskArea;
|
||||
|
||||
if(normalState && !dock.visibility.isHidden){
|
||||
dock.setLocalDockGeometry(newMaskArea);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user