summaryrefslogtreecommitdiff
path: root/gui/gui.c
diff options
context:
space:
mode:
Diffstat (limited to 'gui/gui.c')
-rw-r--r--gui/gui.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/gui/gui.c b/gui/gui.c
index 0a0d2b5..2b3e001 100644
--- a/gui/gui.c
+++ b/gui/gui.c
@@ -424,6 +424,20 @@ static void get_history(struct gui_ctx *ctx, const char *sch_name, int limit)
}
+/* ----- Resizing ---------------------------------------------------------- */
+
+
+static void size_allocate_event(GtkWidget *widget, GdkRectangle *allocation,
+ gpointer data)
+{
+ struct gui_ctx *ctx = data;
+
+ zoom_to_extents(ctx);
+ if (ctx->mode == showing_index)
+ index_resize(ctx);
+}
+
+
/* ----- Initialization ---------------------------------------------------- */
@@ -475,6 +489,8 @@ int gui(const struct file_names *fn, bool recurse, int limit)
if (!ctx.new_hist)
fatal("no valid sheets\n");
+ g_signal_connect(G_OBJECT(ctx.da), "size_allocate",
+ G_CALLBACK(size_allocate_event), &ctx);
g_signal_connect(window, "destroy",
G_CALLBACK(gtk_main_quit), NULL);