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:
arthmis 2024-12-12 01:17:02 -05:00 committed by GitHub
parent dfcbb18a8b
commit 26f61103d6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 144 additions and 43 deletions

View file

@ -665,6 +665,15 @@ where
EmbedderEvent::WindowResize => {
return self.compositor.on_resize_window_event();
},
EmbedderEvent::ThemeChange(theme) => {
let msg = ConstellationMsg::ThemeChange(theme);
if let Err(e) = self.constellation_chan.send(msg) {
warn!(
"Sending platform theme change to constellation failed ({:?}).",
e
)
}
},
EmbedderEvent::InvalidateNativeSurface => {
self.compositor.invalidate_native_surface();
},