[mcclim-devel] Repainting of shrinking windows?

Daniel Katz dpkatz at gmail.com
Sun Sep 10 12:54:36 UTC 2006


Hi,

I've been reading the "Guided Tour" paper included in mcclim/Doc, and
I've found a peculiar behavior for the "Hello World" example on my
system (latest mcclim from CVS, sbcl 0.9.13, Mac OS X 10.4.7 on PPC
running X11.app) and I'm not sure if it's
   - a bug in mcclim, or
   - a bug in X11.app, or
   - a bug in my understanding of how CLIM works, or
   - a feature!
In any event, the issue is as follows.


I run the following code (taken verbatim from the paper) in the
CLIM-USER package at the REPL:
------------------------------------------------------------------------
(define-application-frame hello-world ()
   ((greeting :initform "Hello World"
	     :accessor greeting))
   (:pane (make-pane 'hello-world-pane)))

(defclass hello-world-pane (clim-stream-pane)
   ())

(defmethod handle-repaint ((pane hello-world-pane) region)
   (let ((w (bounding-rectangle-width pane))
	(h (bounding-rectangle-height pane)))
     ;; Blank the pane out
     (draw-rectangle* pane 0 0 w h
		     :filled t
		     :ink (pane-background pane))
     ;; Draw greeting in center of pane
     (draw-text* pane
		(greeting *application-frame*)
		(floor w 2) (floor h 2)
		:align-x :center
		:align-y :center)))

(defun make-and-run-hello-world ()
   (run-frame-top-level
    (make-application-frame 'hello-world)))

(make-and-run-hello-world)
------------------------------------------------------------------------
and I do indeed get a very small window popping up with "Hello World"
in it.  (The window is so tiny, in fact, that it only shows about 5
letters, and that only thanks to the window manager requirement to
make the window large enough to accomodate the usual "expand, hide,
kill" buttons of the Mac OS X window manager.)  I then grab the manual
"resizing" corner of the window and make it bigger, and things are
fine, with the text of "Hello World" dynamically readjusting itself to
stay centered in the window.

The problem comes when I try to use the same mechanism to make the
window smaller.  Whenever dragging the corner of the window is used to
reduce the size of the window, the text does not automatically
recenter but rather stays in the same absolute position on the screen.
(I am attaching a PNG which shows the effect of expanding a window and
then shrinking it again using the "resizer" in the lower right corner
of the window -- the text is clearly no longer centered.)  Any  
attempt to enlarge
the window (in either or both dimensions) will instantly recenter the  
text again.

Clearly, the "shrink window" event is not being acted on for
recentering purposes.  But is this a bug in McClim (i.e., it should be
repainting on shrink but is not), or is it a bug in the Mac OS X
X11.app (i.e., it should be sending some sort of message on shrink  
but is
not) or is it my misunderstanding (i.e., I should be adding some code
to get the repaint to activate on shrink, and I have not done so)?

Thanks for any insight you can provide!

Dan

-------------- next part --------------
A non-text attachment was scrubbed...
Name: CLIM-grab.png
Type: image/png
Size: 8078 bytes
Desc: not available
URL: <https://mailman.common-lisp.net/pipermail/mcclim-devel/attachments/20060910/e9254833/attachment.png>
-------------- next part --------------




More information about the mcclim-devel mailing list