Date: Wed, 29 Nov 2006 15:07:31 +0100 From: Maxence Guesdon To: lablgtk at math.nagoya-u.ac.jp Subject: strange behaviour of GMain.Main.main / GMain.Main.quit Message-ID: <20061129150731.3660ab96 at tintin.inria.fr> Organization: INRIA Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII Content-Length: 1485 Hello, I'm experiencing problems while using GMain.Main.main and GMain.Main.quit. Here is a program to reproduce the problem. It creates a window. When "Return" is pressed, the nb_waits counter in incrementend, then GMain.Main.main is called to wait for a GMain.Main.quit, then "pop!" is displayed (that is, when GMain.Main.main returns). When "Escape" is pressed, GMain.Main.quit is called nb_waits times. I thought that then all waiting "pop!" would be displayed one after the other but it works only when there is only one GMain.Main.main waiting. Is this a bug or a feature ? Thanks for any help, (* compile with ocamlc -I +lablgtk2 lablgtk.cma testgtk.ml -o testgtk.x *) GMain.Main.init ();; let w = GWindow.window ~title:"test" ~width: 600 ~height: 400 ();; let nb_waits = ref 0;; let cb ev = let key = GdkEvent.Key.keyval ev in if key = GdkKeysyms._Return then begin incr nb_waits; prerr_endline (Printf.sprintf "nb_waits is now %d" !nb_waits); GMain.Main.main (); prerr_endline "pop!" end else ( if key = GdkKeysyms._Escape then for i = 1 to !nb_waits do prerr_endline "GMain.Main.quit ()"; GMain.Main.quit (); decr nb_waits; prerr_endline (Printf.sprintf "nb_waits is now %d" !nb_waits); done; ); true ;; ignore (w#event#connect#key_press ~callback: cb);; w#show ();; GMain.Main.main () -- Maxence Guesdon http://yquem.inria.fr/~guesdon/ http://devel.inria.fr/rocq/