Add GNU LGPL headers to all .c .C and .h files
[oweals/cde.git] / cde / programs / dtinfo / dtinfo / src / external-api / init.c
1 /*
2  * CDE - Common Desktop Environment
3  *
4  * Copyright (c) 1993-2012, The Open Group. All rights reserved.
5  *
6  * These libraries and programs are free software; you can
7  * redistribute them and/or modify them under the terms of the GNU
8  * Lesser General Public License as published by the Free Software
9  * Foundation; either version 2 of the License, or (at your option)
10  * any later version.
11  *
12  * These libraries and programs are distributed in the hope that
13  * they will be useful, but WITHOUT ANY WARRANTY; without even the
14  * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15  * PURPOSE. See the GNU Lesser General Public License for more
16  * details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with these librararies and programs; if not, write
20  * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21  * Floor, Boston, MA 02110-1301 USA
22  */
23 /*
24  * $TOG: init.c /main/4 1997/06/18 17:32:40 samborn $
25  *
26  * Copyright (c) 1992 HaL Computer Systems, Inc.  All rights reserved.
27  * UNPUBLISHED -- rights reserved under the Copyright Laws of the United
28  * States.  Use of a copyright notice is precautionary only and does not
29  * imply publication or disclosure.
30  * 
31  * This software contains confidential information and trade secrets of HaL
32  * Computer Systems, Inc.  Use, disclosure, or reproduction is prohibited
33  * without the prior express written permission of HaL Computer Systems, Inc.
34  * 
35  *                         RESTRICTED RIGHTS LEGEND
36  * Use, duplication, or disclosure by the Government is subject to
37  * restrictions as set forth in subparagraph (c)(l)(ii) of the Rights in
38  * Technical Data and Computer Software clause at DFARS 252.227-7013.
39  *                        HaL Computer Systems, Inc.
40  *                  1315 Dell Avenue, Campbell, CA  95008
41  * 
42  */
43
44 #include "oliasP.h"
45
46 #include <stdio.h>
47
48 Atom _olias_window_id_atom;
49 Atom _olias_event_atom;
50 Atom _olias_reply_atom;
51 Atom _olias_client_atom;
52
53 /* **************************************************************
54  * _olias_initialize - initialize olias interface
55  * ************************************************************** */
56
57 void
58 _olias_initialize (Widget toplevel)
59 {
60   enum { XA_OLIAS_WINDOW_ID_ATOM, XA_OLIAS_EVENT_ATOM,
61          XA_OLIAS_REPLY_ATOM, NUM_ATOMS }; 
62   static char* atom_names[] = { OLIAS_WINDOW_ID_ATOM, OLIAS_EVENT_ATOM,
63                                 OLIAS_REPLY_ATOM }; 
64   static char buf[32];
65
66   Atom atoms[XtNumber(atom_names)];
67     
68   /* -------- Create standard communication properties. -------- */
69
70   XInternAtoms(XtDisplay (toplevel), atom_names, XtNumber(atom_names),
71                False, atoms);
72   _olias_window_id_atom = atoms[XA_OLIAS_WINDOW_ID_ATOM];
73   _olias_event_atom = atoms[XA_OLIAS_EVENT_ATOM];
74   _olias_reply_atom = atoms[XA_OLIAS_REPLY_ATOM];
75
76   /* -------- Create a unique selection property for this client. -------- */
77
78   sprintf (buf, OLIAS_CLIENT_ATOM_FMT, XtWindow (toplevel));
79   _olias_client_atom = XInternAtom (XtDisplay (toplevel), buf, False);
80
81   /* -------- Set up communication handling routines. -------- */
82
83   /* Ok to use CurrentTime because contention not possible. */
84   XtOwnSelection (toplevel, _olias_client_atom, CurrentTime,
85                   _olias_convert_event, NULL, NULL);
86
87   XtAddEventHandler (toplevel, None, True, _olias_handle_reply, NULL);
88 }