mirror of
https://github.com/ghostty-org/ghostty.git
synced 2026-08-02 05:39:05 +00:00
fix: calculate cell size before presenting gtk window (#10459)
Fixes #7937 Added `computeInitialSize` to GTK `Surface` and call it in GTK `Application` before the first `present()`, so the window manager centers the correct size on initial show. The issue occurs because the core `Surface.recomputeInitialSize()` runs only after the renderer is initialized. In GTK, the `GLArea` isn’t realized until after `present()`, so the initial size arrives too late for WM centering. **Limitations**: when we precompute size before `present()` we do not have access to padding, so the sizing will be very slightly off... but since it is only off a few pixels I was unable to tell visually that it wasn't perfectly centered. **Other thoughts**: I was hesitant to make changes to core `Surface` because the issue is Linux-specific, but it may make sense to extract a helper from `recomputeInitialSize` to avoid duplicating the sizing math. **AI Disclosure:** I used AI to explore the project, help with any language / API questions (I've never used zig before and rarely use gtk), and make implementation suggestions.
This commit is contained in:
@@ -46,8 +46,8 @@ const Renderer = rendererpkg.Renderer;
|
||||
/// being resized to a size that is too small to be useful. These defaults
|
||||
/// are chosen to match the default size of Mac's Terminal.app, but is
|
||||
/// otherwise somewhat arbitrary.
|
||||
const min_window_width_cells: u32 = 10;
|
||||
const min_window_height_cells: u32 = 4;
|
||||
pub const min_window_width_cells: u32 = 10;
|
||||
pub const min_window_height_cells: u32 = 4;
|
||||
|
||||
/// The maximum number of key tables that can be active at any
|
||||
/// given time. `activate_key_table` calls after this are ignored.
|
||||
|
||||
Reference in New Issue
Block a user