1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-10 01:48:00 +00:00

GTK: fix junk in window margin with fixed-size windows.

When the window can't be resized for any reason, there will be extra
space inside the drawing area that's not part of our standard
width*font_width+2*window_border. We should include that in the
backing surface and make sure we erase it to the background colour,
otherwise it can end up containing unwanted visual junk.

An example is the same case described in the previous commit: maximise
the window and then start playing about with the font size. If you do
this while running a full-screen application that displays text in the
bottom line, it's easy to see that part of the previous display is
left over and not cleared when the new font size leaves more space at
the bottom than the old one.
This commit is contained in:
Simon Tatham 2022-02-03 17:56:38 +00:00
parent 1e98710174
commit 9427f9699d

View File

@ -736,10 +736,8 @@ static void drawing_area_setup(GtkFrontend *inst, int width, int height)
new_scale = 1;
#endif
int new_backing_w = w * inst->font_width + 2*inst->window_border;
int new_backing_h = h * inst->font_height + 2*inst->window_border;
new_backing_w *= new_scale;
new_backing_h *= new_scale;
int new_backing_w = width * new_scale;
int new_backing_h = height * new_scale;
if (inst->backing_w != new_backing_w || inst->backing_h != new_backing_h)
inst->drawing_area_setup_needed = true;
@ -3754,16 +3752,12 @@ static void draw_stretch_after(GtkFrontend *inst, int x, int y,
static void draw_backing_rect(GtkFrontend *inst)
{
int w, h;
if (!win_setup_draw_ctx(&inst->termwin))
return;
w = inst->width * inst->font_width + 2*inst->window_border;
h = inst->height * inst->font_height + 2*inst->window_border;
draw_set_colour(inst, 258, false);
draw_rectangle(inst, true, 0, 0, w, h);
draw_update(inst, 0, 0, w, h);
draw_rectangle(inst, true, 0, 0, inst->backing_w, inst->backing_h);
draw_update(inst, 0, 0, inst->backing_w, inst->backing_h);
win_free_draw_ctx(&inst->termwin);
}