From b0fcb9d96c1719d1841294dc76f81893c600ace9 Mon Sep 17 00:00:00 2001 From: Jim Evins Date: Sat, 26 Dec 2009 12:34:00 -0500 Subject: [PATCH] Handle zoom-to-fit properly for unrealized view Delay calculations in gl_view_zoom_to_fit() if window has not been realized yet. Do calculations in realize callback. --- src/view.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/view.c b/src/view.c index 6e742f67..064576d5 100644 --- a/src/view.c +++ b/src/view.c @@ -548,6 +548,11 @@ realize_cb (glView *view) gl_debug (DEBUG_VIEW, "START"); + if (view->zoom_to_fit_flag) { + /* Maintain best fit zoom */ + gl_view_zoom_to_fit (view); + } + gl_debug (DEBUG_VIEW, "END"); } @@ -1170,7 +1175,8 @@ gl_view_zoom_to_fit (glView *view) gl_debug (DEBUG_VIEW, ""); if ( ! gtk_widget_get_window (GTK_WIDGET (view)) ) { - set_zoom_real (view, 1.0, TRUE); + /* Delay until realized. */ + view->zoom_to_fit_flag = TRUE; return; } -- 2.39.5