]> git.mdlowis.com Git - archive/tide-ocaml.git/commitdiff
added logic to respond to window manager shutdown message
authorMichael D. Lowis <mike.lowis@gentex.com>
Tue, 19 Dec 2017 19:05:07 +0000 (14:05 -0500)
committerMichael D. Lowis <mike.lowis@gentex.com>
Tue, 19 Dec 2017 19:05:07 +0000 (14:05 -0500)
edit.ml
lib/x11.ml
lib/x11_prims.c

diff --git a/edit.ml b/edit.ml
index 56e54aebcfd10343c072a3ff195beea6c83df8bb..01bcb08f47965abf6653ddab338115b17138e29a 100644 (file)
--- 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
index 9b7e7343eddd276a87960c2e70a59c0a6d92a544..49465fdbbe407f396f2d46c025b757abb22ab825 100644 (file)
@@ -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"
 
index 8b9762e9615b6c7e3b8a04ba9403186b3e33e74a..7fd46865a6b8dd5c88b8a53adc39e126e5d657ea 100644 (file)
@@ -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));