Windows: impl WindowsDisplay (#9287)

Tested on my laptop, and I've noticed that when I move the window,
`WindowsPlatform::displays()` is being continuously called. Is this
intended?

Release Notes:

- N/A
This commit is contained in:
张小白 2024-03-14 04:08:11 +08:00 committed by GitHub
parent 36cbfbfb94
commit 3274cc93df
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 173 additions and 37 deletions

View file

@ -284,19 +284,24 @@ impl Platform for WindowsPlatform {
unimplemented!()
}
// todo(windows)
fn displays(&self) -> Vec<Rc<dyn PlatformDisplay>> {
vec![Rc::new(WindowsDisplay::new())]
WindowsDisplay::displays()
}
// todo(windows)
fn display(&self, id: crate::DisplayId) -> Option<Rc<dyn PlatformDisplay>> {
Some(Rc::new(WindowsDisplay::new()))
if let Some(display) = WindowsDisplay::new(id) {
Some(Rc::new(display) as Rc<dyn PlatformDisplay>)
} else {
None
}
}
// todo(windows)
fn primary_display(&self) -> Option<Rc<dyn PlatformDisplay>> {
Some(Rc::new(WindowsDisplay::new()))
if let Some(display) = WindowsDisplay::primary_monitor() {
Some(Rc::new(display) as Rc<dyn PlatformDisplay>)
} else {
None
}
}
// todo(windows)