Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ png = { version = "0.18", optional = true }
[target.'cfg(target_os = "macos")'.dependencies]
# muda builds the menu bar, and objc2-app-kit's NSAlert backs `window.confirm`.
objc2 = "0.6"
objc2-app-kit = { version = "0.3", default-features = false, features = ["std", "NSAlert", "NSApplication", "NSButton", "NSControl", "NSResponder", "NSView"] }
objc2-app-kit = { version = "0.3", default-features = false, features = ["std", "NSAlert", "NSApplication", "NSButton", "NSControl", "NSResponder", "NSView", "NSWindow"] }
objc2-foundation = { version = "0.3", default-features = false, features = ["std", "NSString"] }
muda = "0.20"
# `window.confirm` panel added to wry's WKUIDelegate (src/commands/app.rs).
Expand Down
30 changes: 29 additions & 1 deletion src/commands/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1058,6 +1058,11 @@ mod imp {
sync_maximized(&webview, page_maximized);
}
#[cfg(target_os = "macos")]
Event::WindowEvent {
event: WindowEvent::Resized(_),
..
} => align_traffic_lights(&window, zoom_percent),
#[cfg(target_os = "macos")]
Event::UserEvent(UserEvent::Menu(id)) if id == quit_item.id() => {
begin_quit(&mut quit, &window, &webview, control_flow);
}
Expand Down Expand Up @@ -1256,11 +1261,34 @@ mod imp {

#[cfg(target_os = "macos")]
fn align_traffic_lights(window: &Window, percent: i32) {
use objc2_app_kit::{NSWindow, NSWindowButton};
use objc2_foundation::NSPoint;
use tao::dpi::LogicalPosition;
use tao::platform::macos::WindowExtMacOS;

let zoom = (f64::from(percent) / 100.0).max(1.0);
window.set_traffic_light_inset(LogicalPosition::new(16.0, 22.0 + 20.0 * (zoom - 1.0)));
// Tao owns this window for the duration of the main-thread event.
let native_window = unsafe { &*window.ns_window().cast::<NSWindow>() };
let inset = native_window
.standardWindowButton(NSWindowButton::CloseButton)
.and_then(|button| {
let container = unsafe { button.superview()?.superview()? };
let bounds = button.bounds();
let center = button.convertPoint_toView(
NSPoint::new(
bounds.origin.x + bounds.size.width / 2.0,
bounds.origin.y + bounds.size.height / 2.0,
),
None,
);
let current = native_window.frame().size.height - center.y;
Some(
container.frame().size.height - button.frame().size.height + 20.0 * zoom
- current,
)
})
.unwrap_or(22.0 + 20.0 * (zoom - 1.0));
window.set_traffic_light_inset(LogicalPosition::new(16.0, inset));
// Tao reapplies the inset on a title change, not on request_redraw.
window.set_title(&window.title());
}
Expand Down
2 changes: 1 addition & 1 deletion ui/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1815,7 +1815,7 @@ export default function App({ runtime, projectId, pane }: { runtime: RuntimeInfo

return (
<div className="app relative flex flex-col h-full">
{projectId && <div className="absolute start-[calc(5.15rem/min(1,var(--desktop-page-zoom,1)))] top-[calc(-0.125rem/min(1,var(--desktop-page-zoom,1)))] z-10 hidden h-titlebar items-center mac-titlebar:flex">
{projectId && <div className="absolute start-[calc(5.15rem/min(1,var(--desktop-page-zoom,1)))] top-[calc(-2px/min(1,var(--desktop-page-zoom,1)))] z-10 hidden h-[calc(44px/min(1,var(--desktop-page-zoom,1)))] items-center mac-titlebar:flex">

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Titlebar height is duplicated

The new arbitrary height replaces h-titlebar with the same calculation in pixels. AGENTS.md requires using existing project utilities instead of arbitrary values. Keep h-titlebar; if the titlebar must use pixels, update the shared theme value so its other users stay consistent. This repository requirement must be satisfied before merging.

Suggested change
{projectId && <div className="absolute start-[calc(5.15rem/min(1,var(--desktop-page-zoom,1)))] top-[calc(-2px/min(1,var(--desktop-page-zoom,1)))] z-10 hidden h-[calc(44px/min(1,var(--desktop-page-zoom,1)))] items-center mac-titlebar:flex">
{projectId && <div className="absolute start-[calc(5.15rem/min(1,var(--desktop-page-zoom,1)))] top-[calc(-2px/min(1,var(--desktop-page-zoom,1)))] z-10 hidden h-titlebar items-center mac-titlebar:flex">

Context Used: AGENTS.md (source)

Prompt To Fix With AI
This is a comment left during a code review.
Path: ui/src/App.tsx
Line: 1818

Comment:
**Titlebar height is duplicated**

The new arbitrary height replaces `h-titlebar` with the same calculation in pixels. `AGENTS.md` requires using existing project utilities instead of arbitrary values. Keep `h-titlebar`; if the titlebar must use pixels, update the shared theme value so its other users stay consistent. This repository requirement must be satisfied before merging.

```suggestion
      {projectId && <div className="absolute start-[calc(5.15rem/min(1,var(--desktop-page-zoom,1)))] top-[calc(-2px/min(1,var(--desktop-page-zoom,1)))] z-10 hidden h-titlebar items-center mac-titlebar:flex">
```

**Context Used:** AGENTS.md ([source](https://github.com/alphaxiv/openresearch/blob/main/AGENTS.md))

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

<Tooltip interactive content={railVisible ? m.header_hide_sidebar() : m.chat_panel_show_sidebar()} className="rounded-md">
<IconButton aria-label={railVisible ? m.header_hide_sidebar() : m.chat_panel_show_sidebar()} aria-expanded={railVisible} onClick={() => {
if (railVisible) setRailOpen(false);
Expand Down
Loading