Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

gpui: Fix window_positioning example on non-primary displays (#65917)

Rajat Patra0a39cdb4f3ec
diff --git a/crates/gpui/examples/window_positioning.rs b/crates/gpui/examples/window_positioning.rs
index 22c9b359c01..8db12ce04a9 100644
--- a/crates/gpui/examples/window_positioning.rs
+++ b/crates/gpui/examples/window_positioning.rs
@@ -87,7 +87,7 @@ fn run_example() {
for screen in cx.displays() {
let bounds = Bounds {
- origin: point(margin_offset, margin_offset),
+ origin: screen.bounds().origin + point(margin_offset, margin_offset),
size,
};
@@ -146,7 +146,10 @@ fn run_example() {
.unwrap();
let bounds = Bounds {
- origin: point(screen.bounds().center().x - size.center().x, margin_offset),
+ origin: point(
+ screen.bounds().center().x - size.center().x,
+ screen.bounds().top() + margin_offset,
+ ),
size,
};
@@ -160,7 +163,10 @@ fn run_example() {
.unwrap();
let bounds = Bounds {
- origin: point(margin_offset, screen.bounds().center().y - size.center().y),
+ origin: point(
+ screen.bounds().left() + margin_offset,
+ screen.bounds().center().y - size.center().y,
+ ),
size,
};
@@ -192,7 +198,7 @@ fn run_example() {
let bounds = Bounds {
origin: point(
- screen.bounds().size.width - size.width - margin_offset,
+ screen.bounds().right() - size.width - margin_offset,
screen.bounds().center().y - size.center().y,
),
size,
@@ -210,7 +216,7 @@ fn run_example() {
let bounds = Bounds {
origin: point(
screen.bounds().center().x - size.center().x,
- screen.bounds().size.height - size.height - margin_offset,
+ screen.bounds().bottom() - size.height - margin_offset,
),
size,
};