T46: round 1 fixes: Ely's window never takes the keys, a panel key only if needed on macOS and on Windows a window that answers a press's activation with none; she opens with the sessions' mood; she stands 140 points in or less on a narrow pane, so she holds its edge at any width, and on Wayland, whose popup keeps the place it opened at, she opens again when a new width moves her
CI / platforms (ubuntu-24.04) (push) Successful in 1m53s
CI / platforms (windows-latest) (push) Successful in 2m2s
CI / macos (push) Canceled after 9m52s

This commit is contained in:
ZacharyZhang-NY committed 2026-10-18 05:26:13 -04:00
1 parent 9aeb3f3552
commit 6df7534e7f
7 files changed
+165 -70

No files matched your search

+1 -1
View File
@@ -107,4 +107,4 @@ ELYTerminal. A terminal on GPUI and Ely components. `PRD.md` says what it does;
- 2026-10-17: a session posts system notifications through gpui's, which the owner asked for. At start `set_app_identity` names the app: on Windows that sets the process's AppUserModelID, which the taskbar groups its windows by too, so a pin made before may show apart, and the first notification writes the app's name under `HKCU\Software\Classes\AppUserModelId`, as gpui needs for an app without a package; on macOS gpui posts only from the app bundle, asks for leave at the first, and logs once, under the `gpui_macos` target, that it posts nothing outside one; on Linux it posts over D-Bus through notify-rust. Each terminal view posts its own, in the order its output asks, so OSC 99's answers keep their place before a DA1 sent after them: when its row's mark turns to waiting, done or error, at each turn, as the row's waiting mark is set, the hover's line for the record its body; when a command C started ends, `Command finished`, or `Command exited with N`, so a prompt drawn again, as macOS's bash 3.2 draws one with its D at a resize, posts nothing, and bash 3.2, which sends no C, posts no command's end, as Ghostty's integration, which skips it, posts none; and when a program asks through OSC 9, 777 or 99, its title and body the body, each line shown as text. It posts only while its window is not active or it is not the session shown, which the workspace tells it, one every 3 seconds at most, a later one logged and dropped; the title is the program's title, else the app's name, as the row names the session, which the tap reads in the output's order, so a title set before a notification in the same output names it. The session's own share a tag, so a new one takes the old one's place where the system allows, as an OSC 99 id does; OSC 9, 777 and OSC 99 without an id each take their own; a session keeps its last 64. A press goes to the window whose session posted it: it shows the window and the session, unless OSC 99 said `a=-focus`, and tells a program that asked `a=report`, `OSC 99 ; i=ID ;`; a press whose record went, a twin Linux stacked and pressed before or one past the 64 kept, still shows its session and tells no program. macOS brings the app forward at any press, `a=-focus` or not, and on Wayland gpui asks for the window with a serial the compositor likely refuses, so KWin and Mutter mark it as asking for attention instead. gpui hears of no close on any system, so `c=1` hears `p=close;untracked` once posted, and alive lists the ids posted and not yet pressed, closed or expired. On macOS and Windows a close takes the notification back, and `w` over 0 takes it back once it runs out, its session gone or not, unless a later post holds its tag; gpui on Linux closes and replaces none, so there a close and `w` pass by, logged, a closed one stays alive, and an update posts beside the old one. `o` passes by: each notification posts only while unseen, which is kitty's invisible, so the query answers `a=focus,report:o=invisible:p=title,body,close,?,alive:w=1`, on Linux `a=focus,report:o=invisible:p=title,body,?,alive`, never with the `c` that close events would need. Windows' toasts are silent, as macOS's are; on Linux the notification daemon decides, and reads the body as markup, so its `&`, `<` and `>` go as entities.
- 2026-10-18: herdr's shortcuts, which a user found dead, as kitty and Ghostty send them. herdr 0.9.5 asks for kitty's disambiguate, events and alternates on macOS and Linux, and takes `cmd+shift+ctrl+[` as `[` with Shift, Ctrl and Super, `CSI 91;14u`, the symbol as its alternate, `CSI 91:123;14u`, as Ghostty sends it; gpui named the key `{` and cleared Shift, so ELYTerminal sent `CSI 123;13u`, which herdr matches only to `cmd+ctrl+{`. Under kitty's flags a key Shift made a symbol of now goes as its own character with Shift, the symbol its alternate; legacy keys keep fixterms' symbol without Shift, as Ghostty's do. On macOS the key's own character comes from `UCKeyTranslate` on the event's key code, in the layout gpui reads: Command's while Command is down or while the plain one types no ASCII; AppKit's `charactersByApplyingModifiers:` ignores the layout for events built in-process. On Windows herdr asks for no kitty flags and reads the console's key records, and ConPTY asks every terminal for win32-input-mode, `CSI ? 9001 h`; so, as Windows Terminal does, each key that types no text goes as `CSI Vk ; Sc ; Uc ; Kd ; Cs ; Rc _`: the virtual key from gpui's name and the layout (`VkKeyScanW`), its scan code, what Windows types for it (`ToUnicode`, a dead key left as it is), down or up, and the modifier keys, locks and enhanced block from `GetKeyState`. kitty's flags go first, as in Windows Terminal; text stays text, so a repeat or a release goes as a record where its press did, a repeat that types after its modifiers came up too, and a release goes so only there; a full reset ends the mode, as Windows Terminal's does. A key that is down is known by its code, AppKit's key code on macOS and the virtual key on Windows, since gpui names a release by the modifiers left down: a release after Shift came up still goes out. Linux has only gpui's name. A console record holds no Windows key, so no Windows terminal passes herdr a `cmd` binding, and a keypad key goes as its main key, since gpui names it so. On Linux gpui keeps neither the key code nor its xkb state, and names a non-ASCII key by its place on a US keyboard, so a key's own character cannot be found: Shift with a symbol and Ctrl, Alt or Super goes as the symbol without Shift, which herdr matches to a binding on the symbol, `ctrl+{`.
- 2026-10-18: inside herdr, herdr opens its panes' links, as the owner's Cmd-press and Ctrl-press ask. herdr 0.9.5 wraps a long URL at its pane's edge with no wrap flag and writes its panes' OSC 8 links to the terminal without their targets, so ELYTerminal's own finder opened a cut URL or nothing; herdr itself opens the link under a Ctrl-press, whole from its own pane, a wrapped URL or an OSC 8 target, and underlines it while Ctrl is held. So while herdr's client leads the session and tracks the mouse, every link press goes to herdr as the mouse report it is, and on macOS herdr hears Cmd as Ctrl, the wheel aside. herdr's rules come with it, by its design: while it takes the mouse it keeps its panes' OSC 8 targets from the terminal, so that it alone answers Ctrl-press, and it opens only `http` and `https` links; a `file://` link inside herdr stays shut, since the text the terminal sees may be the label of another link. Shift with the press, which takes the mouse back from a program, is the way past herdr its docs name: the terminal then opens what it sees, a `file://` link too. With herdr's mouse capture off, herdr writes its links' targets out and the terminal opens them itself. Elsewhere ELYTerminal opens the link itself, as before.
- 2026-10-18: Ely peeks over the main window's top edge, which the owner asked for after the 0.1.3 film, her head and fingers drawn from the icon's own paths and cut at the edge she holds, in a transparent window of her own, 112 by 107 points with 16 above her for her hops, 140 in from the pane's left edge, so that the main window seems to hide the rest of her. gpui moves no window and places its popups only on Wayland, so each platform keeps her there its own way: on macOS gpui's popup panel is made the main window's child, at its level and in its Spaces, without a shadow, so AppKit moves it and hides it with the window; on Windows gpui's popup is owned by the main window and loses the topmost place gpui gives it, so it stays just above the main window and hides with it, and is moved as the main window moves; on X11 gpui's popup, which no window manager places, is moved onto the pane, stacked just above the window manager's frame as the window moves or comes forward, and unmapped while it hides; on Wayland she is gpui's anchored popup, an xdg_popup on the pane's top edge, which the compositor keeps there. Her face follows the most pressing of the sessions' marks: a program that waits surprises her, with a mark and two hops; an error worries her, with a shake; a finish cheers her for 4 s, with a hop; work keeps her eyes on the terminal; calm, she blinks and glances, and dozes after 5 minutes; a press winks at you. Each face is an SVG drawn once, at three times her size so Retina draws her sharp, and she draws again only when her face changes. Settings › Terminal › Ely turns her off; she is on by default.
- 2026-10-18: Ely peeks over the main window's top edge, which the owner asked for after the 0.1.3 film, her head and fingers drawn from the icon's own paths and cut at the edge she holds, in a transparent window of her own, 112 by 107 points with 16 above her for her hops, 140 in from the pane's left edge, less on a pane too narrow for that, so she holds its edge at any width, and the main window seems to hide the rest of her. Her window never takes the keys from the terminal: on macOS her panel becomes key only if needed, which gpui's view never asks; on Windows her window answers a press's activation with none, every other message passed on to gpui's own procedure; on X11 and Wayland a press moves no focus. gpui moves no window and places its popups only on Wayland, so each platform keeps her there its own way: on macOS gpui's popup panel is made the main window's child, at its level and in its Spaces, without a shadow, so AppKit moves it and hides it with the window; on Windows gpui's popup is owned by the main window and loses the topmost place gpui gives it, so it stays just above the main window and hides with it, and is moved as the main window moves; on X11 gpui's popup, which no window manager places, is moved onto the pane, stacked just above the window manager's frame as the window moves or comes forward, and unmapped while it hides; on Wayland she is gpui's anchored popup, an xdg_popup on the pane's top edge, which the compositor keeps there; gpui moves a popup's anchor never, so a new width that moves her place opens her again. She opens with the sessions' mood, and her face follows the most pressing of their marks: a program that waits surprises her, with a mark and two hops; an error worries her, with a shake; a finish cheers her for 4 s, with a hop; work keeps her eyes on the terminal; calm, she blinks and glances, and dozes after 5 minutes; a press winks at you. Each face is an SVG drawn once, at three times her size so Retina draws her sharp, and she draws again only when her face changes. Settings › Terminal › Ely turns her off; she is on by default.
+6 -5
View File
@@ -1,6 +1,4 @@
#[cfg(target_os = "linux")]
use gpui::{Bounds, Decorations, Pixels, Size, point};
use gpui::{Window, WindowBackgroundAppearance};
use gpui::{Bounds, Decorations, Pixels, Size, Window, WindowBackgroundAppearance, point};
use crate::settings::Settings;
@@ -91,8 +89,11 @@ impl Blur {
}
/// The window's pane in its surface: all of it, less the inset on each free edge of a client-drawn window, as Ely's `ResizeBorder` pads it.
#[cfg(target_os = "linux")]
fn pane(size: Size<Pixels>, inset: Option<Pixels>, decorations: Decorations) -> Bounds<Pixels> {
pub(crate) fn pane(
size: Size<Pixels>,
inset: Option<Pixels>,
decorations: Decorations,
) -> Bounds<Pixels> {
let mut pane = Bounds::new(point(Pixels::ZERO, Pixels::ZERO), size);
let (Decorations::Client { tiling }, Some(inset)) = (decorations, inset) else {
return pane;
+103 -38
View File
@@ -18,10 +18,10 @@ use std::{
};
use gpui::{
Animation, AnimationExt as _, App, AppContext as _, Bounds, Context, Decorations, Image,
InteractiveElement, IntoElement, MouseButton, ParentElement, Pixels, Render, Styled,
Subscription, Task, Window, WindowBackgroundAppearance, WindowBounds, WindowHandle, WindowKind,
WindowOptions, div, img, point, popup, px, size,
Animation, AnimationExt as _, App, AppContext as _, Bounds, Context, Image, InteractiveElement,
IntoElement, MouseButton, ParentElement, Pixels, Render, Styled, Subscription, Task, Window,
WindowBackgroundAppearance, WindowBounds, WindowHandle, WindowKind, WindowOptions, div, img,
point, popup, px, size,
};
#[cfg(target_os = "macos")]
@@ -52,6 +52,8 @@ pub struct Pet {
petted: Option<Instant>,
/// Counts her moves, so each plays from its start.
moves: usize,
/// How far in from the pane's left edge she opened.
left: f32,
/// What keeps her window on the main window's edge, where the platform does not.
glue: Option<platform::Glue>,
_wake: Option<Task<()>>,
@@ -61,40 +63,80 @@ pub struct Pet {
/// Shows Ely over `main` while the settings want her.
pub fn follow(main: WindowHandle<Workspace>, cx: &mut App) {
let shown: Rc<RefCell<Option<WindowHandle<Pet>>>> = Rc::default();
let sync = move |cx: &mut App| {
let open = *shown.borrow();
match (SettingsStore::get(cx).ely, open) {
(true, None) => match show(main, cx) {
Ok(pet) => *shown.borrow_mut() = Some(pet),
Err(error) => log::error!("pet: Ely does not show: {error:#}"),
},
(false, Some(pet)) => {
*shown.borrow_mut() = None;
log::info!("pet: Ely goes, as the settings say");
if pet
.update(cx, |_, window, _| window.remove_window())
.is_err()
{
log::debug!("pet: her window had gone");
let sync = {
let shown = shown.clone();
move |cx: &mut App| {
let open = *shown.borrow();
match (SettingsStore::get(cx).ely, open) {
(true, None) => *shown.borrow_mut() = open_pet(main, cx),
(false, Some(pet)) => {
*shown.borrow_mut() = None;
close(pet, "as the settings say", cx);
}
_ => {}
}
_ => {}
}
};
sync(cx);
cx.observe_global::<SettingsStore>(sync).detach();
// A Wayland popup keeps the place it opened at, so she opens again where a new width puts her.
let moved = main.update(cx, |_, window, cx| {
cx.observe_window_bounds(window, move |_, window, cx| {
let Some(pet) = *shown.borrow() else {
return;
};
let at = left(pane(window).size.width);
if wayland(window) && pet.read(cx).is_ok_and(|pet| pet.left != at) {
let shown = shown.clone();
cx.defer(move |cx| {
close(pet, "to stand where the new width puts her", cx);
*shown.borrow_mut() = open_pet(main, cx);
});
}
})
});
match moved {
Ok(moved) => moved.detach(),
Err(error) => log::error!("pet: the main window's width goes unwatched: {error:#}"),
}
}
/// Opens her window, logging why when it does not open.
fn open_pet(main: WindowHandle<Workspace>, cx: &mut App) -> Option<WindowHandle<Pet>> {
show(main, cx)
.inspect_err(|error| log::error!("pet: Ely does not show: {error:#}"))
.ok()
}
fn close(pet: WindowHandle<Pet>, why: &str, cx: &mut App) {
log::info!("pet: Ely goes, {why}");
if pet
.update(cx, |_, window, _| window.remove_window())
.is_err()
{
log::debug!("pet: her window had gone");
}
}
/// How far in from the pane's left edge she stands on a pane `width` points wide: `LEFT`, or less on a narrow pane, so she holds its edge.
fn left(width: Pixels) -> f32 {
LEFT.min(f32::from(width) - WIDTH).max(0.0)
}
/// Opens her window on `main`'s top edge: a popup Wayland's compositor places, else a window kept there.
fn show(main: WindowHandle<Workspace>, cx: &mut App) -> anyhow::Result<WindowHandle<Pet>> {
let (bounds, inset, wayland) = main.update(cx, |_, window, _| {
(window.bounds(), top_inset(window), wayland(window))
let (bounds, pane, wayland) = main.update(cx, |_, window, _| {
(window.bounds(), pane(window), wayland(window))
})?;
let at = left(pane.size.width);
let room = size(px(WIDTH), px(HEAD + ROOM));
let kind = if wayland {
WindowKind::AnchoredPopup(popup::PopupOptions {
parent: main.into(),
anchor_rect: Bounds::new(point(inset + px(LEFT), inset), size(px(1.), px(1.))),
anchor_rect: Bounds::new(
point(pane.origin.x + px(at), pane.origin.y),
size(px(1.), px(1.)),
),
anchor: popup::PopupAnchor::TopLeft,
gravity: popup::PopupGravity::TopRight,
constraint_adjustment: popup::PopupConstraintAdjustment::empty(),
@@ -104,10 +146,7 @@ fn show(main: WindowHandle<Workspace>, cx: &mut App) -> anyhow::Result<WindowHan
} else {
WindowKind::PopUp
};
let origin = point(
bounds.origin.x + inset + px(LEFT),
bounds.origin.y + inset - room.height,
);
let origin = bounds.origin + pane.origin + point(px(at), -room.height);
let options = WindowOptions {
window_bounds: Some(WindowBounds::Windowed(Bounds::new(origin, room))),
titlebar: None,
@@ -121,21 +160,30 @@ fn show(main: WindowHandle<Workspace>, cx: &mut App) -> anyhow::Result<WindowHan
..Default::default()
};
let workspace = main.entity(cx)?;
let feeling = |workspace: &Workspace, cx: &App| {
mood(
workspace
.sessions()
.iter()
.filter_map(|session| session.looks(cx)),
)
};
let start = feeling(workspace.read(cx), cx);
let pet = cx.open_window(options, |_, cx| {
cx.new(|cx| {
let feel = cx.observe(&workspace, |pet: &mut Pet, workspace, cx| {
let sessions = workspace.read(cx).sessions();
let now = mood(sessions.iter().filter_map(|session| session.looks(cx)));
let feel = cx.observe(&workspace, move |pet: &mut Pet, workspace, cx| {
let now = feeling(workspace.read(cx), cx);
if now != pet.mood {
pet.feel(now, cx);
}
});
let mut pet = Pet {
faces: faces::images(),
mood: Mood::Calm,
mood: start,
since: Instant::now(),
petted: None,
moves: 0,
left: at,
glue: None,
_wake: None,
_watch: vec![feel],
@@ -152,7 +200,7 @@ fn show(main: WindowHandle<Workspace>, cx: &mut App) -> anyhow::Result<WindowHan
} else {
"a window kept there"
};
log::info!("pet: Ely peeks over the main window, {way}");
log::info!("pet: Ely peeks over the main window, {way}, feeling {start:?}");
Ok(pet)
}
@@ -178,12 +226,13 @@ fn glue(main: WindowHandle<Workspace>, pet: WindowHandle<Pet>, cx: &mut App) ->
})?
}
/// The pane's distance from its window's top: the resize margin of a window that draws its own frame and is free at the top.
fn top_inset(window: &Window) -> Pixels {
match (window.window_decorations(), window.client_inset()) {
(Decorations::Client { tiling }, Some(inset)) if !tiling.top => inset,
_ => px(0.),
}
/// The main window's pane, in its own points.
fn pane(window: &Window) -> Bounds<Pixels> {
crate::blur::pane(
window.viewport_size(),
window.client_inset(),
window.window_decorations(),
)
}
/// Whether `window` is a Wayland surface, where the compositor places windows.
@@ -299,3 +348,19 @@ impl Render for Pet {
)
}
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn she_holds_the_edge_of_any_pane() {
assert_eq!(left(px(1200.)), LEFT);
assert_eq!(left(px(200.)), 200.0 - WIDTH);
assert_eq!(
left(px(100.)),
0.0,
"narrower than she is, she stands at its left"
);
}
}
+6 -5
View File
@@ -4,12 +4,12 @@ use anyhow::bail;
use gpui::Window;
use objc::{
msg_send,
runtime::{NO, Object},
runtime::{NO, Object, YES},
sel, sel_impl,
};
use raw_window_handle::{HasWindowHandle, RawWindowHandle};
use super::LEFT;
use super::left;
/// AppKit's `NSWindowAbove`.
const ABOVE: isize = 1;
@@ -36,7 +36,7 @@ pub struct Glue {
}
impl Glue {
/// Makes her window the main window's child, at its level and in its Spaces, with no shadow.
/// Makes her window the main window's child, at its level and in its Spaces, with no shadow and never key, so a press leaves the keys with the terminal.
pub fn new(pet: &Window, main: &Window) -> anyhow::Result<Self> {
let (pet, main) = (native(pet)?, native(main)?);
unsafe {
@@ -45,17 +45,18 @@ impl Glue {
let spaces: usize = msg_send![main, collectionBehavior];
let _: () = msg_send![pet, setCollectionBehavior: spaces];
let _: () = msg_send![pet, setHasShadow: NO];
let _: () = msg_send![pet, setBecomesKeyOnlyIfNeeded: YES];
let _: () = msg_send![main, addChildWindow: pet ordered: ABOVE];
}
Ok(Self { pet, main })
}
/// Stands her on the main window's top edge, `LEFT` points in from its left.
/// Stands her on the main window's top edge, as far in as its width allows.
pub fn place(&self, _: &Window) -> anyhow::Result<()> {
unsafe {
let frame: Rect = msg_send![self.main, frame];
let at = Point {
x: frame.origin.x + f64::from(LEFT),
x: frame.origin.x + f64::from(left(gpui::px(frame.width as f32))),
y: frame.origin.y + frame.height,
};
let _: () = msg_send![self.pet, setFrameOrigin: at];
+32 -8
View File
@@ -1,17 +1,23 @@
//! Ely's window on Windows: owned by the main window, so it stays above it and hides with it, and moved as it moves.
use std::sync::atomic::{AtomicIsize, Ordering};
use anyhow::bail;
use gpui::Window;
use gpui::{Window, px};
use raw_window_handle::{HasWindowHandle, RawWindowHandle};
use windows_sys::Win32::{
Foundation::{HWND, RECT},
Foundation::{HWND, LPARAM, LRESULT, RECT, WPARAM},
UI::WindowsAndMessaging::{
GWLP_HWNDPARENT, GetWindowRect, HWND_NOTOPMOST, SWP_NOACTIVATE, SWP_NOMOVE, SWP_NOSIZE,
SWP_NOZORDER, SetWindowLongPtrW, SetWindowPos,
CallWindowProcW, GWLP_HWNDPARENT, GWLP_WNDPROC, GetWindowRect, HWND_NOTOPMOST,
MA_NOACTIVATE, SWP_NOACTIVATE, SWP_NOMOVE, SWP_NOSIZE, SWP_NOZORDER, SetWindowLongPtrW,
SetWindowPos, WM_MOUSEACTIVATE, WNDPROC,
},
};
use super::{HEAD, LEFT, ROOM};
use super::{HEAD, ROOM, left};
/// gpui's window procedure, which hers passes every message on to but a press's activation.
static GPUI: AtomicIsize = AtomicIsize::new(0);
/// Her window and the main one.
pub struct Glue {
@@ -20,11 +26,14 @@ pub struct Glue {
}
impl Glue {
/// Gives her window the main window as owner, and takes away the topmost place gpui gives a popup.
/// Gives her window the main window as owner, takes away the topmost place gpui gives a popup, and keeps a press from activating it, so the keys stay with the terminal.
pub fn new(pet: &Window, main: &Window) -> anyhow::Result<Self> {
let (pet, main) = (native(pet)?, native(main)?);
unsafe {
SetWindowLongPtrW(pet, GWLP_HWNDPARENT, main as isize);
let gpui = SetWindowLongPtrW(pet, GWLP_WNDPROC, inactive as *const () as isize);
anyhow::ensure!(gpui != 0, "pet: her window's procedure does not read");
GPUI.store(gpui, Ordering::Relaxed);
let flags = SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE;
anyhow::ensure!(
SetWindowPos(pet, HWND_NOTOPMOST, 0, 0, 0, 0, flags) != 0,
@@ -34,7 +43,7 @@ impl Glue {
Ok(Self { pet, main })
}
/// Stands her on the main window's top edge, `LEFT` points in from its left.
/// Stands her on the main window's top edge, as far in as its width allows.
pub fn place(&self, main: &Window) -> anyhow::Result<()> {
let scale = main.scale_factor();
let mut frame = RECT::default();
@@ -43,7 +52,8 @@ impl Glue {
GetWindowRect(self.main, &mut frame) != 0,
"pet: the main window's place does not read"
);
let x = frame.left + (LEFT * scale).round() as i32;
let width = px((frame.right - frame.left) as f32 / scale);
let x = frame.left + (left(width) * scale).round() as i32;
let y = frame.top - ((HEAD + ROOM) * scale).round() as i32;
let flags = SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE;
anyhow::ensure!(
@@ -55,6 +65,20 @@ impl Glue {
}
}
/// Her window's procedure: a press does not activate her window; all else is gpui's.
unsafe extern "system" fn inactive(
window: HWND,
message: u32,
wparam: WPARAM,
lparam: LPARAM,
) -> LRESULT {
if message == WM_MOUSEACTIVATE {
return MA_NOACTIVATE as LRESULT;
}
let gpui: WNDPROC = unsafe { std::mem::transmute(GPUI.load(Ordering::Relaxed)) };
unsafe { CallWindowProcW(gpui, window, message, wparam, lparam) }
}
/// The HWND gpui made for `window`.
fn native(window: &Window) -> anyhow::Result<HWND> {
let handle = HasWindowHandle::window_handle(window)
+16 -12
View File
@@ -1,14 +1,14 @@
//! Ely's window on X11: gpui's popup, which no window manager places, put on the main window's top edge and just above it.
use anyhow::{Context as _, bail};
use gpui::Window;
use gpui::{Bounds, Pixels, Window};
use raw_window_handle::{HasWindowHandle, RawWindowHandle};
use x11rb::{
protocol::xproto::{ConfigureWindowAux, ConnectionExt as _, StackMode},
rust_connection::RustConnection,
};
use super::{HEAD, LEFT, ROOM, top_inset};
use super::{HEAD, ROOM, left, pane};
/// Her X window, the main one, and a connection of her own to their server.
pub struct Glue {
@@ -29,21 +29,22 @@ impl Glue {
})
}
/// Stands her on the main window's pane, `LEFT` points in, stacked just above the main window's frame.
/// Stands her on the main window's pane, as far in as its width allows, stacked just above the main window's frame.
pub fn place(&self, main: &Window) -> anyhow::Result<()> {
self.put(main.scale_factor(), f32::from(top_inset(main)))
self.put(main.scale_factor(), pane(main))
}
/// Places her at `scale` over a pane `inset` points into the main window.
fn put(&self, scale: f32, inset: f32) -> anyhow::Result<()> {
/// Places her at `scale` over `pane`, in the main window's points.
fn put(&self, scale: f32, pane: Bounds<Pixels>) -> anyhow::Result<()> {
let (x, y) = (f32::from(pane.origin.x), f32::from(pane.origin.y));
let (root, frame) = self.frame()?;
let at = (self.connection)
.translate_coordinates(self.main, root, 0, 0)?
.reply()
.context("pet: the main window's place")?;
let aux = ConfigureWindowAux::new()
.x(i32::from(at.dst_x) + ((LEFT + inset) * scale).round() as i32)
.y(i32::from(at.dst_y) + ((inset - HEAD - ROOM) * scale).round() as i32)
.x(i32::from(at.dst_x) + ((x + left(pane.size.width)) * scale).round() as i32)
.y(i32::from(at.dst_y) + ((y - HEAD - ROOM) * scale).round() as i32)
.sibling(frame)
.stack_mode(StackMode::ABOVE);
(self.connection)
@@ -95,6 +96,8 @@ mod tests {
protocol::xproto::{CreateWindowAux, MapState, WindowClass},
};
use gpui::{point, px, size};
use super::*;
use crate::testx11::Xvfb;
@@ -146,7 +149,8 @@ mod tests {
pet,
main,
};
glue.put(2.0, 10.0).expect("she is placed");
let pane = Bounds::new(point(px(10.), px(10.)), size(px(380.), px(280.)));
glue.put(2.0, pane).expect("she is placed");
let check = x11rb::connect(Some(&xvfb.display))
.expect("the check connects")
.0;
@@ -155,11 +159,11 @@ mod tests {
.expect("the request")
.reply()
.expect("her place");
let left = (
100 + ((LEFT + 10.0) * 2.0).round() as i32,
let stands = (
100 + ((10.0 + left(px(380.))) * 2.0).round() as i32,
100 + ((10.0 - HEAD - ROOM) * 2.0).round() as i32,
);
assert_eq!((i32::from(at.x), i32::from(at.y)), left);
assert_eq!((i32::from(at.x), i32::from(at.y)), stands);
let order = check
.query_tree(root)
.expect("the request")
+1 -1
View File
@@ -84,7 +84,7 @@ What no check reached: no real KWin drew the blur; of Wayland desktops, only Hyp
| The pointer over the terminal is the arrow | T26 | the terminal sets no pointer, so gpui's arrow shows; on X11 with the pointer over the grid, gpui asked for no I-beam ("text"), which it had asked for, and failed to load under Xvfb, before | Pass |
| The title bar is transparent | T11, T19 | T19 review | Pass |
| Every title bar control takes its press, Ely's window buttons on Windows and Linux too | T26 | Ely `cdc5ce8`: `window_controls_occlude_what_lies_under` (each style; before, the box under Windows' caption buttons took the press), `a_wobbling_press_on_a_slot_moves_no_window` (before, the window moved), `a_wobbling_press_on_a_column_title_moves_the_window`; on the owner's PC, window messages asked the app for Windows' hit test along the title bar: v0.1.0 answered caption from end to end, T26's build answers client over the toggles and +, caption over the titles, min, max and close over Ely's buttons, and a press on close closed the app; the owner, given v0.1.1's build and these controls to click, reported it works on Windows | Pass |
| Ely peeks over the window's top edge from behind it; her face follows the sessions; a press pets her | T46 | `pet::look` tests: the most pressing mark sets her mood, calm blinks, glances and dozes, a finish cheers for 4 s, waiting and errors hold; `pet::faces` tests: every face parses at three times her box and shows its marks; `pet::x11` test under Xvfb: her window stands on the pane, just above the window manager's frame, and unmaps and maps with the main window; on macOS `shot` found her the main window's child, 112 by 124 points on its top edge 140 in, a capture of the screen showed her over the edge, and OSC 7501 reports gave her surprise, worry, eyes down and a cheer; Windows type-checks; Wayland's popup is gpui's own | Pass |
| Ely peeks over the window's top edge from behind it; her face follows the sessions; a press pets her | T46 | `pet::look` tests: the most pressing mark sets her mood, calm blinks, glances and dozes, a finish cheers for 4 s, waiting and errors hold; `pet::faces` tests: every face parses at three times her box and shows its marks; `pet::x11` test under Xvfb: her window stands on the pane, just above the window manager's frame, and unmaps and maps with the main window; on macOS `shot` found her the main window's child, 112 by 124 points on its top edge 140 in, a capture of the screen showed her over the edge, and OSC 7501 reports gave her surprise, worry, eyes down and a cheer; a press on her window left the main window key and every key typed before and after it reached the program; switched off and on during an error she came back worried; on a 100-point window she stood at its left edge, and moved, resized and minimized she followed it; Windows type-checks; Wayland's popup is gpui's own | Pass |
## 7. Sessions panel