-
Notifications
You must be signed in to change notification settings - Fork 689
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
gtk: flickering on resize #2446
Comments
This is specific to Linux and I'm not entirely sure how to resolve it. On macOS we have a "content gravity" API that informs Cocoa/AppKit how to handle the Metal surface during resize (stretch, no stretch, etc) and so we can use that to handle the drawing state between resizes and redraws. I'm not aware of an equivalent in GTK4. Fundamentally, the issue is probably related to the fact that our terminal IO and rendering happen on different threads, so from a live resize => termio/pty update => renderer redraw it could be taking more than 1 frame and causing jitter like this. The content gravity work on macOS papers over this. Synchronously doing a terminal state resize AND redraw on live resize seems too expensive, specifically the terminal state part. What we probably want to do is do a synchronize renderer frame update with the new viewport size but old grid size to artificially create our content gravity effect. Or, maybe this isn't the problem at all. |
Possibly related: on fast resize caused by re-tiling of a tiling WM, ghostty looks “stretched” while resizing. recording.mp4 |
On MacOS. I also get flickering on resize. Could be a different cause of reason. On video, Alacritty, Ghostty and iTerm2 |
Hopefully, this flickering will be removed anytime. Konsole, Gnome Terminal, Ptyxis doesn't flicker. I found other pretty big visual bug while resizing, but that might be for other issue. |
I observed the same behavior on Gnome (flickering due to the image being temporarily stretched by Gnome window manager before Ghostty redraws the window very soon after). And indeed as mentioned above this does not happen with gnome-terminal. Interestingly, gnome-terminal behavior on resize is that resize isn't continuous: the window "snaps to grid", i.e. even with a smooth window corner drag, it increases only by discrete increments corresponding to the terminal character size. 2025-01-02.22-19-40.mp4This naturally avoids any kind of flickering that could arise if window content had to continuously follow the drag. Ghostty actually seems to have the ability to resize with discrete increments: If |
If it can help, the ways this is done in gnome-terminal/GTK via libvte is that it sets the |
@tmmorin Beware, VTE is GPL so we have to be careful about looking at their source. You can describe what they do but I edited your comment to remove the link. |
gnome-console, the replacement for gnome-terminal, does not have this discrete stepping behavior. It resizes pixel-by-pixel. The same is true for tilix (another terminal designed for gnome). Neither of them have this flickering issue. |
I intended to point out that But yes, adopting the same behavior would certainly be the best. |
|
flicker.mp4
ghostty version: 0.1.0-main+9d341a9f
Built from source with
zig build -p $HOME/.local -Doptimize=ReleaseFast
.Operating System: Fedora Linux 40
KDE Plasma Version: 6.2.0
KDE Frameworks Version: 6.7.0
Qt Version: 6.7.2
Kernel Version: 6.10.12-200.fc40.x86_64 (64-bit)
Graphics Platform: Wayland
Processors: 24 × AMD Ryzen 9 5900X 12-Core Processor
Memory: 62,7 GiB of RAM
Graphics Processor: AMD Radeon RX 6600
Manufacturer: Micro-Star International Co., Ltd.
Product Name: MS-7B93
System Version: 1.0
The text was updated successfully, but these errors were encountered: