T51: Ely stands inside the main window on its pane's bottom edge while her box would not fit above it, which the owner asked for after 0.1.4, where on a window at the screen's top or full screen she stuck between the menu bar and the terminal: each platform measures the room above the pane up to its display's work area, macOS's visibleFrame, Windows' rcWork, X11's _NET_WORKAREA, and on Wayland, which tells a client no place, she stands inside while the window is full screen, maximized or tiled at its top
This commit is contained in:
10 files changed
+291
-98
No files matched your search
+13
-5
@@ -9,7 +9,7 @@ use objc::{
|
||||
};
|
||||
use raw_window_handle::{HasWindowHandle, RawWindowHandle};
|
||||
|
||||
use super::left;
|
||||
use super::{Edge, edge, left};
|
||||
|
||||
/// AppKit's `NSWindowAbove`.
|
||||
const ABOVE: isize = 1;
|
||||
@@ -51,17 +51,25 @@ impl Glue {
|
||||
Ok(Self { pet, main })
|
||||
}
|
||||
|
||||
/// Stands her on the main window's top edge, as far in as its width allows.
|
||||
pub fn place(&self, _: &Window) -> anyhow::Result<()> {
|
||||
/// Stands her on the main window's top edge while her box fits under the top of its screen's visible frame, else on its bottom edge, as far in as its width allows, and gives the edge.
|
||||
pub fn place(&self, _: &Window) -> anyhow::Result<Edge> {
|
||||
unsafe {
|
||||
let frame: Rect = msg_send![self.main, frame];
|
||||
let screen: *mut Object = msg_send![self.main, screen];
|
||||
anyhow::ensure!(!screen.is_null(), "pet: the main window is on no screen");
|
||||
let visible: Rect = msg_send![screen, visibleFrame];
|
||||
let top = frame.origin.y + frame.height;
|
||||
let edge = edge((visible.origin.y + visible.height - top) as f32);
|
||||
let at = Point {
|
||||
x: frame.origin.x + f64::from(left(gpui::px(frame.width as f32))),
|
||||
y: frame.origin.y + frame.height,
|
||||
y: match edge {
|
||||
Edge::Top => top,
|
||||
Edge::Bottom => frame.origin.y,
|
||||
},
|
||||
};
|
||||
let _: () = msg_send![self.pet, setFrameOrigin: at];
|
||||
Ok(edge)
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user