From d63b786f6cb0cb9bc3e3e92b80ff016434030882 Mon Sep 17 00:00:00 2001 From: Matt Birkholz Date: Thu, 30 Aug 2012 12:04:08 -0700 Subject: [PATCH] gtk: The return value from draw signal handlers is ignored. Also fixed a missing argument to gtk_adjustment_set_lower, and tried to make peek-gtk-adjustment more helpful. --- doc/gtk/gtk.texinfo | 3 --- src/gtk/fix-layout.scm | 6 ++---- src/gtk/gtk-widget.scm | 29 ++++++++++++++--------------- 3 files changed, 16 insertions(+), 22 deletions(-) diff --git a/doc/gtk/gtk.texinfo b/doc/gtk/gtk.texinfo index 1cc206037..7dec4120b 100644 --- a/doc/gtk/gtk.texinfo +++ b/doc/gtk/gtk.texinfo @@ -962,9 +962,6 @@ closure, else it cannot be GCed. @deffn Procedure set-gtk-widget-draw-callback! widget callback Arranges for @var{callback} to be applied to @var{widget} and a cairo context clipped to the area to be re-drawn. -@var{Callback} should return @code{#t} or @code{#f} to indicate -whether the @code{"draw"} signal has been handled(?), else a warning -is issued. @end deffn @deffn Procedure set-gtk-widget-event-callback! widget callback diff --git a/src/gtk/fix-layout.scm b/src/gtk/fix-layout.scm index 17717b5db..fc3b123c1 100644 --- a/src/gtk/fix-layout.scm +++ b/src/gtk/fix-layout.scm @@ -416,8 +416,7 @@ USA. (C-call "cairo_restore" cr)))) (fix-drawing-display-list drawing))) (%trace2 ";draw area "x","y" "w"x"h - " of "layout" (no drawing!).\n")) - #t))))) + " of "layout" (no drawing!).\n"))))))) (define (set-fix-layout-scroll-size! widget width height) ;; Tells WIDGET to adjust its scrollable extent. Notifies any @@ -713,8 +712,7 @@ USA. (C-call "gtk_render_handle" style cr 0. 0. (->flonum (fix-rect-width geom)) - (->flonum (fix-rect-height geom))) - #t)) + (->flonum (fix-rect-height geom))))) (define (resizer-enter-handler resizer) (%trace ";resizer-enter-handler\n") diff --git a/src/gtk/gtk-widget.scm b/src/gtk/gtk-widget.scm index dc43c6dc6..3cf96294c 100644 --- a/src/gtk/gtk-widget.scm +++ b/src/gtk/gtk-widget.scm @@ -57,14 +57,14 @@ USA. (old-step-incr (f->e (C-call "gtk_adjustment_get_step_increment" alien))) (old-page-incr (f->e (C-call "gtk_adjustment_get_page_increment" alien)))) (if (not (int:= new-lower old-lower)) - (C-call "gtk_adjustment_set_lower" (->flonum new-lower))) + (C-call "gtk_adjustment_set_lower" alien (->flonum new-lower))) (if (not (int:= new-upper old-upper)) (C-call "gtk_adjustment_set_upper" alien (->flonum new-upper))) (if (not (int:= new-value old-value)) (C-call "gtk_adjustment_set_value" alien (->flonum new-value))) (if (not (int:= new-page-size old-page-size)) - (C-call "gtk_adjustment_set_page_size" - alien (->flonum new-page-size))) + (C-call "gtk_adjustment_set_page_size" alien (->flonum + new-page-size))) (if (not (int:= new-step-incr old-step-incr)) (C-call "gtk_adjustment_set_step_increment" alien (->flonum new-step-incr))) @@ -82,13 +82,14 @@ USA. (define (peek-gtk-adjustment adjustment) ;; For debugging... - (list - (C-call "gtk_adjustment_get_lower" adjustment) - (C-call "gtk_adjustment_get_upper" adjustment) - (C-call "gtk_adjustment_get_value" adjustment) - (C-call "gtk_adjustment_get_page_size" adjustment) - (C-call "gtk_adjustment_get_step_increment" adjustment) - (C-call "gtk_adjustment_get_page_increment" adjustment))) + (let ((alien (gobject-alien adjustment))) + (list + 'lower (C-call "gtk_adjustment_get_lower" alien) + 'upper (C-call "gtk_adjustment_get_upper" alien) + 'value (C-call "gtk_adjustment_get_value" alien) + 'page-size (C-call "gtk_adjustment_get_page_size" alien) + 'step-increment (C-call "gtk_adjustment_get_step_increment" alien) + 'page-increment (C-call "gtk_adjustment_get_page_increment" alien)))) ;;; GtkWidgets @@ -242,11 +243,9 @@ USA. (define (make-draw-callback callback) (named-lambda (draw-callback widget cr) - (let ((handled? (callback widget cr))) - (cond ((eq? handled? #t) 1) - ((eq? handled? #f) 0) - (else (warn "Draw callback not boolean:" callback) - 0))))) + (callback widget cr) + ;; This is ignored in _gtk_widget_draw_internal: + 1)) (define (set-gtk-widget-event-callback! widget callback) (guarantee-gtk-widget widget 'set-gtk-widget-event-callback!) -- 2.25.1