To: checker at d6.com Cc: lablgtk at kaba.or.jp Subject: Re: resize event? In-Reply-To: <4.3.2.7.2.20010105002151.00baf5c0 at shell16.ba.best.com> References: <4.3.2.7.2.20010105002151.00baf5c0 at shell16.ba.best.com> Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-Id: <20010105184946H.garrigue at kurims.kyoto-u.ac.jp> Date: Fri, 05 Jan 2001 18:49:46 +0900 From: Jacques Garrigue Lines: 54 From: Chris Hecker > >It is possible that events work differently on windows and X11. > >Try using other events, like configure, in place of expose, this may > >work better. > > I tried configure, but that didn't work either. Which one is > supposed to be called on resize? Both configure and expose should be called. > Now that I've looked at it closer, it looks like the image does get > repainted on resize, it's just that the window gets cleared > immediately afterwards. > > I decided to dig up a gtk sample app that's similar. I've attached > it below (I also put image.ml in there). It works correctly, and > the image is rock solid. So, it doesn't look like a GTK bug. Any > ideas? Thanks to this information, I think that I understand at last what's happening. Lablgtk's examples use directly the X window from the toplevel window, while GTK's example use a drawing area. One consequence is that the handling of events gets mixed with the handling on the toplevel window, meaning that according to the order in which events are called the drawing may be deleted immediately. Here is a modified version of drawing.ml, using a drawing area. Try it, and tell me if there is a problem. I will rewrite other examples in this style. Jacques (* $Id: drawing.ml,v 1.22 2000/12/01 08:41:27 garrigue Exp $ *) open GMain let window = GWindow.window () let area = GMisc.drawing_area ~packing:window#add () let w = area#misc#realize (); area#misc#window let drawing = new GDraw.drawable w let redraw _ = drawing#polygon ~filled:true [ 10,100; 35,35; 100,10; 165,35; 190,100; 165,165; 100,190; 35,165; 10,100 ]; false let _ = window#connect#destroy ~callback:Main.quit; area#event#connect#expose ~callback:redraw; window#show (); Main.main ()