From f0520471f7f18eca2e9630308c059ae6c6c4781f Mon Sep 17 00:00:00 2001 From: Matt Birkholz Date: Tue, 18 Dec 2012 17:47:25 -0700 Subject: [PATCH] Init a 's viewport size before it is realized. 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 | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/gtk/fix-layout.scm b/src/gtk/fix-layout.scm index ee2c01542..f5f8615d6 100644 --- a/src/gtk/fix-layout.scm +++ b/src/gtk/fix-layout.scm @@ -361,6 +361,7 @@ USA. (define-method initialize-instance ((widget ) width height) (call-next-method widget width height) (%trace "; (initialize-instance ) "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 )) (call-next-method widget) (%trace "; (fix-widget-realize-callback ) "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. -- 2.25.1