mirror of
https://github.com/servo/servo.git
synced 2025-06-04 07:35:36 +00:00
servoshell: Ensure that the theme is applied properly on startup (#37128)
Instead of only applying the theme when it changes, apply it to both
egui and all
newly created `WebView`s.
Reference Zulip thread:
520082314
Testing: There are tests for servoshell currently, so all testing is
manual.
Fixes: #34913
Signed-off-by: Tony <legendmastertony@gmail.com>
This commit is contained in:
parent
d3e57a513c
commit
7147e06b53
4 changed files with 13 additions and 2 deletions
|
@ -113,6 +113,7 @@ impl RunningAppState {
|
|||
.delegate(self.clone())
|
||||
.build();
|
||||
|
||||
webview.notify_theme_change(self.inner().window.theme());
|
||||
webview.focus();
|
||||
webview.raise_to_top(true);
|
||||
|
||||
|
@ -475,6 +476,7 @@ impl WebViewDelegate for RunningAppState {
|
|||
.delegate(parent_webview.delegate())
|
||||
.build();
|
||||
|
||||
webview.notify_theme_change(self.inner().window.theme());
|
||||
webview.focus();
|
||||
webview.raise_to_top(true);
|
||||
|
||||
|
|
|
@ -70,7 +70,7 @@ impl EguiGlow {
|
|||
ViewportId::ROOT,
|
||||
event_loop,
|
||||
None,
|
||||
None,
|
||||
event_loop.system_theme(),
|
||||
None,
|
||||
),
|
||||
egui_ctx,
|
||||
|
|
|
@ -732,6 +732,13 @@ impl WindowPortsMethods for Window {
|
|||
fn hide_ime(&self) {
|
||||
self.winit_window.set_ime_allowed(false);
|
||||
}
|
||||
|
||||
fn theme(&self) -> servo::Theme {
|
||||
match self.winit_window.theme() {
|
||||
Some(winit::window::Theme::Dark) => servo::Theme::Dark,
|
||||
Some(winit::window::Theme::Light) | None => servo::Theme::Light,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn winit_phase_to_touch_event_type(phase: TouchPhase) -> TouchEventType {
|
||||
|
|
|
@ -48,6 +48,8 @@ pub trait WindowPortsMethods {
|
|||
_position: servo::webrender_api::units::DeviceIntRect,
|
||||
) {
|
||||
}
|
||||
|
||||
fn hide_ime(&self) {}
|
||||
fn theme(&self) -> servo::Theme {
|
||||
servo::Theme::Light
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue