]> rtime.felk.cvut.cz Git - l4.git/blob - l4/pkg/ocaml/contrib/otherlibs/graph/subwindow.c
Inital import
[l4.git] / l4 / pkg / ocaml / contrib / otherlibs / graph / subwindow.c
1 /***********************************************************************/
2 /*                                                                     */
3 /*                           Objective Caml                            */
4 /*                                                                     */
5 /*              Jun Furuse, projet Cristal, INRIA Rocquencourt         */
6 /*                                                                     */
7 /*  Copyright 2001 Institut National de Recherche en Informatique et   */
8 /*  en Automatique.  All rights reserved.  This file is distributed    */
9 /*  under the terms of the GNU Library General Public License, with    */
10 /*  the special exception on linking described in file ../../LICENSE.  */
11 /*                                                                     */
12 /***********************************************************************/
13
14 /* $Id: subwindow.c 6171 2004-03-24 15:02:06Z starynke $ */
15
16 #include "libgraph.h"
17
18 value caml_gr_open_subwindow(value vx, value vy, value width, value height)
19 {
20   Window win;
21
22   int h = Int_val(height);
23   int w = Int_val(width);
24   int x = Int_val(vx);
25   int y = Int_val(vy);
26
27   caml_gr_check_open();
28   win = XCreateSimpleWindow(caml_gr_display, caml_gr_window.win,
29                             x, Wcvt(y + h), w, h,
30                             0, caml_gr_black, caml_gr_background);
31   XMapWindow(caml_gr_display, win);
32   XFlush(caml_gr_display);
33   return (caml_gr_id_of_window (win));
34 }
35
36 value caml_gr_close_subwindow(value wid)
37 {
38   Window win;
39
40   caml_gr_check_open();
41   sscanf( String_val(wid), "%lu", (unsigned long *)(&win) );
42   XDestroyWindow(caml_gr_display, win);
43   XFlush(caml_gr_display);
44   return Val_unit;
45 }