From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@sympa.inria.fr Delivered-To: caml-list@sympa.inria.fr Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by sympa.inria.fr (Postfix) with ESMTPS id 5B6AB7F30A for ; Wed, 27 Feb 2013 19:36:25 +0100 (CET) Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of alaincoste@club-internet.fr) identity=pra; client-ip=93.17.128.10; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="alaincoste@club-internet.fr"; x-sender="alaincoste@club-internet.fr"; x-conformance=sidf_compatible Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of alaincoste@club-internet.fr) identity=mailfrom; client-ip=93.17.128.10; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="alaincoste@club-internet.fr"; x-sender="alaincoste@club-internet.fr"; x-conformance=sidf_compatible Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of postmaster@smtp22.services.sfr.fr) identity=helo; client-ip=93.17.128.10; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="alaincoste@club-internet.fr"; x-sender="postmaster@smtp22.services.sfr.fr"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ArkBAPBRLlFdEYAKemdsb2JhbAA+B4wLthEEBH0WDgEBFCgDJIIaFAEBLh8BLAIIAhEUOQEEGkUCAQIDAYgGoA+hQY1agVeCSWEDqjSBaAcc X-IPAS-Result: ArkBAPBRLlFdEYAKemdsb2JhbAA+B4wLthEEBH0WDgEBFCgDJIIaFAEBLh8BLAIIAhEUOQEEGkUCAQIDAYgGoA+hQY1agVeCSWEDqjSBaAcc X-IronPort-AV: E=Sophos;i="4.84,749,1355094000"; d="scan'208";a="3667934" Received: from smtp22.services.sfr.fr ([93.17.128.10]) by mail3-smtp-sop.national.inria.fr with ESMTP; 27 Feb 2013 19:35:59 +0100 Received: from filter.sfr.fr (localhost [127.0.0.1]) by msfrf2202.sfr.fr (SMTP Server) with ESMTP id 5B4977000107 for ; Wed, 27 Feb 2013 19:35:59 +0100 (CET) Received: from Ganymede (122.171.13.109.rev.sfr.net [109.13.171.122]) by msfrf2202.sfr.fr (SMTP Server) with SMTP id 2889570000F4 for ; Wed, 27 Feb 2013 19:35:59 +0100 (CET) X-SFR-UUID: 20130227183559166.2889570000F4@msfrf2202.sfr.fr Message-ID: <58FDBA43E51F42D083872E99902EA8F3@Ganymede> From: Alain Coste To: caml-list@inria.fr Date: Wed, 27 Feb 2013 19:35:52 +0100 MIME-Version: 1.0 X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2900.5931 X-Mimeole: Produced By Microsoft MimeOLE V6.00.2900.6157 X-Antivirus: avast! (VPS 130227-0, 27/02/2013), Outbound message X-Antivirus-Status: Clean Content-Type: text/plain; format=flowed; charset=Windows-1252; reply-type=original Content-Transfer-Encoding: 7bit X-Validation-by: alaincoste@club-internet.fr Subject: [Caml-list] interrupt OCaml when using the Graphics library Hello I work with OCaml-4 and windows XP. I am using the Graphics library, and I don't know how to wake-up OCaml when it is suspended waiting for an event in the graphic window. Some cases when this happens: - I interrupt OCaml with ^C; nothing happens until I move the mouse or clic in the graphic window. - The graphic window is killed (click on X in the window title); here things are worse as I can no longer send an event to the window; OCaml is definitly blocked. - The graphic window is resized (with the mouse); my program cannot update the contents of the window until I release the mouse button and move the mouse (or click) inside the window. When OCaml runs in text mode (ie not in the graphic window) it can also get suspended waiting for input on stdin, but the process which runs OCaml (XEmacs with comint in my case) can simply send a character to its stdin after sending sigint, OCaml is waked-up and processes the interrupt. I have tried to change the behavior of OCaml with Sys.signal, but this doesn't work as OCaml doesn't recognize sigint while it is suspended. The only workaround I found is to ask XEmacs to run an ahk script which posts a message or sends a click to the graphic window; but this works only if the window is still alive and is rather convoluted... I suppose there is a better method to do this, but I am stuck down. Alain Coste