fix(host-linux): send physical pixels to ghostty_surface_set_size#95
Open
tnfssc wants to merge 1 commit into
Open
fix(host-linux): send physical pixels to ghostty_surface_set_size#95tnfssc wants to merge 1 commit into
tnfssc wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Updates Ghostty surface sizing to use device-pixel dimensions in GTK GLArea, including explicit refreshes on scale-factor changes to keep rendering crisp under HiDPI / fractional scaling scenarios.
Changes:
- Refactors
refresh_surface_displayto accept explicit width/height (device pixels) instead of readingGLAreaallocation internally. - Computes device-pixel size using allocation × scale factor for initial realization and realized refresh paths.
- Adds a
scale-factornotify handler to refresh Ghostty’s content scale/size when only the backing pixel density changes.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
GLArea::allocation() returns CSS/logical pixels, but ghostty_surface_set_size expects physical device pixels. On HiDPI screens this caused the terminal to render at a fraction of the GL viewport or with a zero-size grid. Changes: - Introduce gl_area_device_size() helper to convert logical allocation to device pixels (allocation * scale_factor). - Use explicit device_width/device_height parameter names in refresh_surface_display and add rustdoc to prevent accidental logical-pixel usage. - Add connect_scale_factor_notify handler with a last-device-size cache to avoid redundant refresh/render cycles when the notify fires without an actual size change.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes terminal sizing on HiDPI / fractional-scale displays.
Problem
returns CSS/logical pixels, but expects physical device pixels. On screens with scale factor > 1 (e.g. laptops, fractional scaling) this caused:
Fix