1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-27 18:22:24 +00:00

gtkwin: factor out drawing_area_setup_simple().

I'm about to want to do this operation from more places, so here's a
minor NFC refactoring that will simplify the next commit.
This commit is contained in:
Simon Tatham 2018-05-11 09:00:46 +01:00
parent b72f0baed6
commit 1ca03a186f

View File

@ -699,13 +699,14 @@ static void drawing_area_setup(struct gui_data *inst, int width, int height)
#endif #endif
} }
static void area_realised(GtkWidget *widget, gpointer data) static void drawing_area_setup_simple(struct gui_data *inst)
{ {
struct gui_data *inst = (struct gui_data *)data; /*
* Wrapper on drawing_area_setup which fetches the width and
inst->drawing_area_realised = TRUE; * height of the drawing area. We go directly to the inner version
if (inst->drawing_area_realised && inst->drawing_area_got_size && * in the case where a new size allocation comes in (just in case
!inst->drawing_area_setup_done) { * GTK hasn't installed it in the normal place yet).
*/
#if GTK_CHECK_VERSION(2,0,0) #if GTK_CHECK_VERSION(2,0,0)
GdkRectangle alloc; GdkRectangle alloc;
gtk_widget_get_allocation(inst->area, &alloc); gtk_widget_get_allocation(inst->area, &alloc);
@ -713,7 +714,16 @@ static void area_realised(GtkWidget *widget, gpointer data)
GtkAllocation alloc = inst->area->allocation; GtkAllocation alloc = inst->area->allocation;
#endif #endif
drawing_area_setup(inst, alloc.width, alloc.height); drawing_area_setup(inst, alloc.width, alloc.height);
} }
static void area_realised(GtkWidget *widget, gpointer data)
{
struct gui_data *inst = (struct gui_data *)data;
inst->drawing_area_realised = TRUE;
if (inst->drawing_area_realised && inst->drawing_area_got_size &&
!inst->drawing_area_setup_done)
drawing_area_setup_simple(inst);
} }
static void area_size_allocate( static void area_size_allocate(