Pulp 1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
pointer_dispatch.hpp
Go to the documentation of this file.
1#pragma once
2
3// Platform-agnostic pointer routing shared by the window hosts.
4//
5// The coordinate walk and the context-menu lookup used to live inside the macOS
6// hosts, which meant they could only be exercised by running a real NSView. They
7// are pure view-tree logic, so they live here and each platform host calls in.
8
9// Re-exported, not used here: this is an installed public header, and a
10// consumer reaching the overlay-dismissal verbs through it keeps compiling.
11// IWYU pragma: export
13#include <pulp/view/view.hpp>
14
15#include <cstdint>
16#include <functional>
17#include <string>
18
19namespace pulp::view {
20
26Point point_to_local(Point root_pos, View* target, View* root);
27
33 const MouseEvent& event, bool moving,
34 bool bubble = true);
35
44bool dispatch_context_menu(View& root, Point root_pos);
45
49bool dispatch_context_menu(View& root, View* target, Point root_pos);
50
73bool should_yield_to_gesture(View& root, const MouseEvent& event);
74
83bool yield_to_gesture_with_handoff(View& root, View*& drag_target,
84 const MouseEvent& event,
85 int click_count = 1);
86
94bool transfer_input_focus(View& root, View* target);
95
99
112 float pressure = 0.5f;
117 int pointer_id = 0;
118 float altitude_angle = 0.0f;
119 float azimuth_angle = 0.0f;
120 float movement_x = 0.0f;
121 float movement_y = 0.0f;
122 bool has_movement_delta = false;
123};
124
146void deliver_mouse_drag(View& root, View* target, Point root_pt,
147 uint16_t modifiers, int click_count = 1,
148 PointerType pointer_type = PointerType::mouse,
149 float pressure = 0.5f);
150
153void deliver_mouse_drag(View& root, View* target, Point root_pt,
154 uint16_t modifiers, int click_count,
155 PointerType pointer_type, float pressure,
156 MouseButton button);
157
160void deliver_mouse_drag(View& root, View* target, Point root_pt,
161 uint16_t modifiers, int click_count,
162 MouseButton button, const PointerAttributes& pointer);
163
190void deliver_hover_move(View& root, Point root_pt, uint16_t modifiers = 0);
191
194void deliver_hover_move(View& root, Point root_pt, uint16_t modifiers,
195 const PointerAttributes& pointer);
196
199struct WheelHost {
205 std::function<void()> request_repaint;
206};
207
230void deliver_mouse_wheel(View& root, Point root_pt,
231 float scroll_delta_x, float scroll_delta_y,
232 const WheelHost& host);
233
238void deliver_mouse_wheel(View& root, Point root_pt,
239 float scroll_delta_x, float scroll_delta_y,
240 uint16_t modifiers, const WheelHost& host);
241
266bool deliver_mouse_down(View& root, View* target, Point root_pt,
267 uint16_t modifiers, int click_count = 1,
268 bool bubble = true);
269
271bool deliver_mouse_down(View& root, View* target, Point root_pt,
272 uint16_t modifiers, int click_count, bool bubble,
273 MouseButton button);
274
280 std::function<bool()> should_continue;
281};
282
285bool deliver_mouse_down(View& root, View* target, Point root_pt,
286 uint16_t modifiers, int click_count, bool bubble,
287 MouseButton button, const MouseDownHost& host);
288
293bool deliver_mouse_down(View& root, View* target, Point root_pt,
294 uint16_t modifiers, int click_count, bool bubble,
295 MouseButton button, const MouseDownHost& host,
296 const PointerAttributes& pointer);
297
316 std::function<void(const std::function<void()>& click_handler,
317 const std::string& clicked_id,
318 uint16_t modifiers)>
320};
321
341void deliver_mouse_up(View& root, View* target, Point root_pt,
342 uint16_t modifiers, int click_count,
343 const MouseUpHost& host);
344
346void deliver_mouse_up(View& root, View* target, Point root_pt,
347 uint16_t modifiers, int click_count,
348 const MouseUpHost& host, MouseButton button);
349
354void deliver_mouse_up(View& root, View* target, Point root_pt,
355 uint16_t modifiers, int click_count,
356 const MouseUpHost& host, MouseButton button,
357 const PointerAttributes& pointer);
358
364void deliver_mouse_cancel(View& root, View* target, Point root_pt,
365 uint16_t modifiers, int click_count,
366 MouseButton button,
367 const PointerAttributes& pointer = {});
368
398void deliver_gesture_handoff(View& root, View* target, Point root_pt,
399 uint16_t modifiers, int click_count);
400
401} // namespace pulp::view
Definition view.hpp:73
Bounded event contracts shared by host ingress and graph-authored nodes.
Definition anticipation_eligibility.hpp:9
Hover-cursor tracking for platform window hosts.
Definition fwd.hpp:27
bool transfer_input_focus(View &root, View *target)
Move input focus within one hosted root while tolerating callbacks that synchronously unmount either ...
void deliver_mouse_drag(View &root, View *target, Point root_pt, uint16_t modifiers, int click_count=1, PointerType pointer_type=PointerType::mouse, float pressure=0.5f)
Deliver one drag tick of an in-flight gesture to the captured target.
bool yield_to_gesture_with_handoff(View &root, View *&drag_target, const MouseEvent &event, int click_count=1)
Apply the host-side gesture gate and close an already-delivered press when a recognizer claims after ...
View * focused_input_under_root(View &root)
Return this root's live focused input.
void dispatch_dom_pointer_event(View &root, View *target, const MouseEvent &event, bool moving, bool bubble=true)
Enter rich + JS pointer delivery from a platform host.
bool should_yield_to_gesture(View &root, const MouseEvent &event)
Feed one pointer event to root's gesture arbiter and report whether the host must now YIELD — i....
bool dispatch_context_menu(View &root, Point root_pos)
Route a right-click at root_pos to the view under it.
void deliver_hover_move(View &root, Point root_pt, uint16_t modifiers=0)
Deliver one BUTTONLESS pointer move — a hover — to the view under root_pt, which is in root-view spac...
MouseButton
Mouse button identifiers.
Definition input_events.hpp:67
void deliver_mouse_up(View &root, View *target, Point root_pt, uint16_t modifiers, int click_count, const MouseUpHost &host)
Deliver a release for an in-flight gesture captured on target.
PointerType
Pointer device type (W3C PointerEvent.pointerType).
Definition input_events.hpp:75
@ mouse
Mouse cursor (default).
Definition input_events.hpp:76
bool deliver_mouse_down(View &root, View *target, Point root_pt, uint16_t modifiers, int click_count=1, bool bubble=true)
Deliver a press to an already-resolved target (the host has done the hit_test, any combo/overlay pre-...
void deliver_gesture_handoff(View &root, View *target, Point root_pt, uint16_t modifiers, int click_count)
Close the press bracket when a recognizer CLAIMS the pointer mid-gesture, after a press was already d...
void deliver_mouse_wheel(View &root, Point root_pt, float scroll_delta_x, float scroll_delta_y, const WheelHost &host)
Route one wheel/scroll tick to the view tree rooted at root.
Point point_to_local(Point root_pos, View *target, View *root)
Convert root_pos (root-local, i.e.
void deliver_mouse_cancel(View &root, View *target, Point root_pt, uint16_t modifiers, int click_count, MouseButton button, const PointerAttributes &pointer={})
Cancel an in-flight gesture through the same identity-safe terminal router as deliver_mouse_up.
The one implementation of Pulp's overlay-dismissal policy.
Optional host-owned continuation check for re-entrant press delivery.
Definition pointer_dispatch.hpp:279
std::function< bool()> should_continue
Definition pointer_dispatch.hpp:280
Rich mouse/pointer event with position, modifiers, button state, pointer ID, and stylus properties.
Definition input_events.hpp:104
Host hooks the portable mouse-up router calls back into.
Definition pointer_dispatch.hpp:301
std::function< void(const std::function< void()> &click_handler, const std::string &clicked_id, uint16_t modifiers)> fire_click
Invoked exactly when the release lands on the SAME view the press captured (released == target,...
Definition pointer_dispatch.hpp:319
Definition geometry.hpp:20
Device identity of the pointer a delivery verb is dispatching, stamped onto every MouseEvent the verb...
Definition pointer_dispatch.hpp:110
float azimuth_angle
Stylus direction around the display plane.
Definition pointer_dispatch.hpp:119
float movement_x
Host-reported X delta since the prior event.
Definition pointer_dispatch.hpp:120
bool has_movement_delta
The host supplied the movement fields.
Definition pointer_dispatch.hpp:122
float pressure
0.0-1.0; 0.5 is the mouse default.
Definition pointer_dispatch.hpp:112
float movement_y
Host-reported Y delta since the prior event.
Definition pointer_dispatch.hpp:121
PointerType type
Definition pointer_dispatch.hpp:111
float altitude_angle
Stylus altitude above the display plane.
Definition pointer_dispatch.hpp:118
int pointer_id
0 = primary pointer, >0 = an additional simultaneous touch.
Definition pointer_dispatch.hpp:117
Host hooks the portable wheel router calls back into.
Definition pointer_dispatch.hpp:199
std::function< void()> request_repaint
Invoked after a wheel event mutates the tree (a scroll pane scrolled, a value widget stepped,...
Definition pointer_dispatch.hpp:205