Merge branch 'master' into explore-input-method2

This commit is contained in:
Héctor Ramón Jiménez 2025-02-03 17:24:05 +01:00
commit 50eaef2844
No known key found for this signature in database
GPG key ID: 7CC46565708259A7
5 changed files with 68 additions and 24 deletions

View file

@ -871,16 +871,19 @@ where
shell.request_redraw();
}
let is_visible =
is_hovered || self.is_top_focused || self.is_top_overlay_active;
if matches!(
event,
Event::Mouse(
mouse::Event::CursorMoved { .. }
| mouse::Event::ButtonReleased(_)
)
) || is_hovered
|| self.is_top_focused
|| self.is_top_overlay_active
) || is_visible
{
let redraw_request = shell.redraw_request();
self.top.as_widget_mut().update(
top_tree,
event.clone(),
@ -891,6 +894,11 @@ where
shell,
viewport,
);
// Ignore redraw requests of invisible content
if !is_visible {
Shell::replace_redraw_request(shell, redraw_request);
}
};
if shell.is_event_captured() {

View file

@ -564,7 +564,8 @@ where
Event::Mouse(mouse::Event::CursorMoved { .. })
| Event::Touch(touch::Event::FingerMoved { .. }) => {
if let Some(scrollbar) = scrollbars.y {
let Some(cursor_position) = cursor.position()
let Some(cursor_position) =
cursor.land().position()
else {
return;
};
@ -636,7 +637,8 @@ where
match event {
Event::Mouse(mouse::Event::CursorMoved { .. })
| Event::Touch(touch::Event::FingerMoved { .. }) => {
let Some(cursor_position) = cursor.position() else {
let Some(cursor_position) = cursor.land().position()
else {
return;
};

View file

@ -216,15 +216,15 @@ where
viewport: &Rectangle,
) {
let is_over = cursor.is_over(layout.bounds());
let is_mouse_movement =
matches!(event, Event::Mouse(mouse::Event::CursorMoved { .. }));
let end = self.children.len() - 1;
for ((child, state), layout) in self
for (i, ((child, state), layout)) in self
.children
.iter_mut()
.rev()
.zip(tree.children.iter_mut().rev())
.zip(layout.children().rev())
.enumerate()
{
child.as_widget_mut().update(
state,
@ -237,22 +237,19 @@ where
viewport,
);
if is_over
&& !is_mouse_movement
&& cursor != mouse::Cursor::Unavailable
{
if shell.is_event_captured() {
return;
}
if i < end && is_over && !cursor.is_levitating() {
let interaction = child.as_widget().mouse_interaction(
state, layout, cursor, viewport, renderer,
);
if interaction != mouse::Interaction::None {
cursor = mouse::Cursor::Unavailable;
cursor = cursor.levitate();
}
}
if shell.is_event_captured() {
return;
}
}
}