sinked events:respect Fitts Law

work/spdx
Michail Vourlakos 4 years ago
parent 259d183179
commit 167a19b748

@ -313,6 +313,9 @@ void View::init(Plasma::Containment *plasma_containment)
emit availableScreenRectChangedFrom(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_contextMenu, &ViewPart::ContextMenu::menuChanged, this, &View::contextMenuIsShownChanged);
connect(m_interface, &ViewPart::ContainmentInterface::hasExpandedAppletChanged, this, &View::verticalUnityViewHasFocus); connect(m_interface, &ViewPart::ContainmentInterface::hasExpandedAppletChanged, this, &View::verticalUnityViewHasFocus);
@ -1529,25 +1532,34 @@ bool View::event(QEvent *e)
return ContainmentView::event(adjustedevent); return ContainmentView::event(adjustedevent);
} }
bool View::containmentContainsPosition(const QPointF &point) const void View::updateSinkedEventsGeometry()
{ {
if (!m_padding) { QRectF sinked = m_localGeometry;
return false;
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(); m_sinkedEventsGeometry = sinked;
return local.contains(point);
} }
QPointF View::positionAdjustedForContainment(const QPointF &point) const bool View::containmentContainsPosition(const QPointF &point) const
{ {
if (!m_padding) { return m_sinkedEventsGeometry.contains(point);
return point; }
}
QRectF local = m_localGeometry - m_padding->margins(); QPointF View::positionAdjustedForContainment(const QPointF &point) const
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 addTransientWindow(QWindow *window);
void removeTransientWindow(const bool &visible); void removeTransientWindow(const bool &visible);
void updateSinkedEventsGeometry();
//! workaround in order for top panels to be always on top //! workaround in order for top panels to be always on top
void topViewAlwaysOnTop(); void topViewAlwaysOnTop();
void verticalUnityViewHasFocus(); void verticalUnityViewHasFocus();
@ -407,6 +409,7 @@ private:
QRect m_localGeometry; QRect m_localGeometry;
QRect m_absoluteGeometry; QRect m_absoluteGeometry;
QRectF m_sinkedEventsGeometry;
QStringList m_activities; QStringList m_activities;

@ -797,7 +797,7 @@ Item{
localGeometry.width = latteView.effects.rect.width; // from effects area localGeometry.width = latteView.effects.rect.width; // from effects area
localGeometry.y = edgeMargin; localGeometry.y = edgeMargin;
localGeometry.height = cleanThickness ; localGeometry.height = cleanThickness;
} else if (plasmoid.location === PlasmaCore.Types.BottomEdge) { } else if (plasmoid.location === PlasmaCore.Types.BottomEdge) {
localGeometry.x = latteView.effects.rect.x; // from effects area localGeometry.x = latteView.effects.rect.x; // from effects area
localGeometry.width = latteView.effects.rect.width; // from effects area localGeometry.width = latteView.effects.rect.width; // from effects area

Loading…
Cancel
Save