From 9b81d0852546a931b751920bfa843d1be322ebf4 Mon Sep 17 00:00:00 2001 From: Werner Almesberger Date: Wed, 3 Aug 2016 13:15:25 -0300 Subject: [PATCH] eeshow/gui.c: also zoom to extents when resizing the window --- eeshow/gui.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/eeshow/gui.c b/eeshow/gui.c index 54eb88f..88d4341 100644 --- a/eeshow/gui.c +++ b/eeshow/gui.c @@ -385,6 +385,15 @@ static gboolean scroll_event(GtkWidget *widget, GdkEventScroll *event, } +static void size_allocate_event(GtkWidget *widget, GdkRectangle *allocation, + gpointer data) +{ + struct gui_ctx *ctx = data; + + zoom_to_extents(ctx); +} + + /* ----- AoI callbacks ----------------------------------------------------- */ @@ -483,6 +492,9 @@ int gui(const struct sheet *sheets) G_CALLBACK(scroll_event), &ctx); g_signal_connect(G_OBJECT(ctx.da), "key_press_event", G_CALLBACK(key_press_event), &ctx); + 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);