mirror of
https://github.com/KDE/latte-dock.git
synced 2025-03-09 00:58:15 +03:00
sinked events:respect Fitts Law
This commit is contained in:
parent
259d183179
commit
167a19b748
@ -306,13 +306,16 @@ void View::init(Plasma::Containment *plasma_containment)
|
||||
|
||||
connect(m_effects, &ViewPart::Effects::innerShadowChanged, this, [&]() {
|
||||
emit availableScreenRectChangedFrom(this);
|
||||
});
|
||||
});
|
||||
connect(m_positioner, &ViewPart::Positioner::onHideWindowsForSlidingOut, this, &View::hideWindowsForSlidingOut);
|
||||
connect(m_positioner, &ViewPart::Positioner::screenGeometryChanged, this, &View::screenGeometryChanged);
|
||||
connect(m_positioner, &ViewPart::Positioner::windowSizeChanged, this, [&]() {
|
||||
emit availableScreenRectChangedFrom(this);
|
||||
});
|
||||
|
||||
connect(this, &View::localGeometryChanged, this, &View::updateSinkedEventsGeometry);
|
||||
connect(m_padding, &ViewPart::Padding::paddingsChanged, this, &View::updateSinkedEventsGeometry);
|
||||
|
||||
connect(m_contextMenu, &ViewPart::ContextMenu::menuChanged, this, &View::contextMenuIsShownChanged);
|
||||
|
||||
connect(m_interface, &ViewPart::ContainmentInterface::hasExpandedAppletChanged, this, &View::verticalUnityViewHasFocus);
|
||||
@ -1529,25 +1532,34 @@ bool View::event(QEvent *e)
|
||||
return ContainmentView::event(adjustedevent);
|
||||
}
|
||||
|
||||
bool View::containmentContainsPosition(const QPointF &point) const
|
||||
void View::updateSinkedEventsGeometry()
|
||||
{
|
||||
if (!m_padding) {
|
||||
return false;
|
||||
QRectF sinked = m_localGeometry;
|
||||
|
||||
if (m_padding && !m_padding->isEmpty()) {
|
||||
sinked -= m_padding->margins();
|
||||
}
|
||||
|
||||
QRectF local= m_localGeometry - m_padding->margins();
|
||||
return local.contains(point);
|
||||
if (location() == Plasma::Types::TopEdge || location() == Plasma::Types::BottomEdge) {
|
||||
/*remove the bottom pixel that is needed from dodge and touching edge algorithms*/
|
||||
sinked -= QMargins(0,0,0,1);
|
||||
} else if (location() == Plasma::Types::RightEdge || location() == Plasma::Types::LeftEdge) {
|
||||
/*remove the right pixel that is needed from dodge and touching edge algorithms*/
|
||||
sinked -= QMargins(0,0,1,0);
|
||||
}
|
||||
|
||||
m_sinkedEventsGeometry = sinked;
|
||||
}
|
||||
|
||||
bool View::containmentContainsPosition(const QPointF &point) const
|
||||
{
|
||||
return m_sinkedEventsGeometry.contains(point);
|
||||
}
|
||||
|
||||
QPointF View::positionAdjustedForContainment(const QPointF &point) const
|
||||
{
|
||||
if (!m_padding) {
|
||||
return point;
|
||||
}
|
||||
|
||||
QRectF local = m_localGeometry - m_padding->margins();
|
||||
return QPointF(qBound(local.left(), point.x(), local.right()),
|
||||
qBound(local.top(), point.y(), local.bottom()));
|
||||
return QPointF(qBound(m_sinkedEventsGeometry.left(), point.x(), m_sinkedEventsGeometry.right()),
|
||||
qBound(m_sinkedEventsGeometry.top(), point.y(), m_sinkedEventsGeometry.bottom()));
|
||||
}
|
||||
|
||||
|
||||
|
@ -357,6 +357,8 @@ private slots:
|
||||
void addTransientWindow(QWindow *window);
|
||||
void removeTransientWindow(const bool &visible);
|
||||
|
||||
void updateSinkedEventsGeometry();
|
||||
|
||||
//! workaround in order for top panels to be always on top
|
||||
void topViewAlwaysOnTop();
|
||||
void verticalUnityViewHasFocus();
|
||||
@ -407,6 +409,7 @@ private:
|
||||
|
||||
QRect m_localGeometry;
|
||||
QRect m_absoluteGeometry;
|
||||
QRectF m_sinkedEventsGeometry;
|
||||
|
||||
QStringList m_activities;
|
||||
|
||||
|
@ -797,7 +797,7 @@ Item{
|
||||
localGeometry.width = latteView.effects.rect.width; // from effects area
|
||||
|
||||
localGeometry.y = edgeMargin;
|
||||
localGeometry.height = cleanThickness ;
|
||||
localGeometry.height = cleanThickness;
|
||||
} else if (plasmoid.location === PlasmaCore.Types.BottomEdge) {
|
||||
localGeometry.x = latteView.effects.rect.x; // from effects area
|
||||
localGeometry.width = latteView.effects.rect.width; // from effects area
|
||||
|
Loading…
x
Reference in New Issue
Block a user