1 /*
2 * @OPENGROUP_COPYRIGHT@
3 * COPYRIGHT NOTICE
4 * Copyright (c) 1990, 1991, 1992, 1993 Open Software Foundation, Inc.
5 * Copyright (c) 1996, 1997, 1998, 1999, 2000 The Open Group
6 * ALL RIGHTS RESERVED (MOTIF). See the file named COPYRIGHT.MOTIF for
7 * the full copyright text.
8 *
9 * This software is subject to an open license. It may only be
10 * used on, with or for operating systems which are themselves open
11 * source systems. You must contact The Open Group for a license
12 * allowing distribution and sublicensing of this software on, with,
13 * or for operating systems which are not Open Source programs.
14 *
15 * See http://www.opengroup.org/openmotif/license for full
16 * details of the license agreement. Any use, reproduction, or
17 * distribution of the program constitutes recipient's acceptance of
18 * this agreement.
19 *
20 * EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS
21 * PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
22 * KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY
23 * WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY
24 * OR FITNESS FOR A PARTICULAR PURPOSE
25 *
26 * EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT
27 * NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT,
28 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29 * DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED
30 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
32 * ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE
33 * EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE
34 * POSSIBILITY OF SUCH DAMAGES.
35 *
36 */
37 /*
38 * HISTORY
39 */
40
41
42 /* $XConsortium: RegEditI.h /main/4 1995/07/14 10:05:01 drk $ */
43
44 /*
45
46 Copyright (c) 1989 X Consortium
47
48 Permission is hereby granted, free of charge, to any person obtaining a copy
49 of this software and associated documentation files (the "Software"), to deal
50 in the Software without restriction, including without limitation the rights
51 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
52 copies of the Software, and to permit persons to whom the Software is
53 furnished to do so, subject to the following conditions:
54
55 The above copyright notice and this permission notice shall be included in
56 all copies or substantial portions of the Software.
57
58 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
59 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
60 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
61 X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
62 AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
63 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
64
65 Except as contained in this notice, the name of the X Consortium shall not be
66 used in advertising or otherwise to promote the sale, use or other dealings
67 in this Software without prior written authorization from the X Consortium.
68
69 */
70
71 /*
72 * Author: Chris D. Peterson, MIT X Consortium
73 */
74
75 /************************************************************
76
77 The Editres Protocol
78
79
80 The Client message sent to the application is:
81
82 ATOM = "ResEditor" --- RES_EDITOR_NAME
83
84 FORMAT = 32 --- RES_EDIT_SEND_EVENT_FORMAT
85
86 l[0] = timestamp
87 l[1] = command atom name
88 l[2] = ident of command.
89 l[3] = protocol version number to use.
90
91
92
93 The binary protocol has the following format:
94
95 Card8: 8-bit unsingned integer
96 Card16: 16-bit unsingned integer
97 Card32: 32-bit unsingned integer
98 Int16: 16-bit signed integer
99 Window: 32-bit value
100 Widget: 32-bit value
101 String8: ListOfCard8
102
103 [a][b][c] represent an exclusive list of choices.
104
105 All widgets are passed as a list of widgets, containing the
106 full instance heirarch of this widget. The hierarchy is ordered
107 from parent to child. Thus the first element of each list is
108 the root of the widget tree (this makes verifying that the widget
109 still exists, MUCH faster).
110
111 ListOfFoo comprises a list of things in the following format:
112
113 number: Card16
114 <number> things: ????
115
116 This is a synchronous protocol, every request MUST be followed by a
117 reply.
118
119 Request:
120
121 Serial Number: Card8
122 Op Code: Card8 - { SendWidgetTree = 0,
123 SetValues = 1,
124 GetResources = 2,
125 GetGeometry = 3,
126 FindChild = 4,
127 GetValues = 5 }
128 Length: Card32
129 Data:
130
131 Reply:
132
133 Serial Number: Card8
134 Type: Card8 - { Formatted = 0,
135 Unformatted = 1,
136 ProtocolMismatch = 2
137 }
138 Length: Card32
139
140
141 Byte Order:
142
143 All Fields are MSB -> LSB
144
145 Data:
146
147 Formatted:
148
149 The data contains the reply information for the request as
150 specified below if the reply type is "Formatted". The return
151 values for the other reply types are shown below.
152
153 Unformatted:
154
155 Message: String8
156
157 ProtocolMismatch:
158
159 RequestedVersion: Card8
160
161 ------------------------------------------------------------
162
163 SendWidgetTree:
164
165 --->
166
167 Number of Entries: Card16
168 Entry:
169 widget: ListOfWidgets
170 name: String8
171 class: String8
172 window: Card32
173 toolkit: String8
174
175 Send Widget Tree returns the toolkit type, and a fuly specified list
176 of widgets for each widget in the tree. This is enough information
177 to completely reconstruct the entire widget heirarchy.
178
179 The window return value contains the Xid of the window currently
180 used by this widget. If the widget is unrealized then 0 is returned,
181 and if widget is a non-windowed object a value of 2 is returned.
182
183 SetValues:
184
185 name: String8
186 type: String8
187 value: String8
188 Number of Entries: Card16
189 Entry:
190 widget: ListOfWidgets
191
192 --->
193
194 Number of Entries: Card16
195 Entry:
196 widget: ListOfWidgets
197 message: String8
198
199 SetValues will allow the same resource to be set on a number of
200 widgets. This function will return an error message if the SetValues
201 request caused an Xt error.
202
203 GetValues:
204
205 names: ListOfString8
206 widget: Widget
207
208 --->
209 novalues: ListOfCard16
210 values: ListOfString8
211
212 GetValues will allow a number of resource values to be read
213 on a particular widget. The request specifies the names of
214 the resources wanted and the widget id these resources are
215 from. The reply returns a list of indices from the requests
216 name list of resources for which a value can not be returned.
217 It also returns a list of returned values, in the order of the
218 requests names list, skipping those indices present in novalues.
219
220 GetResources:
221
222 Number of Entries: Card16
223 Entry
224 widget: ListOfWidgets:
225
226 ---->
227
228 Number of Entries: Card16
229 Entry
230 Widget: ListOfWidgets:
231 Error: Bool
232
233 [ Message: String 8 ]
234 [ Number of Resources: Card16
235 Resource:
236 Kind: {normal, constraint}
237 Name: String8
238 Class: String8
239 Type: String8 ]
240
241 GetResource retrieves the kind, name, class and type for every
242 widget passed to it. If an error occured with the resource fetch
243 Error will be set to True for the given widget and a message
244 is returned rather than the resource info.
245
246 GetGeometry:
247
248 Number of Entries: Card16
249 Entry
250 Widget: ListOfWidgets:
251
252 ---->
253
254 Number of Entries: Card16
255 Entry
256 Widget: ListOfWidgets:
257 Error: Bool
258
259 [ message: String 8 ]
260 [ mapped: Boolean
261 X: Int16
262 Y: Int16
263 Width: Card16
264 Height: Card16
265 BorderWidth: Card16 ]
266
267 GetGeometry retreives the mapping state, x, y, width, height
268 and border width for each widget specified. If an error occured
269 with the geometry fetch "Error" will be set to True for the given
270 widget and a message is returned rather than the geometry info.
271 X an Y corrospond to the root coordinates of the upper left corner
272 of the widget (outside the window border).
273
274 FindChild:
275
276 Widget: ListOfWidgets
277 X: Int16
278 Y: Int16
279
280 --->
281
282 Widget: ListOfWidgets
283
284 Find Child returns a descendent of the widget specified that
285 is at the root coordinates specified.
286
287 NOTE:
288
289 The returned widget is undefined if the point is contained in
290 two or more mapped widgets, or in two overlapping Rect objs.
291
292 GetValues:
293
294 names: ListOfString8
295 widget: Widget
296
297 --->
298
299 values: ListOfString8
300
301 GetValues will allow a number of resource values to be read
302 on a particular widget. Currently only InterViews 3.0.1 Styles
303 and their attributes are supported. In addition, the current
304 user interface only supports the return of 1 resource. The ability
305 to specify and return multiple resources is defined for future editres
306 interfaces where some or all of a widgets resource values are returned
307 and displayed at once.
308
309
310 ************************************************************/
311
312 #include <X11/Intrinsic.h>
313 #include <X11/Xfuncproto.h>
314
315 #define XER_NBBY 8 /* number of bits in a byte */
316 #define BYTE_MASK 255
317
318 #define HEADER_SIZE 6
319
320 #define EDITRES_IS_OBJECT 2
321 #define EDITRES_IS_UNREALIZED 0
322
323 /*
324 * Format for atoms.
325 */
326
327 #define EDITRES_FORMAT 8
328 #define EDITRES_SEND_EVENT_FORMAT 32
329
330 /*
331 * Atoms
332 */
333
334 #define EDITRES_NAME "Editres"
335 #define EDITRES_COMMAND_ATOM "EditresCommand"
336 #define EDITRES_COMM_ATOM "EditresComm"
337 #define EDITRES_CLIENT_VALUE "EditresClientVal"
338 #define EDITRES_PROTOCOL_ATOM "EditresProtocol"
339
340 typedef enum { SendWidgetTree = 0,
341 SetValues = 1,
342 GetResources = 2,
343 GetGeometry = 3,
344 FindChild = 4,
345 GetValues = 5
346 } EditresCommand;
347
348 typedef enum {NormalResource = 0, ConstraintResource = 1} ResourceType;
349
350 /*
351 * The type of a resource identifier.
352 */
353
354 typedef unsigned char ResIdent;
355
356 typedef enum {PartialSuccess= 0, Failure= 1, ProtocolMismatch= 2} EditResError;
357
358 typedef struct _WidgetInfo {
359 unsigned short num_widgets;
360 unsigned long * ids;
361 Widget real_widget;
362 } WidgetInfo;
363
364 typedef struct _ProtocolStream {
365 unsigned long size, alloc;
366 unsigned char *real_top, *top, *current;
367 } ProtocolStream;
368
369
|
This page was automatically generated by the
LXR engine.
|