Sharing a project displays a notification (window) on every screen. Previously there was an issue with the positioning of windows on all screens except the primary screen. As you can see here:  Now:  @mikayla-maki and I also decided to refactor the `WindowOptions` a bit. Previously you could specify bounds which controlled the positioning and size of the window in the global coordinate space, while also providing a display id (which screen to show the window on). This can lead to unusual behavior because you could theoretically specify a global bound which does not even belong to the display id which was provided. Therefore we changed the api to this: ```rust struct WindowOptions { /// The bounds of the window in screen coordinates /// None -> inherit, Some(bounds) -> set bounds. pub bounds: Option<Bounds<DevicePixels>>, /// The display to create the window on, if this is None, /// the window will be created on the main display pub display_id: Option<DisplayId>, } ``` This lets you specify a display id, which maps to the screen where the window should be created and bounds relative to the upper left of the screen. Release Notes: - Fixed positioning of popup windows (e.g. when sharing a project) when using multiple external displays. --------- Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
38 lines
803 B
Rust
38 lines
803 B
Rust
use anyhow::{Ok, Result};
|
|
|
|
use crate::{Bounds, DevicePixels, DisplayId, PlatformDisplay, Point};
|
|
|
|
#[derive(Debug)]
|
|
pub(crate) struct TestDisplay {
|
|
id: DisplayId,
|
|
uuid: uuid::Uuid,
|
|
bounds: Bounds<DevicePixels>,
|
|
}
|
|
|
|
impl TestDisplay {
|
|
pub fn new() -> Self {
|
|
TestDisplay {
|
|
id: DisplayId(1),
|
|
uuid: uuid::Uuid::new_v4(),
|
|
bounds: Bounds::from_corners(
|
|
Point::default(),
|
|
Point::new(DevicePixels(1920), DevicePixels(1080)),
|
|
),
|
|
}
|
|
}
|
|
}
|
|
|
|
impl PlatformDisplay for TestDisplay {
|
|
fn id(&self) -> crate::DisplayId {
|
|
self.id
|
|
}
|
|
|
|
fn uuid(&self) -> Result<uuid::Uuid> {
|
|
Ok(self.uuid)
|
|
}
|
|
|
|
fn bounds(&self) -> crate::Bounds<crate::DevicePixels> {
|
|
self.bounds
|
|
}
|
|
}
|