T46: Ely peeks over the main window's top edge from behind it, as the owner asked after the 0.1.3 film: her head and fingers from the icon's paths in a transparent window of her own, kept on the edge as each platform allows, macOS's child window, Windows' owned popup, X11's popup moved and stacked above the frame, Wayland's anchored popup; ten faces follow the most pressing of the sessions' marks, with hops, a shake and a rise; a press winks; Settings, Terminal, Ely turns her off
This commit is contained in:
22 files changed
+1090
-45
No files matched your search
@@ -21,6 +21,40 @@ pub fn number(window: &gpui::Window) -> anyhow::Result<u32> {
|
||||
u32::try_from(number).context("window number out of range")
|
||||
}
|
||||
|
||||
/// The window and each of its child windows: number and frame, in AppKit's screen points.
|
||||
pub fn frames(number: u32) -> anyhow::Result<Vec<(u32, [f64; 4])>> {
|
||||
use core_graphics::geometry::CGRect;
|
||||
unsafe {
|
||||
let app: *mut Object = msg_send![class!(NSApplication), sharedApplication];
|
||||
let window: *mut Object = msg_send![app, windowWithWindowNumber: i64::from(number)];
|
||||
anyhow::ensure!(!window.is_null(), "no window {number}");
|
||||
let children: *mut Object = msg_send![window, childWindows];
|
||||
let count: u64 = if children.is_null() {
|
||||
0
|
||||
} else {
|
||||
msg_send![children, count]
|
||||
};
|
||||
let children = (0..count).map(|ix| msg_send![children, objectAtIndex: ix]);
|
||||
std::iter::once(window)
|
||||
.chain(children)
|
||||
.map(|window: *mut Object| {
|
||||
let number: i64 = msg_send![window, windowNumber];
|
||||
let frame: CGRect = msg_send![window, frame];
|
||||
let corners = [
|
||||
frame.origin.x,
|
||||
frame.origin.y,
|
||||
frame.size.width,
|
||||
frame.size.height,
|
||||
];
|
||||
Ok((
|
||||
u32::try_from(number).context("window number out of range")?,
|
||||
corners,
|
||||
))
|
||||
})
|
||||
.collect()
|
||||
}
|
||||
}
|
||||
|
||||
/// Shows the window as key, the app left inactive.
|
||||
pub fn front(number: u32) -> anyhow::Result<()> {
|
||||
unsafe {
|
||||
|
||||
@@ -68,6 +68,14 @@ fn main() {
|
||||
let title = aim.update(cx, |_, window, _| window.window_title());
|
||||
let title = title.expect("the window lives");
|
||||
capture::snapshot(number(aim, cx), std::path::Path::new(&out)).expect("a picture");
|
||||
let frames = capture::frames(number(aim, cx)).expect("the window's frames");
|
||||
log::info!("shot: the window at {:?}", frames[0].1);
|
||||
for (index, (child, at)) in frames.into_iter().skip(1).enumerate() {
|
||||
let path = out.replace(".png", &format!(".child{index}.png"));
|
||||
capture::snapshot(child, std::path::Path::new(&path))
|
||||
.expect("a child's picture");
|
||||
log::info!("shot: child window {child} at {at:?}, wrote {path}");
|
||||
}
|
||||
let views = capture::views(number(aim, cx)).expect("the window's views");
|
||||
log::info!("shot: wrote {out}, titled {title:?}, over {views:?}");
|
||||
for line in capture::menus() {
|
||||
|
||||
Reference in new issue
Block a user