Merge pull request #57: fix(ui): macOS traffic lights centered, fullscreen reclaims their space
@@ -347,7 +347,7 @@ impl CallWindows {
347
347
self.stage_opening = true;
348
348
let controller = cx.entity();
349
349
let app = self.app.clone();
350
let mut options = gpui_kit::component::TitleBar::window_options();
350
let mut options = crate::views::title_bar::window_options();
351
351
options.window_bounds = Some(WindowBounds::Windowed(Bounds::centered(
352
352
None,
353
353
size(px(CALL_WINDOW_SIZE.0), px(CALL_WINDOW_SIZE.1)),
@@ -347,7 +347,7 @@ impl CallWindows {347
self.stage_opening = true;347
self.stage_opening = true;348
let controller = cx.entity();348
let controller = cx.entity();349
let app = self.app.clone();349
let app = self.app.clone();350
let mut options = gpui_kit::component::TitleBar::window_options();350
let mut options = crate::views::title_bar::window_options();351
options.window_bounds = Some(WindowBounds::Windowed(Bounds::centered(351
options.window_bounds = Some(WindowBounds::Windowed(Bounds::centered(352
None,352
None,353
size(px(CALL_WINDOW_SIZE.0), px(CALL_WINDOW_SIZE.1)),353
size(px(CALL_WINDOW_SIZE.0), px(CALL_WINDOW_SIZE.1)),@@ -30,7 +30,6 @@ use std::sync::Arc;
30
30
use std::time::Duration;
31
31
32
32
use directories::ProjectDirs;
33
use gpui_kit::component::TitleBar;
34
33
use gpui_kit::*;
35
34
use store::Store;
36
35
@@ -163,7 +162,7 @@ fn transport(
163
162
164
163
fn main_window_options(cx: &App) -> WindowOptions {
165
164
let bounds = Bounds::centered(None, size(px(WINDOW_WIDTH), px(WINDOW_HEIGHT)), cx);
166
let mut options = TitleBar::window_options();
165
let mut options = views::title_bar::window_options();
167
166
options.window_bounds = Some(WindowBounds::Windowed(bounds));
168
167
options.window_min_size = Some(size(px(WINDOW_MIN_WIDTH), px(WINDOW_MIN_HEIGHT)));
169
168
options.app_id = Some(LINUX_APP_ID.to_owned());
@@ -30,7 +30,6 @@ use std::sync::Arc;30
use std::time::Duration;30
use std::time::Duration;31
31
32
use directories::ProjectDirs;32
use directories::ProjectDirs;33
use gpui_kit::component::TitleBar;34
use gpui_kit::*;33
use gpui_kit::*;35
use store::Store;34
use store::Store;36
35
@@ -163,7 +162,7 @@ fn transport(163
162
164
fn main_window_options(cx: &App) -> WindowOptions {163
fn main_window_options(cx: &App) -> WindowOptions {165
let bounds = Bounds::centered(None, size(px(WINDOW_WIDTH), px(WINDOW_HEIGHT)), cx);164
let bounds = Bounds::centered(None, size(px(WINDOW_WIDTH), px(WINDOW_HEIGHT)), cx);166
let mut options = TitleBar::window_options();165
let mut options = views::title_bar::window_options();167
options.window_bounds = Some(WindowBounds::Windowed(bounds));166
options.window_bounds = Some(WindowBounds::Windowed(bounds));168
options.window_min_size = Some(size(px(WINDOW_MIN_WIDTH), px(WINDOW_MIN_HEIGHT)));167
options.window_min_size = Some(size(px(WINDOW_MIN_WIDTH), px(WINDOW_MIN_HEIGHT)));169
options.app_id = Some(LINUX_APP_ID.to_owned());168
options.app_id = Some(LINUX_APP_ID.to_owned());@@ -21,6 +21,21 @@ const SHORTCUT_MIN_WIDTH: f32 = 200.;
21
21
const SEARCH_HINT: &str = "Search chats, people and channels";
22
22
const SHORTCUT_HINT: &str = "Ctrl K";
23
23
const APP_ICON_SIZE: f32 = 18.;
24
/// Frame of one macOS traffic light button (14 x 14 since macOS 26).
25
const TRAFFIC_LIGHT_SIZE: f32 = 14.;
26
const TRAFFIC_LIGHT_LEFT: f32 = 9.;
27
28
/// Base options for a window that renders a [`TitleBar`] of [`TITLE_BAR_HEIGHT`], with the macOS traffic lights centered in it.
29
pub fn window_options() -> WindowOptions {
30
let mut options = TitleBar::window_options();
31
if let Some(titlebar) = options.titlebar.as_mut() {
32
titlebar.traffic_light_position = Some(point(
33
px(TRAFFIC_LIGHT_LEFT),
34
px((TITLE_BAR_HEIGHT - TRAFFIC_LIGHT_SIZE) / 2.),
35
));
36
}
37
options
38
}
24
39
25
40
pub fn app_icon_image(app_icon: AppIcon) -> Arc<Image> {
26
41
static IMAGES: [OnceLock<Arc<Image>>; AppIcon::ALL.len()] =
@@ -21,6 +21,21 @@ const SHORTCUT_MIN_WIDTH: f32 = 200.;21
const SEARCH_HINT: &str = "Search chats, people and channels";21
const SEARCH_HINT: &str = "Search chats, people and channels";22
const SHORTCUT_HINT: &str = "Ctrl K";22
const SHORTCUT_HINT: &str = "Ctrl K";23
const APP_ICON_SIZE: f32 = 18.;23
const APP_ICON_SIZE: f32 = 18.;24
/// Frame of one macOS traffic light button (14 x 14 since macOS 26).25
const TRAFFIC_LIGHT_SIZE: f32 = 14.;26
const TRAFFIC_LIGHT_LEFT: f32 = 9.;27
28
/// Base options for a window that renders a [`TitleBar`] of [`TITLE_BAR_HEIGHT`], with the macOS traffic lights centered in it.29
pub fn window_options() -> WindowOptions {30
let mut options = TitleBar::window_options();31
if let Some(titlebar) = options.titlebar.as_mut() {32
titlebar.traffic_light_position = Some(point(33
px(TRAFFIC_LIGHT_LEFT),34
px((TITLE_BAR_HEIGHT - TRAFFIC_LIGHT_SIZE) / 2.),35
));36
}37
options38
}24
39
25
pub fn app_icon_image(app_icon: AppIcon) -> Arc<Image> {40
pub fn app_icon_image(app_icon: AppIcon) -> Arc<Image> {26
static IMAGES: [OnceLock<Arc<Image>>; AppIcon::ALL.len()] =41
static IMAGES: [OnceLock<Arc<Image>>; AppIcon::ALL.len()] =@@ -16,3 +16,4 @@ Upstream: crates.io `gpui-component 0.7.1`. Wired in via `[patch.crates-io]` in
16
16
| `src/tooltip.rs` | managed tooltip requests carry a liveness token from the trigger's element state (`while_alive`); `TOOLTIP_DEBUG_SELECTOR` on `Tooltip` | a tooltip closes when its trigger is no longer rendered (e.g. "Jump to newest" after the button vanished); tests find tooltips |
17
17
| `src/message_scroller.rs` | `wheel_mask(bool)` builder, default on; off skips the `ScrollableMask` child | the mask scrolls the list in the capture phase, so an editor inside a row (channel thread reply) never got the wheel |
18
18
| `src/message_scroller.rs` | `MessageScrollerState::item_bounds(index)` | the typing bubble sits right under the last row and sticks above the composer once that row scrolls away |
19
| `src/title_bar.rs` | no `TITLE_BAR_LEFT_PADDING` in fullscreen | macOS hides the traffic lights in fullscreen, the 80px inset left an empty gap before the title bar content |
@@ -16,3 +16,4 @@ Upstream: crates.io `gpui-component 0.7.1`. Wired in via `[patch.crates-io]` in16
| `src/tooltip.rs` | managed tooltip requests carry a liveness token from the trigger's element state (`while_alive`); `TOOLTIP_DEBUG_SELECTOR` on `Tooltip` | a tooltip closes when its trigger is no longer rendered (e.g. "Jump to newest" after the button vanished); tests find tooltips |16
| `src/tooltip.rs` | managed tooltip requests carry a liveness token from the trigger's element state (`while_alive`); `TOOLTIP_DEBUG_SELECTOR` on `Tooltip` | a tooltip closes when its trigger is no longer rendered (e.g. "Jump to newest" after the button vanished); tests find tooltips |17
| `src/message_scroller.rs` | `wheel_mask(bool)` builder, default on; off skips the `ScrollableMask` child | the mask scrolls the list in the capture phase, so an editor inside a row (channel thread reply) never got the wheel |17
| `src/message_scroller.rs` | `wheel_mask(bool)` builder, default on; off skips the `ScrollableMask` child | the mask scrolls the list in the capture phase, so an editor inside a row (channel thread reply) never got the wheel |18
| `src/message_scroller.rs` | `MessageScrollerState::item_bounds(index)` | the typing bubble sits right under the last row and sticks above the composer once that row scrolls away |18
| `src/message_scroller.rs` | `MessageScrollerState::item_bounds(index)` | the typing bubble sits right under the last row and sticks above the composer once that row scrolls away |19
| `src/title_bar.rs` | no `TITLE_BAR_LEFT_PADDING` in fullscreen | macOS hides the traffic lights in fullscreen, the 80px inset left an empty gap before the title bar content |@@ -335,7 +335,8 @@ impl RenderOnce for TitleBar {
335
335
.items_center()
336
336
.justify_between()
337
337
.h(TITLE_BAR_HEIGHT)
338
.pl(TITLE_BAR_LEFT_PADDING)
338
// The macOS traffic lights are hidden in fullscreen, so their inset goes too.
339
.when(!window.is_fullscreen(), |this| this.pl(TITLE_BAR_LEFT_PADDING))
339
340
.border_b_1()
340
341
.border_color(cx.theme().title_bar_border)
341
342
.bg(default_title_bar_background(
@@ -335,7 +335,8 @@ impl RenderOnce for TitleBar {335
.items_center()335
.items_center()336
.justify_between()336
.justify_between()337
.h(TITLE_BAR_HEIGHT)337
.h(TITLE_BAR_HEIGHT)338
.pl(TITLE_BAR_LEFT_PADDING)338
// The macOS traffic lights are hidden in fullscreen, so their inset goes too.339
.when(!window.is_fullscreen(), |this| this.pl(TITLE_BAR_LEFT_PADDING))339
.border_b_1()340
.border_b_1()340
.border_color(cx.theme().title_bar_border)341
.border_color(cx.theme().title_bar_border)341
.bg(default_title_bar_background(342
.bg(default_title_bar_background(