web browser (Servo)
git clone https://git.lucas.co/cce-browser.git
wpe: report the gesture phase on scroll events — touchpad source and the finger-lift stop
cce-ui now publishes whether a wheel event is a click, finger motion, or
the finger lift; the WPE path used to send everything as a mouse-source
scroll with is_stop=0, so WebKit never saw a gesture end. Finger phases go
in as touchpad-source, and the lift's zero delta sets is_stop, which is
what the engine's own kinetic scrolling keys off.
Co-Authored-By: Claude Fable 5.1 <[email protected]>
src/wpe/host.rs | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/src/wpe/host.rs b/src/wpe/host.rs
index 71321ad..b96901b 100644
--- a/src/wpe/host.rs
+++ b/src/wpe/host.rs
@@ -849,18 +849,29 @@ impl WebKitHost {
/// earlier cut negated these and `examples/wpe_input` caught it — the
/// page reported `deltaY` of the wrong sign.
pub fn wheel(&self, dx_px: f64, dy_px: f64, x_px: f32, y_px: f32) {
+ // cce-ui publishes the gesture phase of the wheel event being
+ // dispatched: a trackpad's finger lift arrives as a zero delta in
+ // FingerEnd, which is WebKit's scroll-stop — the signal its own
+ // kinetic scrolling keys off. Finger phases report the touchpad
+ // source so the engine treats the deltas as a gesture, not clicks.
+ let phase = cce_ui::widget::scroll_motion::current_scroll_phase();
+ let (source, is_stop) = match phase {
+ cce_ui::widget::ScrollPhase::Wheel => (WPEInputSource::WPE_INPUT_SOURCE_MOUSE, 0),
+ cce_ui::widget::ScrollPhase::Finger => (WPEInputSource::WPE_INPUT_SOURCE_TOUCHPAD, 0),
+ cce_ui::widget::ScrollPhase::FingerEnd => (WPEInputSource::WPE_INPUT_SOURCE_TOUCHPAD, 1),
+ };
unsafe {
let view = self.active_tab().view;
let (x, y) = self.to_logical(x_px, y_px);
let e = wpe_event_scroll_new(
view,
- WPEInputSource::WPE_INPUT_SOURCE_MOUSE,
+ source,
input::now_ms(),
0,
dx_px / self.scale as f64,
dy_px / self.scale as f64,
1, // precise deltas: these are pixels, not notches
- 0, // not a scroll-stop event
+ is_stop,
x,
y,
);