mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-03-16 12:03:03 -05:00

While re-testing on Wayland after all this churn of the window resizing code, I discovered that the window constantly came out a few pixels too small, losing a character cell in width and height. This stopped happening once I experimentally stopped setting geometry hints. Source-diving in GTK, it turns out that this is because the GDK Wayland backend is applying the geometry hints to the size of the window including 'margins', which are a very large extra space around a window beyond even the visible 'non-client-area' furniture like the title bar. And I have no idea how you find out the size of those margins, so I can't allow for them in the geometry hints. I also noticed that gtk_window_set_geometry_hints is removed in GTK 4, which suggests that GTK upstream are probably not interested in fiddling with them until they work more usefully (even if they would agree with me that this is a bug in the first place, which I have no idea). A simpler workaround is to avoid setting geometry hints at all on any GDK backend other than X11. So, that's what this commit does. On Wayland (or other backends), the window can now be resized a pixel at a time, and if its size doesn't work out to a whole number of character cells, then you just get some dead space at the edges. Not especially nice, but better than the alternatives I can see. One other job the geometry hints were doing was to forbid resizing if the backend sets the BACKEND_RESIZE_FORBIDDEN flag (which SUPDUP does). That's now done at window creation time, via gtk_window_set_resizable.