MCPcopy Create free account
hub / github.com/KDE/kwin / applyPointerConfinement

Method applyPointerConfinement

src/pointer_input.cpp:804–840  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

802}
803
804QPointF PointerInputRedirection::applyPointerConfinement(const QPointF &pos) const
805{
806 if (!focus()) {
807 return pos;
808 }
809 auto s = focus()->surface();
810 if (!s) {
811 return pos;
812 }
813 auto cf = s->confinedPointer();
814 if (!cf) {
815 return pos;
816 }
817 if (!cf->isConfined()) {
818 return pos;
819 }
820
821 const QPointF localPos = focus()->mapToLocal(pos);
822 if (cf->region().contains(localPos)) {
823 return pos;
824 }
825
826 const QPointF currentPos = focus()->mapToLocal(m_pos);
827
828 // allow either x or y to pass
829 QPointF p(currentPos.x(), localPos.y());
830 if (cf->region().contains(p)) {
831 return focus()->mapFromLocal(p);
832 }
833
834 p = QPointF(localPos.x(), currentPos.y());
835 if (cf->region().contains(p)) {
836 return focus()->mapFromLocal(p);
837 }
838
839 return m_pos;
840}
841
842PointerInputRedirection::EdgeBarrierType PointerInputRedirection::edgeBarrierType(const QPointF &pos, const RectF &lastOutputGeometry) const
843{

Callers

nothing calls this directly

Calls 10

QPointFClass · 0.85
confinedPointerMethod · 0.80
mapToLocalMethod · 0.80
mapFromLocalMethod · 0.80
surfaceMethod · 0.45
isConfinedMethod · 0.45
containsMethod · 0.45
regionMethod · 0.45
xMethod · 0.45
yMethod · 0.45

Tested by

no test coverage detected