MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <17101.6035.893039.927003 at karryall.dnsalias.org> Date: Thu, 7 Jul 2005 13:52:51 +0200 From: Olivier Andrieu To: "Matthew Lakin" Cc: Subject: Re: Suppressing Gdk Warnings In-Reply-To: <08274F3CA42017478C1A9114E2B186B632B8D2 at axiom1.cambridge.internal> References: <08274F3CA42017478C1A9114E2B186B632B8D2 at axiom1.cambridge.internal> Matthew Lakin [Thursday 7 July 2005] : > > Hi there, > > > > I have an application which uses Lablgtk2 under Windows XP. I have > run into a known bug in GTK > (http://bugzilla.gnome.org/show_bug.cgi?id=137796) which causes > errors of the form: "(camlprog.exe:1116): Gdk-WARNING **: > gdkdrawable-win32.c:1591: BitBlt failed: The handle is invalid." to > fill up the terminal window when the desktop is unlocked. This only > happens when the user enters their password after the screensaver > has kicked in. The number of such errors that appear depends on > how many times the window was redrawn while the desktop was locked. > > > The errors themselves seem to be completely benign so is there any > way to trap and handle such warnings within LablGtk, to prevent > them getting written to the terminal? I have had a look through the > documentation but have not found anything yet. Alternatively, is > there any workaround known for this issue in LablGtk? You should be able to redirect the warning using the message logging API of glib: http://oandrieu.nerim.net/ocaml/lablgtk/doc/Glib.Message.html http://developer.gnome.org/doc/API/2.0/glib/glib-Message-Logging.html For instance, something like this should redirect to a file : Glib.Message.set_log_handler ~domain:"Gdk" ~levels:[`WARNING] (fun ~level msg -> Printf.fprintf some_file "%s%!" msg) -- Olivier