mirror of
https://github.com/servo/servo.git
synced 2025-08-15 18:35:33 +01:00
Add embedder event for preferred color scheme and respond to it in the LayoutThread (#34532)
* respond to winit platform theme changed event and send it to the layout thread Signed-off-by: Lloyd Massiah <artmis9@protonmail.com> * refactoring viewport and theme change handling functions based on feedback Signed-off-by: Lloyd Massiah <artmis9@protonmail.com> * fixing issues reported by test-tidy Signed-off-by: Lloyd Massiah <artmis9@protonmail.com> * update stylo in order to use color_scheme function on Device Signed-off-by: Lloyd Massiah <artmis9@protonmail.com> --------- Signed-off-by: Lloyd Massiah <artmis9@protonmail.com> Co-authored-by: lazypassion <25536767+lazypassion@users.noreply.github.com>
This commit is contained in:
parent
dfcbb18a8b
commit
26f61103d6
13 changed files with 144 additions and 43 deletions
|
@ -487,6 +487,15 @@ impl WindowPortsMethods for Window {
|
|||
.push(EmbedderEvent::WindowResize);
|
||||
}
|
||||
},
|
||||
winit::event::WindowEvent::ThemeChanged(theme) => {
|
||||
let theme = match theme {
|
||||
winit::window::Theme::Light => servo::script_traits::Theme::Light,
|
||||
winit::window::Theme::Dark => servo::script_traits::Theme::Dark,
|
||||
};
|
||||
self.event_queue
|
||||
.borrow_mut()
|
||||
.push(EmbedderEvent::ThemeChange(theme));
|
||||
},
|
||||
_ => {},
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue