[racket-dev] while resizing drawing into a canvas is off

From: Marijn (hkBst at gentoo.org)
Date: Wed Oct 19 04:14:36 EDT 2011

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 10/18/11 17:10, Matthew Flatt wrote:
> At Tue, 18 Oct 2011 16:32:54 +0200, Marijn wrote:
>> the attached program draws a grid in a canvas and paints a few of
>> the cells so created. When resizing the window, the grid is also
>> dynamically resized together with the coloring of a few painted
>> cells. Everything seems to work fine, except that while the
>> window is being changed in size the drawing is off and the
>> colored cells do not properly correspond to the drawn grid. You
>> can see this especially well if you hold down the mouse button
>> after resizing. When releasing it the grid lines will change
>> position to match up once more with the colorings.
> 
> This was due to an internal inconsistency with `get-char-width'
> and `get-char-height'. I've pushed a repair.

Thanks for the quick fix.

> Beware that, under Windows, `on-paint' is called before `on-size', 
> which means that the state update in your `on-size' callback
> happens too late. I think it would be nicer if `on-size' reliably
> came before `on-paint' but it's difficult to maintain those kinds
> of guarantees across all platforms. One solution is to add a call
> to `refresh' in your `on-size' callback.

Thanks for the heads-up. I've added the call to refresh and made a
mental note not to assume too much about the order in which call-backs
get called.

Marijn

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.18 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk6ehuwACgkQp/VmCx0OL2zejQCgmCP1oh8jFBzbaT7IafLDDshU
7WIAn3FlMLQmzS1YTRkunb5Pr+CA9VhA
=d8Hp
-----END PGP SIGNATURE-----


Posted on the dev mailing list.