summaryrefslogtreecommitdiffstats
path: root/otherlibs/labltk/support/cltkWait.c
diff options
context:
space:
mode:
authorXavier Clerc <xavier.clerc@inria.fr>2013-09-09 09:32:00 +0000
committerXavier Clerc <xavier.clerc@inria.fr>2013-09-09 09:32:00 +0000
commite82104a755463d481667650ba4f00de535048f39 (patch)
tree054c7de9b2992be063de2dd22b56ee5993d5a374 /otherlibs/labltk/support/cltkWait.c
parent83ca86dd2309914aa458bc25fd265f0bcadaa337 (diff)
Remove labltk from the distribution (will be available as a third-party library).
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14077 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'otherlibs/labltk/support/cltkWait.c')
-rw-r--r--otherlibs/labltk/support/cltkWait.c102
1 files changed, 0 insertions, 102 deletions
diff --git a/otherlibs/labltk/support/cltkWait.c b/otherlibs/labltk/support/cltkWait.c
deleted file mode 100644
index e13091f2d..000000000
--- a/otherlibs/labltk/support/cltkWait.c
+++ /dev/null
@@ -1,102 +0,0 @@
-/***********************************************************************/
-/* */
-/* MLTk, Tcl/Tk interface of OCaml */
-/* */
-/* Francois Rouaix, Francois Pessaux, Jun Furuse and Pierre Weis */
-/* projet Cristal, INRIA Rocquencourt */
-/* Jacques Garrigue, Kyoto University RIMS */
-/* */
-/* Copyright 2002 Institut National de Recherche en Informatique et */
-/* en Automatique and Kyoto University. All rights reserved. */
-/* This file is distributed under the terms of the GNU Library */
-/* General Public License, with the special exception on linking */
-/* described in file LICENSE found in the OCaml source tree. */
-/* */
-/***********************************************************************/
-
-/* $Id$ */
-
-#include <tcl.h>
-#include <tk.h>
-#include <mlvalues.h>
-#include <memory.h>
-#include <callback.h>
-#include "camltk.h"
-
-/* The following are replacements for
- tkwait visibility
- tkwait window
- in the case where we use threads (tkwait internally calls an event loop,
- and thus prevents thread scheduling from taking place).
-
- Instead, one should set up a callback, wait for a signal, and signal
- from inside the callback
-*/
-
-static void WaitVisibilityProc _ANSI_ARGS_((ClientData clientData,
- XEvent *eventPtr));
-static void WaitWindowProc _ANSI_ARGS_((ClientData clientData,
- XEvent *eventPtr));
-
-/* For the other handlers, we need a bit more data */
-struct WinCBData {
- int cbid;
- Tk_Window win;
-};
-
-static void WaitVisibilityProc(clientData, eventPtr)
- ClientData clientData;
- XEvent *eventPtr; /* Information about event (not used). */
-{
- struct WinCBData *vis = clientData;
- value cbid = Val_int(vis->cbid);
-
- Tk_DeleteEventHandler(vis->win, VisibilityChangeMask,
- WaitVisibilityProc, clientData);
-
- stat_free((char *)vis);
- callback2(*handler_code,cbid,Val_int(0));
-}
-
-/* Sets up a callback upon Visibility of a window */
-CAMLprim value camltk_wait_vis(value win, value cbid)
-{
- struct WinCBData *vis =
- (struct WinCBData *)caml_stat_alloc(sizeof(struct WinCBData));
- vis->win = Tk_NameToWindow(cltclinterp, String_val(win), cltk_mainWindow);
- if (vis -> win == NULL) {
- stat_free((char *)vis);
- tk_error(Tcl_GetStringResult(cltclinterp));
- };
- vis->cbid = Int_val(cbid);
- Tk_CreateEventHandler(vis->win, VisibilityChangeMask,
- WaitVisibilityProc, (ClientData) vis);
- return Val_unit;
-}
-
-static void WaitWindowProc(ClientData clientData, XEvent *eventPtr)
-{
- if (eventPtr->type == DestroyNotify) {
- struct WinCBData *vis = clientData;
- value cbid = Val_int(vis->cbid);
- stat_free((char *)clientData);
- /* The handler is destroyed by Tk itself */
- callback2(*handler_code,cbid,Val_int(0));
- }
-}
-
-/* Sets up a callback upon window destruction */
-CAMLprim value camltk_wait_des(value win, value cbid)
-{
- struct WinCBData *vis =
- (struct WinCBData *)caml_stat_alloc(sizeof(struct WinCBData));
- vis->win = Tk_NameToWindow(cltclinterp, String_val(win), cltk_mainWindow);
- if (vis -> win == NULL) {
- stat_free((char *)vis);
- tk_error(Tcl_GetStringResult(cltclinterp));
- };
- vis->cbid = Int_val(cbid);
- Tk_CreateEventHandler(vis->win, StructureNotifyMask,
- WaitWindowProc, (ClientData) vis);
- return Val_unit;
-}