Init a <fix-layout>'s viewport size before it is realized.
authorMatt Birkholz <matt@birkholz.chandler.az.us>
Wed, 19 Dec 2012 00:47:25 +0000 (17:47 -0700)
committerMatt Birkholz <matt@birkholz.chandler.az.us>
Wed, 19 Dec 2012 00:47:25 +0000 (17:47 -0700)
Punt redundant code in the realize callback.  Initializing the size
early allows the view (scroll position) to be set whether the widget
is realized or not.

src/gtk/fix-layout.scm

index ee2c01542abd97cdc4845841448ba47dc1b7c83f..f5f8615d62e62c51682c15c7d5fa8f79b706c104 100644 (file)
@@ -361,6 +361,7 @@ USA.
 (define-method initialize-instance ((widget <fix-layout>) width height)
   (call-next-method widget width height)
   (%trace "; (initialize-instance <fix-layout>) "widget" "width"x"height"\n")
+  (set-fix-rect! (fix-layout-view widget) 0 0 width height)
   (set-gtk-widget-draw-callback! widget layout-draw-callback)
   (set-scm-widget-set-scroll-adjustments-callback! widget adjustments-callback)
   (C-call "gtk_widget_set_can_focus" (gobject-alien widget) 1)
@@ -552,10 +553,6 @@ USA.
 (define-method fix-widget-realize-callback ((widget <fix-layout>))
   (call-next-method widget)
   (%trace "; (fix-widget-realize-callback <fix-layout>) "widget"\n")
-  (let ((geom (fix-widget-geometry widget)))
-    (set-fix-rect! (fix-layout-view widget)
-                  0 0
-                  (fix-rect-width geom) (fix-rect-height geom)))
   (adjust-adjustments widget))
 
 (define (adjustments-callback widget hGtkAdjustment vGtkAdjustment)
@@ -644,9 +641,9 @@ USA.
                    (high (fix:+ (fix-rect-low extent) extent-size))
                    (page-size view-size)
                    (page-incr (fix:max 1 (fix:- view-size step-incr))))
-               (%trace ";  large-drawing:"extent" view:"view"\n")
+               (%trace2 ";  large-drawing:"extent" view:"view"\n")
                (let ((value (clamped-value! low (fix:- high page-size))))
-                 (%trace ";  adjustment: "low" "value" "high" "page-size"\n")
+                 (%trace2 ";  adjustment: "low" "value" "high" "page-size"\n")
                  (set-gtk-adjustment! adj value low high
                                       page-size step-incr page-incr)))
              ;; Viewport is larger than drawing: thumb (page) is drawing.