[mcclim-devel] Redisplay and pixmaps
Sascha Wilde
wilde at sha-bang.de
Mon Aug 11 09:19:43 UTC 2008
Hi *,
I'm new to CLIM and currently looking for a good (and simple) way to
redisplay a rendered picture (my toy program is an mandelbrot
generator).
My problem is, that the :display-function which in my case simply copies
a pixmap to the application pane is less often called than actual
redisplay is needed.
Given the following simple example code:
--8<---------------cut here---------------start------------->8---
(in-package :common-lisp-user)
(defpackage "APP"
(:use :clim :clim-lisp)
(:export "APP-MAIN"))
(in-package :app)
(define-application-frame superapp ()
((gfx :initform nil :accessor gfx)
(redisplay-counter :initform 0 :accessor redisplaynr))
(:pointer-documentation t)
(:panes
(app :application :display-function #'redraw-gfx
:height 400 :width 600)
(int :interactor :height 400 :width 600))
(:layouts
(default (vertically () app int))))
(define-superapp-command (com-draw :name t) ()
(setf (gfx *application-frame*)
(allocate-pixmap (frame-standard-output *application-frame*)
600 400))
(draw-line* (gfx *application-frame*) 0 0 599 399 :ink +red+))
(defun redraw-gfx (frame pane)
(if (gfx frame)
(progn (copy-from-pixmap (gfx frame) 0 0 600 400 pane 10 10)
(format pane "Redisplay #~a" (incf (redisplaynr frame))))
(format pane "No pic yet...")))
(defun app-main ()
(run-frame-top-level (make-application-frame 'superapp)))
--8<---------------cut here---------------end--------------->8---
Run and issue the command "Draw", ok now the pixmap is displayed. But
when a part of the frame is obscured by another window after getting the
CLIM frame back to front the redisplay function is _not_ called. (Can
be seen, both, by not refreshing the pixmap and not incrementing the
redisplay-counter).
BUT: The string "Redisplay #1" _is_ redrawn, so some more low level part
of CLIM knows that a redraw is needed and does that for the text send to
the standard output stream.
So two questions:
1. What do I have to do, so that the
--
Sascha Wilde : "Ist es nicht schon schlimm genug, dass ICH hier rumtrolle?"
: (Henning Leise in d.o.c.)
More information about the mcclim-devel
mailing list