Initial import of the CDE 2.1.30 sources from the Open Group.
[oweals/cde.git] / cde / programs / dtinfo / dtinfo / src / external-api / init.c
1 /*
2  * $TOG: init.c /main/4 1997/06/18 17:32:40 samborn $
3  *
4  * Copyright (c) 1992 HaL Computer Systems, Inc.  All rights reserved.
5  * UNPUBLISHED -- rights reserved under the Copyright Laws of the United
6  * States.  Use of a copyright notice is precautionary only and does not
7  * imply publication or disclosure.
8  * 
9  * This software contains confidential information and trade secrets of HaL
10  * Computer Systems, Inc.  Use, disclosure, or reproduction is prohibited
11  * without the prior express written permission of HaL Computer Systems, Inc.
12  * 
13  *                         RESTRICTED RIGHTS LEGEND
14  * Use, duplication, or disclosure by the Government is subject to
15  * restrictions as set forth in subparagraph (c)(l)(ii) of the Rights in
16  * Technical Data and Computer Software clause at DFARS 252.227-7013.
17  *                        HaL Computer Systems, Inc.
18  *                  1315 Dell Avenue, Campbell, CA  95008
19  * 
20  */
21
22 #include "oliasP.h"
23
24 #include <stdio.h>
25
26 Atom _olias_window_id_atom;
27 Atom _olias_event_atom;
28 Atom _olias_reply_atom;
29 Atom _olias_client_atom;
30
31 /* **************************************************************
32  * _olias_initialize - initialize olias interface
33  * ************************************************************** */
34
35 void
36 _olias_initialize (Widget toplevel)
37 {
38   enum { XA_OLIAS_WINDOW_ID_ATOM, XA_OLIAS_EVENT_ATOM,
39          XA_OLIAS_REPLY_ATOM, NUM_ATOMS }; 
40   static char* atom_names[] = { OLIAS_WINDOW_ID_ATOM, OLIAS_EVENT_ATOM,
41                                 OLIAS_REPLY_ATOM }; 
42   static char buf[32];
43
44   Atom atoms[XtNumber(atom_names)];
45     
46   /* -------- Create standard communication properties. -------- */
47
48   XInternAtoms(XtDisplay (toplevel), atom_names, XtNumber(atom_names),
49                False, atoms);
50   _olias_window_id_atom = atoms[XA_OLIAS_WINDOW_ID_ATOM];
51   _olias_event_atom = atoms[XA_OLIAS_EVENT_ATOM];
52   _olias_reply_atom = atoms[XA_OLIAS_REPLY_ATOM];
53
54   /* -------- Create a unique selection property for this client. -------- */
55
56   sprintf (buf, OLIAS_CLIENT_ATOM_FMT, XtWindow (toplevel));
57   _olias_client_atom = XInternAtom (XtDisplay (toplevel), buf, False);
58
59   /* -------- Set up communication handling routines. -------- */
60
61   /* Ok to use CurrentTime because contention not possible. */
62   XtOwnSelection (toplevel, _olias_client_atom, CurrentTime,
63                   _olias_convert_event, NULL, NULL);
64
65   XtAddEventHandler (toplevel, None, True, _olias_handle_reply, NULL);
66 }