sinked events:respect Fitts Law

work/spdx
Michail Vourlakos
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();
}
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);
}
QRectF local= m_localGeometry - m_padding->margins();
return local.contains(point);
m_sinkedEventsGeometry = sinked;
}
QPointF View::positionAdjustedForContainment(const QPointF &point) const
bool View::containmentContainsPosition(const QPointF &point) const
{
if (!m_padding) {
return point;
}
return m_sinkedEventsGeometry.contains(point);
}
QRectF local = m_localGeometry - m_padding->margins();
return QPointF(qBound(local.left(), point.x(), local.right()),
qBound(local.top(), point.y(), local.bottom()));
QPointF View::positionAdjustedForContainment(const QPointF &point) const
{
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…
Cancel
Save