-
Notifications
You must be signed in to change notification settings - Fork 700
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: add resize overlay #2071
gtk: add resize overlay #2071
Conversation
This adds a transient overlay that shows the size of the surface while you are resizing the window or the surfaces.
I think the default should be Also, it'd be nice to have the option to turn off pixel dimentions. Those are rarely interesting. |
The other terminals that I've checked (admittedly not many) were a mixed bag. XTerm, Kitty, Gnome Console, Ptyxis have them on by default. Gnome Terminal didn't. Alacritty, Foot, and Wezterm didn't allow resizing the window by mouse and I was too lazy to figure out why or to look and see if they had a keybind for resizing the window. So the default is really a matter of taste. I like having them on, but if there's a consensus to have them off by default I'm OK with that as I can easily change it on my config. Having the pixel dimensions I thought was fun but I'm OK turning them off. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really awesome. I didn't dig into the GTK APIs but did a high level review with some requests but this is exciting to see!
I noted in my review I think it should be |
Change the default to `after-first` and change `resize-overlay-delay` → `resize-overlay-duration`.
Keepin´ the code clean by gathering all of the resize overlay related data and code into a struct.
// When updating a widget, do so from GTK's thread, but not if there's | ||
// already an update queued up. | ||
if (self.idler != null) return; | ||
self.idler = c.g_idle_add(gtkUpdateOverlayWidget, @ptrCast(self)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Won't this function only ever be called from the main GTK thread? Do we need this at all, can we call gtkUpdateOverlayWidget
directly?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried that at first, but I got dozens of warnings being spit out by GTK while resizing and the overlay flickered horribly. Doing some searching indicated that it was caused because I was manipulating a GTK widget wrongly and putting the code behind g_idle_add was the way to fix it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's so interesting. I wonder if its because modifying a widget in the widget tree while its being actively resized is a bad idea...
This adds a transient overlay that shows the size of the surface while you are resizing the window or the surfaces.
Screencast.from.2024-08-09.21-20-20.webm