Add GNU LGPL headers to all .c .C and .h files
[oweals/cde.git] / cde / lib / tt / lib / util / tt_Xlib.h
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 /*%%  (c) Copyright 1993, 1994 Hewlett-Packard Company                   */
24 /*%%  (c) Copyright 1993, 1994 International Business Machines Corp.     */
25 /*%%  (c) Copyright 1993, 1994 Sun Microsystems, Inc.                    */
26 /*%%  (c) Copyright 1993, 1994 Novell, Inc.                              */
27 /*%%  $XConsortium: tt_Xlib.h /main/3 1995/10/23 10:36:35 rswiston $                                                     */
28 //%%    $XConsortium: tt_Xlib.h /main/3 1995/10/23 10:36:35 rswiston $                                                  
29 //%%                                                                    
30 //%%    RESTRICTED CONFIDENTIAL INFORMATION:                            
31 //%%                                                                    
32 //%%    The information in this document is subject to special          
33 //%%    restrictions in a confidential disclosure agreement between     
34 //%%    HP, IBM, Sun, USL, SCO and Univel.  Do not distribute this      
35 //%%    document outside HP, IBM, Sun, USL, SCO, or Univel without      
36 //%%    Sun's specific written approval.  This document and all copies  
37 //%%    and derivative works thereof must be returned or destroyed at   
38 //%%    Sun's request.                                                  
39 //%%                                                                    
40 //%%    Copyright 1993 Sun Microsystems, Inc.  All rights reserved.     
41 //%%                                                                    
42 /* -*-C++-*-
43  *
44  * @(#)tt_Xlib.h        1.3 93/09/07
45  *
46  * Copyright 1993 Sun Microsystems, Inc.  All rights reserved.
47  */
48
49 #ifndef _TT_XLIB_H
50 #define _TT_XLIB_H
51
52 #include "tt_options.h"
53 #include <X11/Xlib.h>
54 #include <X11/Xatom.h>
55
56 typedef int (*_Tt_xfn_ptr)(...);
57
58 typedef struct {
59         _Tt_xfn_ptr     XOpenDisplay;
60         _Tt_xfn_ptr     XCloseDisplay;
61         _Tt_xfn_ptr     XFlush;
62         _Tt_xfn_ptr     XChangeProperty;
63         _Tt_xfn_ptr     XDeleteProperty;
64         _Tt_xfn_ptr     XGetWindowProperty;
65         _Tt_xfn_ptr     XSetIOErrorHandler;
66         _Tt_xfn_ptr     XInternAtom;
67         _Tt_xfn_ptr     XNextEvent;
68         _Tt_xfn_ptr     XRefreshKeyboardMapping;
69         _Tt_xfn_ptr     XGrabServer;
70         _Tt_xfn_ptr     XUngrabServer;
71         _Tt_xfn_ptr     XGetWindowAttributes;
72         _Tt_xfn_ptr     XTranslateCoordinates;
73         _Tt_xfn_ptr     XMoveResizeWindow;
74         _Tt_xfn_ptr     XRaiseWindow;
75         _Tt_xfn_ptr     XLowerWindow;
76         _Tt_xfn_ptr     XIconifyWindow;
77         _Tt_xfn_ptr     XMapWindow;
78         _Tt_xfn_ptr     XWithdrawWindow;
79         _Tt_xfn_ptr     XSendEvent;
80         _Tt_xfn_ptr     XScreenNumberOfScreen;
81         _Tt_xfn_ptr     XFree;
82 } _Tt_xlib;
83
84 typedef struct {
85         _Tt_xfn_ptr     XtVaGetValues;
86         _Tt_xfn_ptr     XtVaSetValues;
87         _Tt_xfn_ptr     XtRemoveInput;
88         _Tt_xfn_ptr     XtDisplay;
89         _Tt_xfn_ptr     XtWindow;
90         _Tt_xfn_ptr     XtIsRealized;
91         _Tt_xfn_ptr     XtIsSubclass;
92         _Tt_xfn_ptr     XtIsSensitive;
93         _Tt_xfn_ptr     XtSetSensitive;
94         _Tt_xfn_ptr     XtAppPending;
95         _Tt_xfn_ptr     XtAppAddTimeOut;
96         _Tt_xfn_ptr     XtRemoveTimeOut;
97         _Tt_xfn_ptr     XtAppProcessEvent;
98         void           *applicationShellWidgetClass;
99 } _Tt_xt;
100
101 #ifdef OPT_DLOPEN_X11
102
103 // 
104 // If this option is turned on then we create a struct containing
105 // function pointers to all the X11 functions we use. If they are needed
106 // then this functions will be dlsym'ed from a libX11.so library. This
107 // allows executables based on this mechanism to not require libX11.so to
108 // be linked in.
109 //
110 // The macro CALLX11 below should be used to call an X11 function.  If
111 // OPT_DLOPEN_X11 is turned on then it will dereference the appropiate
112 // member in the struct and invoke it as a function. Otherwise it just
113 // calls the X11 function directly.
114
115 #       define CALLX11(fn) (*_tt_xlib . fn)
116 #       define CALLXT(fn) (*_tt_xt . fn)
117 #       define XTSYM(sym) (_tt_xt . sym)
118         extern _Tt_xlib _tt_xlib;
119         extern _Tt_xt   _tt_xt;
120 #else
121 #       define CALLX11(fn) fn
122 #       define CALLXT(fn) fn
123 #       define XTSYM(sym) sym
124 #endif
125
126 extern int              _tt_load_xlib();
127 extern int              _tt_load_xt();
128
129 #endif