Re: Detecting a resize
- From: Hans Oesterholt-Dijkema <hdnews gawab com>
- To: Daniel Kasak <dan entropy homelinux org>
- Cc: "gtk-list gnome org" <gtk-list gnome org>
- Subject: Re: Detecting a resize
- Date: Fri, 20 Oct 2006 23:04:02 +0200
So, this is how you can do this trick with the timer event in mzgtk2:
Given the object variables _redraw, _sa-w and _sa-h and the function
_last-zoom, which does the proper zooming depending on the last type
of zooming (zoom 100%, zoom to fit, etc.):
   (define (handle-size-allocation widget x y w h)
     (set! _redraw (+ _redraw 1))
     (if (> _redraw 10000) (set! _redraw 0))
     (if (not (and (= _sa-w w) (= _sa-h h)))
         (let ((r _redraw))
           (mzgtk2-timer-add 500 (lambda ()
                                   (if (= _redraw r) (_last-zoom))
                                   (set! _sa-w w)
                                   (set! _sa-h h)
                                   #f))))))
It's that simple.
--Hans
[
Date Prev][
Date Next]   [
Thread Prev][
Thread Next]   
[
Thread Index]
[
Date Index]
[
Author Index]