1 /*
2  * Copyright © 2007 Novell, Inc.
3  *
4  * Permission to use, copy, modify, distribute, and sell this software
5  * and its documentation for any purpose is hereby granted without
6  * fee, provided that the above copyright notice appear in all copies
7  * and that both that copyright notice and this permission notice
8  * appear in supporting documentation, and that the name of
9  * Novell, Inc. not be used in advertising or publicity pertaining to
10  * distribution of the software without specific, written prior permission.
11  * Novell, Inc. makes no representations about the suitability of this
12  * software for any purpose. It is provided "as is" without express or
13  * implied warranty.
14  *
15  * NOVELL, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
16  * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
17  * NO EVENT SHALL NOVELL, INC. BE LIABLE FOR ANY SPECIAL, INDIRECT OR
18  * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
19  * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
20  * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
21  * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
22  *
23  * Author: David Reveman <davidr@novell.com>
24  */
25 
26 #ifndef _COMPIZ_H
27 #define _COMPIZ_H
28 
29 #include <libxml/parser.h>
30 
31 #include <compiz-common.h>
32 
33 COMPIZ_BEGIN_DECLS
34 
35 typedef int CompBool;
36 typedef int CompTimeoutHandle;
37 typedef int CompWatchFdHandle;
38 
39 typedef union _CompOptionValue CompOptionValue;
40 
41 typedef struct _CompObject   CompObject;
42 typedef struct _CompCore     CompCore;
43 typedef struct _CompDisplay  CompDisplay;
44 typedef struct _CompMetadata CompMetadata;
45 typedef struct _CompOption   CompOption;
46 typedef struct _CompPlugin   CompPlugin;
47 typedef struct _CompScreen   CompScreen;
48 typedef struct _CompWindow   CompWindow;
49 
50 typedef CompBool (*CallBackProc) (void *closure);
51 
52 typedef enum {
53     CompOptionTypeBool,
54     CompOptionTypeInt,
55     CompOptionTypeFloat,
56     CompOptionTypeString,
57     CompOptionTypeColor,
58     CompOptionTypeAction,
59     CompOptionTypeKey,
60     CompOptionTypeButton,
61     CompOptionTypeEdge,
62     CompOptionTypeBell,
63     CompOptionTypeMatch,
64     CompOptionTypeList
65 } CompOptionType;
66 
67 void
68 compInitOptionValue (CompOptionValue *v);
69 
70 void
71 compFiniOptionValue (CompOptionValue *v,
72 		     CompOptionType  type);
73 
74 void
75 compInitOption (CompOption *option);
76 
77 void
78 compFiniOption (CompOption *option);
79 
80 CompOption *
81 compFindOption (CompOption *option,
82 		int	    nOption,
83 		const char  *name,
84 		int	    *index);
85 
86 CompBool
87 compSetBoolOption (CompOption      *option,
88 		   CompOptionValue *value);
89 
90 CompBool
91 compSetIntOption (CompOption	  *option,
92 		  CompOptionValue *value);
93 
94 CompBool
95 compSetFloatOption (CompOption	    *option,
96 		    CompOptionValue *value);
97 
98 CompBool
99 compSetStringOption (CompOption	     *option,
100 		     CompOptionValue *value);
101 
102 CompBool
103 compSetColorOption (CompOption	    *option,
104 		    CompOptionValue *value);
105 
106 CompBool
107 compSetActionOption (CompOption      *option,
108 		     CompOptionValue *value);
109 
110 CompBool
111 compSetMatchOption (CompOption      *option,
112 		    CompOptionValue *value);
113 
114 CompBool
115 compSetOptionList (CompOption      *option,
116 		   CompOptionValue *value);
117 
118 CompBool
119 compSetOption (CompOption      *option,
120 	       CompOptionValue *value);
121 
122 CompTimeoutHandle
123 compAddTimeout (int	     minTime,
124 		int	     maxTime,
125 		CallBackProc callBack,
126 		void	     *closure);
127 
128 void *
129 compRemoveTimeout (CompTimeoutHandle handle);
130 
131 CompWatchFdHandle
132 compAddWatchFd (int	     fd,
133 		short int    events,
134 		CallBackProc callBack,
135 		void	     *closure);
136 
137 void
138 compRemoveWatchFd (CompWatchFdHandle handle);
139 
140 short int
141 compWatchFdEvents (CompWatchFdHandle handle);
142 
143 CompBool
144 compInitMetadata (CompMetadata *metadata);
145 
146 CompBool
147 compInitPluginMetadata (CompMetadata *metadata,
148 			const char   *plugin);
149 
150 void
151 compFiniMetadata (CompMetadata *metadata);
152 
153 CompBool
154 compAddMetadataFromFile (CompMetadata *metadata,
155 			 const char   *file);
156 
157 CompBool
158 compAddMetadataFromString (CompMetadata *metadata,
159 			   const char	*string);
160 
161 CompBool
162 compAddMetadataFromIO (CompMetadata	     *metadata,
163 		       xmlInputReadCallback  ioread,
164 		       xmlInputCloseCallback ioclose,
165 		       void		     *ioctx);
166 
167 char *
168 compGetStringFromMetadataPath (CompMetadata *metadata,
169 			       const char   *path);
170 
171 int
172 compReadXmlChunk (const char *src,
173 		  int	     *offset,
174 		  char	     *buffer,
175 		  int	     length);
176 
177 
178 COMPIZ_END_DECLS
179 
180 #endif
181