From: Michael D. Lowis Date: Tue, 19 Dec 2017 19:05:07 +0000 (-0500) Subject: added logic to respond to window manager shutdown message X-Git-Url: https://git.mdlowis.com/?a=commitdiff_plain;h=073092937acc48c8a650d809c9ce1a29e8fa5bed;p=archive%2Ftide-ocaml.git added logic to respond to window manager shutdown message --- diff --git a/edit.ml b/edit.ml index 56e54ae..01bcb08 100644 --- a/edit.ml +++ b/edit.ml @@ -40,7 +40,8 @@ let onupdate width height = edit_view := View.draw !edit_view csr; Draw.scroll scrollcsr (View.scroll_params !edit_view) -let onshutdown () = () +let onshutdown () = + shutdown () let onevent evnt = try match evnt with diff --git a/lib/x11.ml b/lib/x11.ml index 9b7e734..49465fd 100644 --- a/lib/x11.ml +++ b/lib/x11.ml @@ -63,6 +63,9 @@ external connect : unit -> unit external disconnect : unit -> unit = "x11_disconnect" +external shutdown : unit -> unit + = "x11_shutdown" + external make_window : int -> int -> xwin = "x11_make_window" diff --git a/lib/x11_prims.c b/lib/x11_prims.c index 8b9762e..7fd4686 100644 --- a/lib/x11_prims.c +++ b/lib/x11_prims.c @@ -88,6 +88,12 @@ CAMLprim value x11_disconnect(void) { CAMLreturn(Val_unit); } +CAMLprim value x11_shutdown(void) { + CAMLparam0(); + X.running = false; + CAMLreturn(Val_unit); +} + CAMLprim value x11_make_window(value height, value width) { CAMLparam2(height, width); create_window(Int_val(height), Int_val(width));