Backport: servoshell: Foward WindowEvent::Focused events to egui (#42470)

When doing event handling on desktop servoshell, ensure that
`WindowEvent::Focused(true)` is forwarded to egui. This makes it so that
egui knows to show the text cursor in the URL bar input field.

Testing: We currently do not have a way to test visual behavior at this
level of servoshell.
Fixes: #42091.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
(cherry picked from commit 489c0f0159)
This commit is contained in:
Martin Robinson
2026-02-09 11:20:35 +01:00
committed by Jonathan Schwender
parent 0c786948d6
commit 8fb635fbbf

View File

@@ -572,7 +572,6 @@ impl HeadedWindow {
// Handle the event
let mut consumed = false;
match event {
WindowEvent::Focused(true) => state.handle_focused(window.clone()),
WindowEvent::ScaleFactorChanged { scale_factor, .. } => {
// Intercept any ScaleFactorChanged events away from EguiGlow::on_window_event, so
// we can use our own logic for calculating the scale factor and set eguis
@@ -632,6 +631,10 @@ impl HeadedWindow {
self.rebuild_user_interface(&state, &window);
}
if let WindowEvent::Focused(true) = event {
state.handle_focused(window.clone());
}
if response.repaint && *event != WindowEvent::RedrawRequested {
self.winit_window.request_redraw();
}