]> git.sur5r.net Git - glabels/commitdiff
Handle zoom-to-fit properly for unrealized view
authorJim Evins <evins@snaught.com>
Sat, 26 Dec 2009 17:34:00 +0000 (12:34 -0500)
committerJim Evins <evins@snaught.com>
Sat, 26 Dec 2009 17:34:00 +0000 (12:34 -0500)
Delay calculations in gl_view_zoom_to_fit() if window has not been realized
yet.  Do calculations in realize callback.

src/view.c

index 6e742f67b6ec66d8d03d273b1a5045b54271aca1..064576d5a0ae48fcedd8130f10c361a417bcde89 100644 (file)
@@ -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;
        }