WSTester updated to work plus hopefully all the other changes that need to go into...
[jabaws.git] / binaries / src / ViennaRNA / RNAforester / g2-0.70 / demo / handles.c
1 /*****************************************************************************
2 **  Copyright (C) 1998-2005  Ljubomir Milanovic & Horst Wagner
3 **  This file is part of the g2 library
4 **
5 **  This library is free software; you can redistribute it and/or
6 **  modify it under the terms of the GNU Lesser General Public
7 **  License as published by the Free Software Foundation; either
8 **  version 2.1 of the License, or (at your option) any later version.
9 **
10 **  This library is distributed in the hope that it will be useful,
11 **  but WITHOUT ANY WARRANTY; without even the implied warranty of
12 **  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13 **  Lesser General Public License for more details.
14 **
15 **  You should have received a copy of the GNU Lesser General Public
16 **  License along with this library; if not, write to the Free Software
17 **  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18 ******************************************************************************/
19 #include <stdio.h>
20 #include <g2.h>
21 #include <g2_X11.h>
22 #include <g2_PS.h>
23
24 #include <X11/Xlib.h>
25
26 int main()
27 {
28     int d1, d2;
29     void *handles[G2_PD_HANDLES_SIZE];
30     Display *display;
31     Drawable *drawable;
32     GC *gc;
33
34
35     d1=g2_open_X11(100, 100);
36     g2_line(d1, 10, 10, 90, 90);
37
38     g2_get_pd_handles(d1, handles);
39     display = handles[0];
40     drawable = handles[5];
41     gc = handles[4];
42     
43     printf("%p %p %p\n", display, drawable, gc);
44     
45     XDrawString(display, *drawable, *gc,
46                 10,10, "OK", 2);
47
48     g2_flush(d1);
49
50     d2=g2_open_PS("handles.ps", g2_A4, g2_PS_port);
51     g2_get_pd_handles(d2, handles);
52     printf("%p %p %p\n", handles[0], handles[1], handles[2]);
53
54     
55     getchar();
56     return 0;
57 }
58