Skip to content

Should RefreshCursor Called in a Device Without a Cursor? #39433

@stevennovaryo

Description

@stevennovaryo

Whenever there is a new webrender frame, we always do refresh cursor.

fn refresh_cursor(&self) {
let global = self.global.borrow();
let Some(last_mouse_move_position) = global.last_mouse_move_position else {
return;
};
let Some(hit_test_result) = global
.hit_test_at_point(last_mouse_move_position)
.first()
.cloned()
else {
return;
};
if let Err(error) =
global
.constellation_sender
.send(EmbedderToConstellationMessage::RefreshCursor(
hit_test_result.pipeline_id,
))
{
warn!("Sending event to constellation failed ({:?}).", error);
}
}
fn handle_new_webrender_frame_ready(&mut self, recomposite_needed: bool) {
self.pending_frames.set(self.pending_frames.get() - 1);
if recomposite_needed {
self.refresh_cursor();
}
if recomposite_needed || self.animation_callbacks_running() {
self.set_needs_repaint(RepaintReason::NewWebRenderFrame);

The IOCompositor::refresh_cursor basically checks for the last_mouse_move_position. This looks fine, but for TouchEvent we basically simulate MouseEvents here, and therefore last_mouse_move_position is set along the way.

TouchSequenceState::PendingClick(point) => {
info.state = TouchSequenceState::Finished;
// PreventDefault from touch_down may have been processed after
// touch_up already occurred.
if !info.prevent_click {
self.simulate_mouse_click(point);
}
self.touch_handler.remove_touch_sequence(sequence_id);
},

As this seems to be a no-op for a device (specifically for a touch device) without a cursor. I wonder if there are a way for embedder to notify compositor to skip these steps, or if there are more appropriate way to handle these cases.

cc: @jschwe

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions