comparison src/epoch.c @ 20:859a2309aef8 r19-15b93

Import from CVS: tag r19-15b93
author cvs
date Mon, 13 Aug 2007 08:50:05 +0200
parents 9ee227acff29
children
comparison
equal deleted inserted replaced
19:ac1f612d5250 20:859a2309aef8
132 } 132 }
133 133
134 /* 134 /*
135 * Epoch equivalent: epoch::resourcep 135 * Epoch equivalent: epoch::resourcep
136 */ 136 */
137 DEFUN ("x-resource-p", Fx_resource_p, Sx_resource_p, 1, 1, 0 /* 137 DEFUN ("x-resource-p", Fx_resource_p, 1, 1, 0, /*
138 Return non-nil if OBJECT is an X resource object. 138 Return non-nil if OBJECT is an X resource object.
139 */ ) 139 */
140 (object) 140 (object))
141 Lisp_Object object;
142 { 141 {
143 return (X_RESOURCEP (object) ? Qt : Qnil); 142 return (X_RESOURCEP (object) ? Qt : Qnil);
144 } 143 }
145 144
146 DEFUN ("x-resource-live-p", Fx_resource_live_p, Sx_resource_live_p, 1, 1, 0 /* 145 DEFUN ("x-resource-live-p", Fx_resource_live_p, 1, 1, 0, /*
147 Return non-nil if OBJECT is a live X resource object. 146 Return non-nil if OBJECT is a live X resource object.
148 That means that the X resource's device is live. 147 That means that the X resource's device is live.
149 */ ) 148 */
150 (object) 149 (object))
151 Lisp_Object object;
152 { 150 {
153 return (X_RESOURCEP (object) && 151 return (X_RESOURCEP (object) &&
154 X_RESOURCE_LIVE_P (XX_RESOURCE (object)) ? Qt : Qnil); 152 X_RESOURCE_LIVE_P (XX_RESOURCE (object)) ? Qt : Qnil);
155 } 153 }
156 154
157 DEFUN ("x-resource-device", Fx_resource_device, Sx_resource_device, 1, 1, 0 /* 155 DEFUN ("x-resource-device", Fx_resource_device, 1, 1, 0, /*
158 Return the device that OBJECT (an X resource object) exists on. 156 Return the device that OBJECT (an X resource object) exists on.
159 */ ) 157 */
160 (object) 158 (object))
161 Lisp_Object object;
162 { 159 {
163 CHECK_LIVE_X_RESOURCE (object); 160 CHECK_LIVE_X_RESOURCE (object);
164 return XX_RESOURCE (object)->device; 161 return XX_RESOURCE (object)->device;
165 } 162 }
166 163
167 /* 164 /*
168 * Epoch equivalent: epoch::set-resource-type 165 * Epoch equivalent: epoch::set-resource-type
169 */ 166 */
170 DEFUN ("set-x-resource-type", Fset_x_resource_type, Sset_x_resource_type, 167 DEFUN ("set-x-resource-type", Fset_x_resource_type, 2, 2, 0, /*
171 2, 2, 0 /*
172 Set the type of RESOURCE to TYPE. The new type must be an atom. 168 Set the type of RESOURCE to TYPE. The new type must be an atom.
173 */ ) 169 */
174 (resource, type) 170 (resource, type))
175 Lisp_Object resource, type;
176 { 171 {
177 CHECK_LIVE_X_RESOURCE (resource); 172 CHECK_LIVE_X_RESOURCE (resource);
178 CHECK_LIVE_X_RESOURCE (type); 173 CHECK_LIVE_X_RESOURCE (type);
179 174
180 if (XX_RESOURCE (type)->type != XA_ATOM) 175 if (XX_RESOURCE (type)->type != XA_ATOM)
217 } 212 }
218 213
219 /* 214 /*
220 * Epoch equivalent: epoch::intern-atom 215 * Epoch equivalent: epoch::intern-atom
221 */ 216 */
222 DEFUN ("x-intern-atom", Fx_intern_atom, Sx_intern_atom, 1, 2, 0 /* 217 DEFUN ("x-intern-atom", Fx_intern_atom, 1, 2, 0, /*
223 Convert a string or symbol into an atom and return as an X resource. 218 Convert a string or symbol into an atom and return as an X resource.
224 Optional argument DEVICE specifies the display connection and defaults 219 Optional argument DEVICE specifies the display connection and defaults
225 to the selected device. 220 to the selected device.
226 */ ) 221 */
227 (name, device) 222 (name, device))
228 Lisp_Object name, device;
229 { 223 {
230 Atom atom; 224 Atom atom;
231 struct device *d = decode_x_device (device); 225 struct device *d = decode_x_device (device);
232 226
233 XSETDEVICE (device, d); 227 XSETDEVICE (device, d);
236 } 230 }
237 231
238 /* 232 /*
239 * Epoch equivalent: epoch::unintern-atom 233 * Epoch equivalent: epoch::unintern-atom
240 */ 234 */
241 DEFUN ("x-atom-name", Fx_atom_name, Sx_atom_name, 1, 1, 0 /* 235 DEFUN ("x-atom-name", Fx_atom_name, 1, 1, 0, /*
242 Return the name of an X atom resource as a string. 236 Return the name of an X atom resource as a string.
243 */ ) 237 */
244 (atom) 238 (atom))
245 Lisp_Object atom;
246 { 239 {
247 Lisp_Object val; 240 Lisp_Object val;
248 241
249 CHECK_LIVE_X_RESOURCE (atom); 242 CHECK_LIVE_X_RESOURCE (atom);
250 if (XX_RESOURCE (atom)->type != XA_ATOM) 243 if (XX_RESOURCE (atom)->type != XA_ATOM)
258 } 251 }
259 252
260 /* 253 /*
261 * Epoch equivalent: epoch::string-to-resource 254 * Epoch equivalent: epoch::string-to-resource
262 */ 255 */
263 DEFUN ("string-to-x-resource", Fstring_to_x_resource, 256 DEFUN ("string-to-x-resource", Fstring_to_x_resource, 2, 3, 0, /*
264 Sstring_to_x_resource, 2, 3, 0 /*
265 Convert a numeric STRING to an X-RESOURCE. 257 Convert a numeric STRING to an X-RESOURCE.
266 STRING is assumed to represent a 32-bit numer value. X-RESOURCE must be 258 STRING is assumed to represent a 32-bit numer value. X-RESOURCE must be
267 an X atom. Optional BASE argument should be a number between 2 and 36, 259 an X atom. Optional BASE argument should be a number between 2 and 36,
268 specifying the base for converting STRING. 260 specifying the base for converting STRING.
269 */ ) 261 */
270 (string, type, base) 262 (string, type, base))
271 Lisp_Object string, type, base;
272 { 263 {
273 XID xid; 264 XID xid;
274 struct Lisp_X_Resource *xr; 265 struct Lisp_X_Resource *xr;
275 char *ptr; 266 char *ptr;
276 int b; 267 int b;
299 } 290 }
300 291
301 /* 292 /*
302 * Epoch equivalent: epoch::resource-to-type 293 * Epoch equivalent: epoch::resource-to-type
303 */ 294 */
304 DEFUN ("x-resource-to-type", Fx_resource_to_type, Sx_resource_to_type, 295 DEFUN ("x-resource-to-type", Fx_resource_to_type, 1, 1, 0, /*
305 1, 1, 0 /*
306 Return an x-resource of type ATOM whose value is the type of the argument 296 Return an x-resource of type ATOM whose value is the type of the argument
307 */ ) 297 */
308 (resource) 298 (resource))
309 Lisp_Object resource;
310 { 299 {
311 struct Lisp_X_Resource *xr; 300 struct Lisp_X_Resource *xr;
312 301
313 CHECK_LIVE_X_RESOURCE (resource); 302 CHECK_LIVE_X_RESOURCE (resource);
314 xr = XX_RESOURCE (resource); 303 xr = XX_RESOURCE (resource);
335 } 324 }
336 325
337 /* 326 /*
338 * Epoch equivalent: epoch::resource-to-string 327 * Epoch equivalent: epoch::resource-to-string
339 */ 328 */
340 DEFUN ("x-resource-to-string", Fx_resource_to_string, Sx_resource_to_string, 329 DEFUN ("x-resource-to-string", Fx_resource_to_string, 1, 2, 0, /*
341 1, 2, 0 /*
342 Convert the xid of RESOURCE to a numeric string. 330 Convert the xid of RESOURCE to a numeric string.
343 Optional BASE specifies the base for the conversion (2..36 inclusive) 331 Optional BASE specifies the base for the conversion (2..36 inclusive)
344 */ ) 332 */
345 (resource, base) 333 (resource, base))
346 Lisp_Object resource, base;
347 { 334 {
348 int cbase = 10; 335 int cbase = 10;
349 336
350 CHECK_LIVE_X_RESOURCE (resource); 337 CHECK_LIVE_X_RESOURCE (resource);
351 if (!NILP (base)) 338 if (!NILP (base))
359 } 346 }
360 347
361 /* 348 /*
362 * Epoch equivalent: epoch::xid-of-frame 349 * Epoch equivalent: epoch::xid-of-frame
363 */ 350 */
364 DEFUN ("x-id-of-frame", Fx_id_of_frame, Sx_id_of_frame, 0, 1, 0 /* 351 DEFUN ("x-id-of-frame", Fx_id_of_frame, 0, 1, 0, /*
365 Return the window ID of FRAME as an x-resource. 352 Return the window ID of FRAME as an x-resource.
366 This differs from `x-window-id' in that its return value is an 353 This differs from `x-window-id' in that its return value is an
367 x-resource rather than a string. 354 x-resource rather than a string.
368 */ ) 355 */
369 (frame) 356 (frame))
370 Lisp_Object frame;
371 { 357 {
372 struct frame *f = decode_x_frame (frame); 358 struct frame *f = decode_x_frame (frame);
373 359
374 return make_x_resource (XtWindow (FRAME_X_SHELL_WIDGET (f)), XA_WINDOW, 360 return make_x_resource (XtWindow (FRAME_X_SHELL_WIDGET (f)), XA_WINDOW,
375 FRAME_DEVICE (f)); 361 FRAME_DEVICE (f));
406 } 392 }
407 393
408 /* 394 /*
409 * Epoch equivalent: epoch::query-tree 395 * Epoch equivalent: epoch::query-tree
410 */ 396 */
411 DEFUN ("x-query-tree", Fx_query_tree, Sx_query_tree, 0, 1, 0 /* 397 DEFUN ("x-query-tree", Fx_query_tree, 0, 1, 0, /*
412 Return the portion of the window tree adjacent to FRAME. 398 Return the portion of the window tree adjacent to FRAME.
413 Return value is the list ( ROOT PARENT . CHILDREN ). The FRAME arg 399 Return value is the list ( ROOT PARENT . CHILDREN ). The FRAME arg
414 can either be a frame object or an x-resource of type window. 400 can either be a frame object or an x-resource of type window.
415 */ ) 401 */
416 (frame) 402 (frame))
417 Lisp_Object frame;
418 { 403 {
419 Window win; 404 Window win;
420 Window root, parent, *children; 405 Window root, parent, *children;
421 unsigned int count; 406 unsigned int count;
422 int retval; 407 int retval;
1030 } 1015 }
1031 1016
1032 /* 1017 /*
1033 * Epoch equivalent: epoch::get-property 1018 * Epoch equivalent: epoch::get-property
1034 */ 1019 */
1035 DEFUN ("x-get-property", Fx_get_property, Sx_get_property, 1, 2, 0 /* 1020 DEFUN ("x-get-property", Fx_get_property, 1, 2, 0, /*
1036 Retrieve the X window property for a frame. Arguments are 1021 Retrieve the X window property for a frame. Arguments are
1037 PROPERTY: must be a string or an X-resource of type ATOM. 1022 PROPERTY: must be a string or an X-resource of type ATOM.
1038 FRAME: (optional) If present, must be a frame object, a frame id, or 1023 FRAME: (optional) If present, must be a frame object, a frame id, or
1039 and X-resource of type WINDOW. Defaults to the current frame. 1024 and X-resource of type WINDOW. Defaults to the current frame.
1040 Returns the value of the property, or nil if the property couldn't 1025 Returns the value of the property, or nil if the property couldn't
1041 be retrieved. 1026 be retrieved.
1042 */ ) 1027 */
1043 (name, frame) 1028 (name, frame))
1044 Lisp_Object name, frame;
1045 { 1029 {
1046 Atom prop = None; 1030 Atom prop = None;
1047 Lisp_Object device; 1031 Lisp_Object device;
1048 Display *dpy; 1032 Display *dpy;
1049 Window win; 1033 Window win;
1101 xfree (addr); 1085 xfree (addr);
1102 1086
1103 return value; 1087 return value;
1104 } 1088 }
1105 1089
1106 DEFUN ("x-set-property", Fx_set_property, Sx_set_property, 2, 3, 0 /* 1090 DEFUN ("x-set-property", Fx_set_property, 2, 3, 0, /*
1107 Set a named property for a frame. The first argument (required) 1091 Set a named property for a frame. The first argument (required)
1108 is the name of the property. The second is the value to set the propery 1092 is the name of the property. The second is the value to set the propery
1109 to. The third (optional) is the frame, default is 1093 to. The third (optional) is the frame, default is
1110 the current frame. 1094 the current frame.
1111 */ ) 1095 */
1112 (name, value, frame) 1096 (name, value, frame))
1113 Lisp_Object name, value, frame;
1114 { 1097 {
1115 Atom prop = None; /* name of the property */ 1098 Atom prop = None; /* name of the property */
1116 Lisp_Object device; 1099 Lisp_Object device;
1117 Display *dpy; 1100 Display *dpy;
1118 Window win; 1101 Window win;
1149 } 1132 }
1150 1133
1151 /* 1134 /*
1152 * Epoch equivalent: epoch::send-client-message 1135 * Epoch equivalent: epoch::send-client-message
1153 */ 1136 */
1154 DEFUN ("x-send-client-message", Fx_send_client_message, Sx_send_client_message, 1137 DEFUN ("x-send-client-message", Fx_send_client_message, 1, 5, 0, /*
1155 1, 5, 0 /*
1156 Send a client message to DEST, marking it as being from SOURCE. 1138 Send a client message to DEST, marking it as being from SOURCE.
1157 The message is DATA of TYPE with FORMAT. If TYPE and FORMAT are omitted, 1139 The message is DATA of TYPE with FORMAT. If TYPE and FORMAT are omitted,
1158 they are deduced from DATA. If SOURCE is nil, the current frame is used. 1140 they are deduced from DATA. If SOURCE is nil, the current frame is used.
1159 */ ) 1141 */
1160 (dest, source, data, type, format) 1142 (dest, source, data, type, format))
1161 Lisp_Object dest, source, data, type, format;
1162 { 1143 {
1163 /* !!#### This function has not been Mule-ized */ 1144 /* !!#### This function has not been Mule-ized */
1164 int actual_format = 0; 1145 int actual_format = 0;
1165 Atom actual_type; 1146 Atom actual_type;
1166 unsigned long count; 1147 unsigned long count;
1341 1322
1342 1323
1343 void 1324 void
1344 syms_of_epoch (void) 1325 syms_of_epoch (void)
1345 { 1326 {
1346 defsubr (&Sx_intern_atom); 1327 DEFSUBR (Fx_intern_atom);
1347 defsubr (&Sx_atom_name); 1328 DEFSUBR (Fx_atom_name);
1348 defsubr (&Sstring_to_x_resource); 1329 DEFSUBR (Fstring_to_x_resource);
1349 defsubr (&Sx_resource_to_type); 1330 DEFSUBR (Fx_resource_to_type);
1350 defsubr (&Sx_resource_to_string); 1331 DEFSUBR (Fx_resource_to_string);
1351 defsubr (&Sx_id_of_frame); 1332 DEFSUBR (Fx_id_of_frame);
1352 defsubr (&Sx_query_tree); 1333 DEFSUBR (Fx_query_tree);
1353 defsubr (&Sx_get_property); 1334 DEFSUBR (Fx_get_property);
1354 defsubr (&Sx_set_property); 1335 DEFSUBR (Fx_set_property);
1355 defsubr (&Sx_send_client_message); 1336 DEFSUBR (Fx_send_client_message);
1356 defsubr (&Sx_resource_p); 1337 DEFSUBR (Fx_resource_p);
1357 defsubr (&Sx_resource_device); 1338 DEFSUBR (Fx_resource_device);
1358 defsubr (&Sx_resource_live_p); 1339 DEFSUBR (Fx_resource_live_p);
1359 defsubr (&Sset_x_resource_type); 1340 DEFSUBR (Fset_x_resource_type);
1360 1341
1361 defsymbol (&Qx_resourcep, "x-resource-p"); 1342 defsymbol (&Qx_resourcep, "x-resource-p");
1362 defsymbol (&Qx_resource_live_p, "x-resource-live-p"); 1343 defsymbol (&Qx_resource_live_p, "x-resource-live-p");
1363 defsymbol (&Qx_property_change, "x-property-change"); 1344 defsymbol (&Qx_property_change, "x-property-change");
1364 defsymbol (&Qx_client_message, "x-client-message"); 1345 defsymbol (&Qx_client_message, "x-client-message");