|
|
|||
File indexing completed on 2026-10-02 09:26:34
0001 /* 0002 0003 Copyright 1989, 1998 The Open Group 0004 0005 Permission to use, copy, modify, distribute, and sell this software and its 0006 documentation for any purpose is hereby granted without fee, provided that 0007 the above copyright notice appear in all copies and that both that 0008 copyright notice and this permission notice appear in supporting 0009 documentation. 0010 0011 The above copyright notice and this permission notice shall be included in 0012 all copies or substantial portions of the Software. 0013 0014 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 0015 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 0016 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 0017 OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN 0018 AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 0019 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 0020 0021 Except as contained in this notice, the name of The Open Group shall not be 0022 used in advertising or otherwise to promote the sale, use or other dealings 0023 in this Software without prior written authorization from The Open Group. 0024 0025 */ 0026 0027 /* 0028 * Author: Chris D. Peterson, MIT X Consortium 0029 */ 0030 0031 /************************************************************ 0032 0033 The Editres Protocol 0034 0035 0036 The Client message sent to the application is: 0037 0038 ATOM = "ResEditor" --- RES_EDITOR_NAME 0039 0040 FORMAT = 32 --- RES_EDIT_SEND_EVENT_FORMAT 0041 0042 l[0] = timestamp 0043 l[1] = command atom name 0044 l[2] = ident of command 0045 l[3] = protocol version number to use 0046 0047 0048 0049 The binary protocol has the following format: 0050 0051 Card8: 8-bit unsigned integer 0052 Card16: 16-bit unsigned integer 0053 Card32: 32-bit unsigned integer 0054 Int16: 16-bit signed integer 0055 Window: 64-bit unsigned value 0056 Widget: 64-bit unsigned value 0057 String8: ListOfCard8 0058 0059 [a][b][c] represent an exclusive list of choices. 0060 0061 All widgets are passed as a list of widgets, containing the 0062 full instance heirarchy of this widget. The hierarchy is ordered 0063 from parent to child. Thus the first element of each list is 0064 the root of the widget tree (this makes verifying that the widget 0065 still exists, MUCH faster). 0066 0067 ListOfFoo comprises a list of things in the following format: 0068 0069 number: Card16 0070 <number> things: ???? 0071 0072 This is a synchronous protocol, every request MUST be followed by a 0073 reply. 0074 0075 Request: 0076 0077 Serial Number: Card8 0078 Op Code: Card8 - { SendWidgetTree = 0, 0079 SetValues = 1, 0080 GetResources = 2, 0081 GetGeometry = 3, 0082 FindChild = 4, 0083 GetValues = 5 } 0084 Length: Card32 0085 Data: 0086 0087 Reply: 0088 0089 Serial Number: Card8 0090 Type: Card8 - { Formatted = 0, 0091 Unformatted = 1, 0092 ProtocolMismatch = 2 0093 } 0094 Length: Card32 0095 0096 0097 Byte Order: 0098 0099 All Fields are MSB -> LSB 0100 0101 Data: 0102 0103 Formatted: 0104 0105 The data contains the reply information for the request as 0106 specified below if the reply type is "Formatted". The return 0107 values for the other reply types are shown below. 0108 0109 Unformatted: 0110 0111 Message: String8 0112 0113 ProtocolMismatch: 0114 0115 RequestedVersion: Card8 0116 0117 ------------------------------------------------------------ 0118 0119 SendWidgetTree: 0120 0121 ---> 0122 0123 Number of Entries: Card16 0124 Entry: 0125 widget: ListOfWidgets 0126 name: String8 0127 class: String8 0128 window: Card32 0129 toolkit: String8 0130 0131 SendWidgetTree returns the toolkit type, and a fully specified list 0132 of widgets for each widget in the tree. This is enough information 0133 to completely reconstruct the entire widget hierarchy. 0134 0135 The window return value contains the Xid of the window currently 0136 used by this widget. If the widget is unrealized then 0 is returned, 0137 and if widget is a non-windowed object a value of 2 is returned. 0138 0139 SetValues: 0140 0141 name: String8 0142 type: String8 0143 value: String8 0144 Number of Entries: Card16 0145 Entry: 0146 widget: ListOfWidgets 0147 0148 ---> 0149 0150 Number of Entries: Card16 0151 Entry: 0152 widget: ListOfWidgets 0153 message: String8 0154 0155 SetValues will allow the same resource to be set on a number of 0156 widgets. This function will return an error message if the SetValues 0157 request caused an Xt error. 0158 0159 GetValues: 0160 0161 names: ListOfString8 0162 widget: Widget 0163 0164 ---> 0165 novalues: ListOfCard16 0166 values: ListOfString8 0167 0168 GetValues will allow a number of resource values to be read 0169 on a particular widget. The request specifies the names of 0170 the resources wanted and the widget id these resources are 0171 from. The reply returns a list of indices from the requests 0172 name list of resources for which a value can not be returned. 0173 It also returns a list of returned values, in the order of the 0174 requests names list, skipping those indices present in novalues. 0175 0176 GetResources: 0177 0178 Number of Entries: Card16 0179 Entry 0180 widget: ListOfWidgets: 0181 0182 ----> 0183 0184 Number of Entries: Card16 0185 Entry 0186 Widget: ListOfWidgets: 0187 Error: Bool 0188 0189 [ Message: String 8 ] 0190 [ Number of Resources: Card16 0191 Resource: 0192 Kind: {normal, constraint} 0193 Name: String8 0194 Class: String8 0195 Type: String8 ] 0196 0197 GetResources retrieves the kind, name, class, and type for every 0198 widget passed to it. If an error occurred with the resource fetch 0199 Error will be set to True for the given widget and a message 0200 is returned rather than the resource info. 0201 0202 GetGeometry: 0203 0204 Number of Entries: Card16 0205 Entry 0206 Widget: ListOfWidgets: 0207 0208 ----> 0209 0210 Number of Entries: Card16 0211 Entry 0212 Widget: ListOfWidgets: 0213 Error: Bool 0214 0215 [ message: String 8 ] 0216 [ mapped: Boolean 0217 X: Int16 0218 Y: Int16 0219 Width: Card16 0220 Height: Card16 0221 BorderWidth: Card16 ] 0222 0223 GetGeometry retrieves the mapping state, x, y, width, height 0224 and border width for each widget specified. If an error occurred 0225 with the geometry fetch "Error" will be set to True for the given 0226 widget and a message is returned rather than the geometry info. 0227 X an Y correspond to the root coordinates of the upper left corner 0228 of the widget (outside the window border). 0229 0230 FindChild: 0231 0232 Widget: ListOfWidgets 0233 X: Int16 0234 Y: Int16 0235 0236 ---> 0237 0238 Widget: ListOfWidgets 0239 0240 FindChild returns a descendent of the widget specified that 0241 is at the root coordinates specified. 0242 0243 NOTE: 0244 0245 The returned widget is undefined if the point is contained in 0246 two or more mapped widgets, or in two overlapping Rect objs. 0247 0248 GetValues: 0249 0250 names: ListOfString8 0251 widget: Widget 0252 0253 ---> 0254 0255 values: ListOfString8 0256 0257 GetValues will allow a number of resource values to be read 0258 on a particular widget. Currently only InterViews 3.0.1 Styles 0259 and their attributes are supported. In addition, the current 0260 user interface only supports the return of 1 resource. The ability 0261 to specify and return multiple resources is defined for future editres 0262 interfaces where some or all of a widgets resource values are returned 0263 and displayed at once. 0264 0265 0266 ************************************************************/ 0267 0268 #include <stdint.h> 0269 #include <X11/Intrinsic.h> 0270 #include <X11/Xfuncproto.h> 0271 #include <X11/Xmd.h> 0272 0273 #define XER_NBBY 8 /* number of bits in a byte */ 0274 #define BYTE_MASK 255 0275 0276 #define HEADER_SIZE 6 0277 0278 #define EDITRES_IS_OBJECT 2 0279 #define EDITRES_IS_UNREALIZED 0 0280 0281 /* 0282 * Format for atoms 0283 */ 0284 #define EDITRES_FORMAT 8 0285 #define EDITRES_SEND_EVENT_FORMAT 32 0286 0287 /* 0288 * Atoms 0289 */ 0290 #define EDITRES_NAME "Editres" 0291 #define EDITRES_COMMAND_ATOM "EditresCommand" 0292 #define EDITRES_COMM_ATOM "EditresComm" 0293 #define EDITRES_CLIENT_VALUE "EditresClientVal" 0294 #define EDITRES_PROTOCOL_ATOM "EditresProtocol" 0295 #define ID2WIDGET(X) ((Widget)(void *)(uintptr_t)((X))) 0296 0297 typedef enum { 0298 SendWidgetTree = 0, 0299 SetValues = 1, 0300 GetResources = 2, 0301 GetGeometry = 3, 0302 FindChild = 4, 0303 GetValues = 5 0304 } EditresCommand; 0305 0306 typedef enum { 0307 NormalResource = 0, 0308 ConstraintResource = 1 0309 } ResourceType; 0310 0311 /* 0312 * The type of a resource identifier 0313 */ 0314 typedef unsigned char ResIdent; 0315 0316 typedef enum { 0317 PartialSuccess = 0, 0318 Failure = 1, 0319 ProtocolMismatch = 2 0320 } EditResError; 0321 0322 typedef struct _WidgetInfo { 0323 unsigned short num_widgets; 0324 CARD64 *ids; 0325 Widget real_widget; 0326 } WidgetInfo; 0327 0328 typedef struct _ProtocolStream { 0329 unsigned long size, alloc; 0330 unsigned char *real_top, *top, *current; 0331 } ProtocolStream; 0332 0333 /************************************************************ 0334 * Function definitions for reading and writing protocol requests 0335 ************************************************************/ 0336 _XFUNCPROTOBEGIN 0337 0338 void _XEditResPutString8 0339 ( 0340 ProtocolStream *stream, 0341 _Xconst char *str 0342 ); 0343 0344 void _XEditResPut8 0345 ( 0346 ProtocolStream *stream, 0347 unsigned int value 0348 ); 0349 0350 void _XEditResPut16 0351 ( 0352 ProtocolStream *stream, 0353 unsigned int value 0354 ); 0355 0356 void _XEditResPut32 0357 ( 0358 ProtocolStream *stream, 0359 unsigned long value 0360 ); 0361 0362 void _XEditResPut64 0363 ( 0364 ProtocolStream *stream, 0365 CARD64 value 0366 ); 0367 0368 0369 void _XEditResPutWidgetInfo 0370 ( 0371 ProtocolStream *stream, 0372 WidgetInfo *info 0373 ); 0374 0375 void _XEditResResetStream 0376 ( 0377 ProtocolStream *stream 0378 ); 0379 0380 void _XEditResFreeStream 0381 ( 0382 ProtocolStream *stream 0383 ); 0384 0385 Bool _XEditResGet8 0386 ( 0387 ProtocolStream *stream, 0388 unsigned char *value 0389 ); 0390 0391 Bool _XEditResGet16 0392 ( 0393 ProtocolStream *stream, 0394 unsigned short *value 0395 ); 0396 0397 Bool _XEditResGetSigned16 0398 ( 0399 ProtocolStream *stream, 0400 short *value 0401 ); 0402 0403 Bool _XEditResGet32 0404 ( 0405 ProtocolStream *stream, 0406 unsigned long *value 0407 ); 0408 0409 Bool _XEditResGet64 0410 ( 0411 ProtocolStream *stream, 0412 CARD64 *value 0413 ); 0414 0415 Bool _XEditResGetString8 0416 ( 0417 ProtocolStream *stream, 0418 char **str 0419 ); 0420 0421 Bool _XEditResGetWidgetInfo 0422 ( 0423 ProtocolStream *stream, 0424 WidgetInfo *info 0425 ); 0426 0427 _XFUNCPROTOEND
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|