mirror of
https://github.com/servo/servo
synced 2026-04-25 17:15:48 +02:00
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:
committed by
Jonathan Schwender
parent
0c786948d6
commit
8fb635fbbf
@@ -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 egui’s
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user