Phosphor
Qt6 / Wayland library suite for window-management tools
 
Loading...
Searching...
No Matches
PhosphorZones::ZoneDetector Class Reference

Efficient zone detection for window snapping. More...

#include <phosphor-zones/include/PhosphorZones/ZoneDetector.h>

Inheritance diagram for PhosphorZones::ZoneDetector:
[legend]

Public Member Functions

 ZoneDetector (QObject *parent=nullptr)
 
 ~ZoneDetector () override
 
Layoutlayout () const override
 
void setLayout (Layout *layout) override
 
void setAdjacentThreshold (int px)
 Set the adjacency threshold used by detectMultiZone / areZonesAdjacent.
 
int adjacentThreshold () const
 
ZoneDetectionResult detectZone (const QPointF &cursorPos) const override
 
ZoneDetectionResult detectMultiZone (const QPointF &cursorPos) const override
 
QVector< Zone * > expandPaintedZonesToRect (const QVector< Zone * > &seedZones) const override
 Expand painted zones to include all zones that intersect the bounding rect.
 
ZonezoneAtPoint (const QPointF &point) const override
 
ZonenearestZone (const QPointF &point) const override
 
void highlightZone (Zone *zone) override
 
void highlightZones (const QVector< Zone * > &zones) override
 
void clearHighlights () override
 
- Public Member Functions inherited from PhosphorZones::IZoneDetector
 IZoneDetector (QObject *parent=nullptr)
 
 ~IZoneDetector () override
 
- Public Member Functions inherited from PhosphorZones::IZoneDetection
 IZoneDetection ()=default
 
virtual ~IZoneDetection ()
 

Additional Inherited Members

- Signals inherited from PhosphorZones::IZoneDetector
void layoutChanged ()
 
void zoneHighlighted (Zone *zone)
 
void highlightsCleared ()
 
- Protected Member Functions inherited from PhosphorZones::IZoneDetection
 IZoneDetection (const IZoneDetection &)=default
 
IZoneDetectionoperator= (const IZoneDetection &)=default
 

Detailed Description

Efficient zone detection for window snapping.

The ZoneDetector provides optimized algorithms for determining which zone(s) a window should snap to based on cursor position. It supports:

  • Single zone snapping (standard)
  • Multi-zone snapping (adjacent zones)
  • Edge detection for zone border snapping
  • Configurable detection thresholds

Note: This class does NOT use the singleton pattern. Create instances where needed and pass via dependency injection.

Constructor & Destructor Documentation

◆ ZoneDetector()

PhosphorZones::ZoneDetector::ZoneDetector ( QObject *  parent = nullptr)
explicit

◆ ~ZoneDetector()

PhosphorZones::ZoneDetector::~ZoneDetector ( )
override

Member Function Documentation

◆ adjacentThreshold()

int PhosphorZones::ZoneDetector::adjacentThreshold ( ) const
inline

◆ clearHighlights()

void PhosphorZones::ZoneDetector::clearHighlights ( )
overridevirtual

◆ detectMultiZone()

ZoneDetectionResult PhosphorZones::ZoneDetector::detectMultiZone ( const QPointF &  cursorPos) const
overridevirtual

◆ detectZone()

ZoneDetectionResult PhosphorZones::ZoneDetector::detectZone ( const QPointF &  cursorPos) const
overridevirtual

◆ expandPaintedZonesToRect()

QVector< Zone * > PhosphorZones::ZoneDetector::expandPaintedZonesToRect ( const QVector< Zone * > &  seedZones) const
overridevirtual

Expand painted zones to include all zones that intersect the bounding rect.

Uses the same raycasting/intersection algorithm as detectMultiZone and the editor. When user paints over zones 1 and 2, this returns zones 1,2,3,4 if 3 and 4 also intersect the minimal rectangle spanning the painted zones.

Implements PhosphorZones::IZoneDetection.

◆ highlightZone()

void PhosphorZones::ZoneDetector::highlightZone ( Zone zone)
overridevirtual

◆ highlightZones()

void PhosphorZones::ZoneDetector::highlightZones ( const QVector< Zone * > &  zones)
overridevirtual

◆ layout()

Layout * PhosphorZones::ZoneDetector::layout ( ) const
inlineoverridevirtual

◆ nearestZone()

Zone * PhosphorZones::ZoneDetector::nearestZone ( const QPointF &  point) const
overridevirtual

◆ setAdjacentThreshold()

void PhosphorZones::ZoneDetector::setAdjacentThreshold ( int  px)
inline

Set the adjacency threshold used by detectMultiZone / areZonesAdjacent.

Zones whose edges are within px pixels of each other are treated as adjacent for multi-zone selection. The daemon typically wires this to the live Settings value (via the adjacentThresholdChanged signal) so users can tune detection sensitivity without reconstructing the detector. Fine-grained injection of the int, rather than a whole ISettings pointer, keeps ZoneDetector independent of the settings layer — prerequisite for moving it into a standalone phosphor-zones library.

◆ setLayout()

void PhosphorZones::ZoneDetector::setLayout ( Layout layout)
overridevirtual

◆ zoneAtPoint()

Zone * PhosphorZones::ZoneDetector::zoneAtPoint ( const QPointF &  point) const
overridevirtual

The documentation for this class was generated from the following file: