Pulp 1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
press_reach.hpp File Reference

Ask what a press at a point actually reaches, and audit a whole view tree for controls that advertise a press target no press can reach. More...

#include <pulp/view/view.hpp>
#include <optional>
#include <string>
#include <vector>

Go to the source code of this file.

Classes

struct  pulp::view::PressReach
 What a press at a point resolves to, WITHOUT delivering it. More...
struct  pulp::view::UnreachablePressTarget
 One control that advertises a press target but cannot be reached by a press at the rect it paints. More...
struct  pulp::view::PressReachAudit
 What an audit examined, so a caller can tell a clean tree from a blind one. More...
struct  pulp::view::PressReachOptions
 Tuning for audit_press_reach. More...

Namespaces

namespace  pulp
namespace  pulp::view
 Hover-cursor tracking for platform window hosts.

Enumerations

enum class  pulp::view::PressChannel { pulp::view::click , pulp::view::context_menu }
 Which handler channel a press looks for, and therefore which resolution rule applies. More...

Functions

const char * pulp::view::press_channel_name (PressChannel channel)
 Human-readable channel name, for reports and test failure messages.
PressReach pulp::view::reach_of_press (View &root, Point root_pt, PressChannel channel=PressChannel::click)
 Resolve — without delivering — what a press at root_pt would reach.
std::optional< Rect > pulp::view::rect_in_root (const View &view, View &root)
 view's painted rect in root-local coordinates, or std::nullopt when that cannot be established exactly.
PressReachAudit pulp::view::audit_press_reach (View &root, const PressReachOptions &options={})
 Walk root and press every control that advertises a press handler, at the centre of the rect it paints.
std::string pulp::view::format_press_reach_audit (const PressReachAudit &audit)
 Format an audit as a report a human reads in CI output.

Detailed Description

Ask what a press at a point actually reaches, and audit a whole view tree for controls that advertise a press target no press can reach.

This is deliberately NOT rect arithmetic. A checker that compares a control's own hit rect against its own painted rect can only see defects a control commits against itself, and the expensive defect is the one a control commits against its ANCESTORS: an intermediate node with a zero-area box seals off a subtree of perfectly sized, perfectly wired controls, and every one of them still passes a self-vs-self comparison.

Rect::contains is half-open, so a zero-area rect contains no point at all. A 0x0 wrapper therefore admits nothing through View::hit_test, and the only reason such a subtree ever appears to work is the symmetric ~500px slack hit_test grants an overflow: visible child — slack measured from the wrapper's own in-flow position, which can be nowhere near where the control paints. The control looks alive in a screenshot, answers a selector-addressed synthetic dispatch, and cannot be pressed.

So the question these verbs answer is the end-to-end one: run the real View::hit_test at the point the control PAINTS, and report what came back. Nothing here infers; everything here resolves.

The audit reports a census alongside its findings on purpose. A reach audit that examined nothing is not a clean tree, and "0 unreachable" and "0 examined" are indistinguishable to a caller who only reads the finding list. Check PressReachAudit::examined before believing clean().