1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-05-10 06:02:10 -05:00

GTK: disable GTK double-buffering of terminal drawing area

By default, when we're asked to draw a GTK widget, GTK creates a
temporary surface (a Pixmap under X) and redirects our rendering into
that.  Then it blits that into the actual window.  This is silly for
PuTTY because all that PuTTY does to render its drawing area is to
blit into it from _another_ surface.  So now PuTTY asks GTK not to do
that.  According to the GTK documentation, GTK as of 3.10 has
completely restructured its drawing routines so that turning off
double-buffering actually makes things worse and slower, so we turn it
off only in GTK 2

Still, this now means that painting text on the screen in GTK 2 causes
precisely one CopyArea operation, which is what we want.
This commit is contained in:
Ben Harris 2025-04-20 12:32:50 +01:00
parent 1ebca75a89
commit 8260ea2237

View File

@ -5356,6 +5356,15 @@ void new_session_window(Conf *conf, const char *geometry_string)
inst->area = gtk_drawing_area_new(); inst->area = gtk_drawing_area_new();
gtk_widget_set_name(GTK_WIDGET(inst->area), "drawing-area"); gtk_widget_set_name(GTK_WIDGET(inst->area), "drawing-area");
#if !GTK_CHECK_VERSION(3,0,0)
/*
* PuTTY does its own double-buffering, so we don't really need
* GTK to do it as well. GTK documentation says this is probably
* a bad idea from GTK 3.10 onwards, and it's officially
* deprecated from 3.14. But it definitely helps in GTK 2.
*/
gtk_widget_set_double_buffered(GTK_WIDGET(inst->area), false);
#endif
/* /*
* Try to create the fonts for use in the window. If this fails, * Try to create the fonts for use in the window. If this fails,