0
|
1 /* X-specific Lisp objects.
|
|
2 Copyright (C) 1993, 1994 Free Software Foundation, Inc.
|
|
3 Copyright (C) 1995 Board of Trustees, University of Illinois.
|
|
4 Copyright (C) 1995 Tinker Systems
|
|
5 Copyright (C) 1995, 1996 Ben Wing
|
|
6 Copyright (C) 1995 Sun Microsystems
|
|
7
|
|
8 This file is part of XEmacs.
|
|
9
|
|
10 XEmacs is free software; you can redistribute it and/or modify it
|
|
11 under the terms of the GNU General Public License as published by the
|
|
12 Free Software Foundation; either version 2, or (at your option) any
|
|
13 later version.
|
|
14
|
|
15 XEmacs is distributed in the hope that it will be useful, but WITHOUT
|
|
16 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
17 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
18 for more details.
|
|
19
|
|
20 You should have received a copy of the GNU General Public License
|
|
21 along with XEmacs; see the file COPYING. If not, write to
|
|
22 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
23 Boston, MA 02111-1307, USA. */
|
|
24
|
|
25 /* Synched up with: Not in FSF. */
|
|
26
|
|
27 /* Original author: Jamie Zawinski for 19.8
|
|
28 font-truename stuff added by Jamie Zawinski for 19.10
|
|
29 subwindow support added by Chuck Thompson
|
|
30 additional XPM support added by Chuck Thompson
|
|
31 initial X-Face support added by Stig
|
185
|
32 rewritten/restructured by Ben Wing for 19.12/19.13
|
0
|
33 GIF/JPEG support added by Ben Wing for 19.14
|
|
34 PNG support added by Bill Perry for 19.14
|
|
35 Improved GIF/JPEG support added by Bill Perry for 19.14
|
|
36 Cleanup/simplification of error handling by Ben Wing for 19.14
|
|
37 Pointer/icon overhaul, more restructuring by Ben Wing for 19.14
|
|
38
|
|
39 TODO:
|
207
|
40 ImageMagick support
|
0
|
41 Convert images.el to C and stick it in here?
|
|
42 */
|
|
43
|
|
44 #include <config.h>
|
231
|
45 #include <setjmp.h>
|
0
|
46 #include "lisp.h"
|
|
47
|
|
48 #include "console-x.h"
|
|
49 #include "glyphs-x.h"
|
|
50 #include "objects-x.h"
|
|
51 #include "xmu.h"
|
|
52
|
|
53 #include "buffer.h"
|
|
54 #include "frame.h"
|
|
55 #include "insdel.h"
|
|
56 #include "opaque.h"
|
|
57
|
|
58 #include "sysfile.h"
|
|
59
|
207
|
60 #ifdef HAVE_IMAGEMAGICK
|
223
|
61 #define _XOS_H_
|
|
62 #ifdef MAGICK_HEADERS_ARE_UNDER_X11
|
|
63 #include <X11/magick/magick.h>
|
|
64 #else
|
217
|
65 #include <magick/magick.h>
|
223
|
66 #endif
|
215
|
67 /*#include <image.h>*/
|
223
|
68 /*#include <assert.h>*/
|
221
|
69
|
|
70 #define OLDCOMPAT /* allow lisp code using the old names to still function */
|
138
|
71 #endif
|
0
|
72
|
|
73 #define LISP_DEVICE_TO_X_SCREEN(dev) \
|
|
74 XDefaultScreenOfDisplay (DEVICE_X_DISPLAY (XDEVICE (dev)))
|
|
75
|
|
76 DEFINE_IMAGE_INSTANTIATOR_FORMAT (xbm);
|
|
77 Lisp_Object Qxbm;
|
|
78
|
|
79 Lisp_Object Q_mask_file, Q_mask_data, Q_hotspot_x, Q_hotspot_y;
|
|
80 Lisp_Object Q_foreground, Q_background;
|
|
81
|
|
82 #ifdef HAVE_XPM
|
|
83 DEFINE_IMAGE_INSTANTIATOR_FORMAT (xpm);
|
|
84 Lisp_Object Qxpm;
|
|
85 Lisp_Object Q_color_symbols;
|
|
86 #endif
|
|
87
|
|
88 #ifdef HAVE_XFACE
|
|
89 DEFINE_IMAGE_INSTANTIATOR_FORMAT (xface);
|
|
90 Lisp_Object Qxface;
|
|
91 #endif
|
|
92
|
207
|
93 #ifdef HAVE_IMAGEMAGICK
|
|
94 DEFINE_IMAGE_INSTANTIATOR_FORMAT (imagick);
|
|
95 Lisp_Object Qimagick;
|
221
|
96
|
|
97 #ifdef OLDCOMPAT /* old compatibility */
|
|
98 DEFINE_IMAGE_INSTANTIATOR_FORMAT (tiff);
|
|
99 DEFINE_IMAGE_INSTANTIATOR_FORMAT (png);
|
|
100 DEFINE_IMAGE_INSTANTIATOR_FORMAT (gif);
|
|
101 DEFINE_IMAGE_INSTANTIATOR_FORMAT (jpeg);
|
|
102 Lisp_Object Qtiff;
|
|
103 Lisp_Object Qpng;
|
|
104 Lisp_Object Qgif;
|
|
105 Lisp_Object Qjpeg;
|
|
106 #endif
|
0
|
107 #endif
|
|
108
|
|
109 DEFINE_IMAGE_INSTANTIATOR_FORMAT (cursor_font);
|
|
110 Lisp_Object Qcursor_font;
|
|
111
|
|
112 DEFINE_IMAGE_INSTANTIATOR_FORMAT (font);
|
|
113
|
122
|
114 DEFINE_IMAGE_INSTANTIATOR_FORMAT (autodetect);
|
0
|
115
|
|
116 static void cursor_font_instantiate (Lisp_Object image_instance,
|
|
117 Lisp_Object instantiator,
|
|
118 Lisp_Object pointer_fg,
|
|
119 Lisp_Object pointer_bg,
|
124
|
120 int dest_mask,
|
|
121 Lisp_Object domain);
|
0
|
122
|
|
123 #include "bitmaps.h"
|
|
124
|
|
125
|
|
126 /************************************************************************/
|
|
127 /* image instance methods */
|
|
128 /************************************************************************/
|
|
129
|
|
130 static void
|
|
131 x_print_image_instance (struct Lisp_Image_Instance *p,
|
|
132 Lisp_Object printcharfun,
|
|
133 int escapeflag)
|
|
134 {
|
|
135 char buf[100];
|
|
136
|
|
137 switch (IMAGE_INSTANCE_TYPE (p))
|
|
138 {
|
|
139 case IMAGE_MONO_PIXMAP:
|
|
140 case IMAGE_COLOR_PIXMAP:
|
|
141 case IMAGE_POINTER:
|
|
142 sprintf (buf, " (0x%lx", (unsigned long) IMAGE_INSTANCE_X_PIXMAP (p));
|
|
143 write_c_string (buf, printcharfun);
|
|
144 if (IMAGE_INSTANCE_X_MASK (p))
|
|
145 {
|
|
146 sprintf (buf, "/0x%lx", (unsigned long) IMAGE_INSTANCE_X_MASK (p));
|
|
147 write_c_string (buf, printcharfun);
|
|
148 }
|
|
149 write_c_string (")", printcharfun);
|
|
150 break;
|
114
|
151 #if HAVE_SUBWINDOWS
|
0
|
152 case IMAGE_SUBWINDOW:
|
|
153 /* #### implement me */
|
114
|
154 #endif
|
0
|
155 default:
|
|
156 break;
|
|
157 }
|
|
158 }
|
|
159
|
|
160 static void
|
|
161 x_finalize_image_instance (struct Lisp_Image_Instance *p)
|
|
162 {
|
|
163 if (!p->data)
|
|
164 return;
|
|
165
|
|
166 if (DEVICE_LIVE_P (XDEVICE (p->device)))
|
|
167 {
|
219
|
168 Display *dpy = DEVICE_X_DISPLAY (XDEVICE (p->device));
|
0
|
169
|
|
170 if (IMAGE_INSTANCE_X_PIXMAP (p))
|
219
|
171 XFreePixmap (dpy, IMAGE_INSTANCE_X_PIXMAP (p));
|
0
|
172 if (IMAGE_INSTANCE_X_MASK (p) &&
|
|
173 IMAGE_INSTANCE_X_MASK (p) != IMAGE_INSTANCE_X_PIXMAP (p))
|
219
|
174 XFreePixmap (dpy, IMAGE_INSTANCE_X_MASK (p));
|
0
|
175 IMAGE_INSTANCE_X_PIXMAP (p) = 0;
|
|
176 IMAGE_INSTANCE_X_MASK (p) = 0;
|
|
177
|
|
178 if (IMAGE_INSTANCE_X_CURSOR (p))
|
|
179 {
|
219
|
180 XFreeCursor (dpy, IMAGE_INSTANCE_X_CURSOR (p));
|
0
|
181 IMAGE_INSTANCE_X_CURSOR (p) = 0;
|
|
182 }
|
|
183
|
|
184 if (IMAGE_INSTANCE_X_NPIXELS (p) != 0)
|
|
185 {
|
219
|
186 XFreeColors (dpy,
|
|
187 DEVICE_X_COLORMAP (XDEVICE(p->device)),
|
0
|
188 IMAGE_INSTANCE_X_PIXELS (p),
|
|
189 IMAGE_INSTANCE_X_NPIXELS (p), 0);
|
|
190 IMAGE_INSTANCE_X_NPIXELS (p) = 0;
|
|
191 }
|
|
192 }
|
|
193 if (IMAGE_INSTANCE_X_PIXELS (p))
|
|
194 {
|
|
195 xfree (IMAGE_INSTANCE_X_PIXELS (p));
|
|
196 IMAGE_INSTANCE_X_PIXELS (p) = 0;
|
|
197 }
|
|
198
|
|
199 xfree (p->data);
|
|
200 p->data = 0;
|
|
201 }
|
|
202
|
|
203 static int
|
|
204 x_image_instance_equal (struct Lisp_Image_Instance *p1,
|
|
205 struct Lisp_Image_Instance *p2, int depth)
|
|
206 {
|
|
207 switch (IMAGE_INSTANCE_TYPE (p1))
|
|
208 {
|
|
209 case IMAGE_MONO_PIXMAP:
|
|
210 case IMAGE_COLOR_PIXMAP:
|
|
211 case IMAGE_POINTER:
|
|
212 if (IMAGE_INSTANCE_X_NPIXELS (p1) != IMAGE_INSTANCE_X_NPIXELS (p2))
|
|
213 return 0;
|
114
|
214 #if HAVE_SUBWINDOWS
|
0
|
215 case IMAGE_SUBWINDOW:
|
|
216 /* #### implement me */
|
114
|
217 #endif
|
56
|
218 break;
|
0
|
219 default:
|
|
220 break;
|
|
221 }
|
|
222
|
|
223 return 1;
|
|
224 }
|
|
225
|
|
226 static unsigned long
|
|
227 x_image_instance_hash (struct Lisp_Image_Instance *p, int depth)
|
|
228 {
|
|
229 switch (IMAGE_INSTANCE_TYPE (p))
|
|
230 {
|
|
231 case IMAGE_MONO_PIXMAP:
|
|
232 case IMAGE_COLOR_PIXMAP:
|
|
233 case IMAGE_POINTER:
|
|
234 return IMAGE_INSTANCE_X_NPIXELS (p);
|
114
|
235 #if HAVE_SUBWINDOWS
|
0
|
236 case IMAGE_SUBWINDOW:
|
|
237 /* #### implement me */
|
149
|
238 return 0;
|
114
|
239 #endif
|
0
|
240 default:
|
|
241 return 0;
|
|
242 }
|
|
243 }
|
|
244
|
|
245 /* Set all the slots in an image instance structure to reasonable
|
|
246 default values. This is used somewhere within an instantiate
|
|
247 method. It is assumed that the device slot within the image
|
|
248 instance is already set -- this is the case when instantiate
|
|
249 methods are called. */
|
|
250
|
|
251 static void
|
|
252 x_initialize_pixmap_image_instance (struct Lisp_Image_Instance *ii,
|
|
253 enum image_instance_type type)
|
|
254 {
|
185
|
255 ii->data = xnew_and_zero (struct x_image_instance_data);
|
0
|
256 IMAGE_INSTANCE_TYPE (ii) = type;
|
|
257 IMAGE_INSTANCE_PIXMAP_FILENAME (ii) = Qnil;
|
|
258 IMAGE_INSTANCE_PIXMAP_MASK_FILENAME (ii) = Qnil;
|
|
259 IMAGE_INSTANCE_PIXMAP_HOTSPOT_X (ii) = Qnil;
|
|
260 IMAGE_INSTANCE_PIXMAP_HOTSPOT_Y (ii) = Qnil;
|
|
261 IMAGE_INSTANCE_PIXMAP_FG (ii) = Qnil;
|
|
262 IMAGE_INSTANCE_PIXMAP_BG (ii) = Qnil;
|
|
263 }
|
|
264
|
|
265
|
|
266 /************************************************************************/
|
|
267 /* pixmap file functions */
|
|
268 /************************************************************************/
|
|
269
|
|
270 /* Where bitmaps are; initialized from resource database */
|
|
271 Lisp_Object Vx_bitmap_file_path;
|
|
272
|
|
273 #ifndef BITMAPDIR
|
|
274 #define BITMAPDIR "/usr/include/X11/bitmaps"
|
|
275 #endif
|
|
276
|
|
277 #define USE_XBMLANGPATH
|
|
278
|
|
279 /* Given a pixmap filename, look through all of the "standard" places
|
|
280 where the file might be located. Return a full pathname if found;
|
|
281 otherwise, return Qnil. */
|
|
282
|
|
283 static Lisp_Object
|
|
284 locate_pixmap_file (Lisp_Object name)
|
|
285 {
|
|
286 /* This function can GC if IN_REDISPLAY is false */
|
|
287 Display *display;
|
|
288
|
|
289 /* Check non-absolute pathnames with a directory component relative to
|
|
290 the search path; that's the way Xt does it. */
|
|
291 /* #### Unix-specific */
|
80
|
292 if (XSTRING_BYTE (name, 0) == '/' ||
|
|
293 (XSTRING_BYTE (name, 0) == '.' &&
|
|
294 (XSTRING_BYTE (name, 1) == '/' ||
|
|
295 (XSTRING_BYTE (name, 1) == '.' &&
|
|
296 (XSTRING_BYTE (name, 2) == '/')))))
|
0
|
297 {
|
|
298 if (!NILP (Ffile_readable_p (name)))
|
|
299 return name;
|
|
300 else
|
|
301 return Qnil;
|
|
302 }
|
|
303
|
|
304 if (NILP (Vdefault_x_device))
|
|
305 /* This may occur during intialization. */
|
|
306 return Qnil;
|
|
307 else
|
|
308 /* We only check the bitmapFilePath resource on the original X device. */
|
|
309 display = DEVICE_X_DISPLAY (XDEVICE (Vdefault_x_device));
|
|
310
|
|
311 #ifdef USE_XBMLANGPATH
|
|
312 {
|
|
313 char *path = egetenv ("XBMLANGPATH");
|
|
314 SubstitutionRec subs[1];
|
|
315 subs[0].match = 'B';
|
14
|
316 subs[0].substitution = (char *) XSTRING_DATA (name);
|
0
|
317 /* #### Motif uses a big hairy default if $XBMLANGPATH isn't set.
|
|
318 We don't. If you want it used, set it. */
|
|
319 if (path &&
|
|
320 (path = XtResolvePathname (display, "bitmaps", 0, 0, path,
|
|
321 subs, XtNumber (subs), 0)))
|
|
322 {
|
|
323 name = build_string (path);
|
|
324 XtFree (path);
|
|
325 return (name);
|
|
326 }
|
|
327 }
|
|
328 #endif
|
|
329
|
|
330 if (NILP (Vx_bitmap_file_path))
|
|
331 {
|
|
332 char *type = 0;
|
|
333 XrmValue value;
|
|
334 if (XrmGetResource (XtDatabase (display),
|
|
335 "bitmapFilePath", "BitmapFilePath", &type, &value)
|
|
336 && !strcmp (type, "String"))
|
|
337 Vx_bitmap_file_path = decode_env_path (0, (char *) value.addr);
|
|
338 Vx_bitmap_file_path = nconc2 (Vx_bitmap_file_path,
|
|
339 (list1 (build_string (BITMAPDIR))));
|
|
340 }
|
|
341
|
|
342 {
|
|
343 Lisp_Object found;
|
|
344 if (locate_file (Vx_bitmap_file_path, name, "", &found, R_OK) < 0)
|
|
345 {
|
|
346 Lisp_Object temp = list1 (Vdata_directory);
|
|
347 struct gcpro gcpro1;
|
|
348
|
|
349 GCPRO1 (temp);
|
|
350 locate_file (temp, name, "", &found, R_OK);
|
|
351 UNGCPRO;
|
|
352 }
|
|
353
|
|
354 return found;
|
|
355 }
|
|
356 }
|
|
357
|
|
358 /* If INSTANTIATOR refers to inline data, return Qnil.
|
|
359 If INSTANTIATOR refers to data in a file, return the full filename
|
|
360 if it exists; otherwise, return a cons of (filename).
|
|
361
|
|
362 FILE_KEYWORD and DATA_KEYWORD are symbols specifying the
|
|
363 keywords used to look up the file and inline data,
|
|
364 respectively, in the instantiator. Normally these would
|
|
365 be Q_file and Q_data, but might be different for mask data. */
|
|
366
|
|
367 static Lisp_Object
|
|
368 potential_pixmap_file_instantiator (Lisp_Object instantiator,
|
|
369 Lisp_Object file_keyword,
|
|
370 Lisp_Object data_keyword)
|
|
371 {
|
|
372 Lisp_Object file;
|
|
373 Lisp_Object data;
|
|
374
|
|
375 assert (VECTORP (instantiator));
|
185
|
376
|
0
|
377 data = find_keyword_in_vector (instantiator, data_keyword);
|
|
378 file = find_keyword_in_vector (instantiator, file_keyword);
|
|
379
|
|
380 if (!NILP (file) && NILP (data))
|
|
381 {
|
|
382 Lisp_Object retval = locate_pixmap_file (file);
|
|
383 if (!NILP (retval))
|
|
384 return retval;
|
|
385 else
|
|
386 return Fcons (file, Qnil); /* should have been file */
|
|
387 }
|
|
388
|
|
389 return Qnil;
|
|
390 }
|
|
391
|
|
392
|
|
393 static Lisp_Object
|
|
394 simple_image_type_normalize (Lisp_Object inst, Lisp_Object console_type,
|
|
395 Lisp_Object image_type_tag)
|
|
396 {
|
116
|
397 /* This function can call lisp */
|
0
|
398 Lisp_Object file = Qnil;
|
|
399 struct gcpro gcpro1, gcpro2;
|
|
400 Lisp_Object alist = Qnil;
|
185
|
401
|
0
|
402 GCPRO2 (file, alist);
|
|
403
|
|
404 /* Now, convert any file data into inline data. At the end of this,
|
|
405 `data' will contain the inline data (if any) or Qnil, and `file'
|
|
406 will contain the name this data was derived from (if known) or
|
|
407 Qnil.
|
|
408
|
|
409 Note that if we cannot generate any regular inline data, we
|
|
410 skip out. */
|
|
411
|
|
412 file = potential_pixmap_file_instantiator (inst, Q_file, Q_data);
|
|
413
|
|
414 if (CONSP (file)) /* failure locating filename */
|
|
415 signal_double_file_error ("Opening pixmap file",
|
|
416 "no such file or directory",
|
|
417 Fcar (file));
|
|
418
|
|
419 if (NILP (file)) /* no conversion necessary */
|
|
420 RETURN_UNGCPRO (inst);
|
|
421
|
|
422 alist = tagged_vector_to_alist (inst);
|
|
423
|
|
424 {
|
|
425 Lisp_Object data = make_string_from_file (file);
|
|
426 alist = remassq_no_quit (Q_file, alist);
|
|
427 /* there can't be a :data at this point. */
|
|
428 alist = Fcons (Fcons (Q_file, file),
|
|
429 Fcons (Fcons (Q_data, data), alist));
|
|
430 }
|
|
431
|
|
432 {
|
|
433 Lisp_Object result = alist_to_tagged_vector (image_type_tag, alist);
|
|
434 free_alist (alist);
|
|
435 RETURN_UNGCPRO (result);
|
|
436 }
|
|
437 }
|
|
438
|
|
439 static void
|
|
440 write_lisp_string_to_temp_file (Lisp_Object string, char *filename_out)
|
|
441 {
|
|
442 Extbyte *bytes;
|
|
443 Extcount len;
|
|
444 FILE *stream;
|
185
|
445
|
0
|
446 /* #### This is a definite problem under Mule due to the amount of
|
|
447 stack data it might allocate. Need to be able to convert and
|
|
448 write out to a file. */
|
|
449 GET_STRING_BINARY_DATA_ALLOCA (string, bytes, len);
|
|
450
|
|
451 /* Write out to a temporary file ... */
|
|
452 sprintf (filename_out, "/tmp/emacs%d.XXXXXX", (int) getpid ());
|
|
453 mktemp (filename_out);
|
|
454 stream = fopen (filename_out, "w");
|
|
455 if (!stream)
|
|
456 {
|
|
457 temp_file_error:
|
|
458 if (stream)
|
|
459 {
|
|
460 int old_errno = errno;
|
|
461 fclose (stream);
|
|
462 unlink (filename_out);
|
|
463 errno = old_errno;
|
|
464 }
|
|
465 report_file_error ("Creating temp file",
|
|
466 list1 (build_string (filename_out)));
|
|
467 }
|
|
468
|
|
469 if (fwrite (bytes, len, 1, stream) != 1)
|
|
470 goto temp_file_error;
|
|
471
|
|
472 if (fclose (stream) != 0)
|
|
473 {
|
|
474 stream = 0;
|
|
475 goto temp_file_error;
|
|
476 }
|
|
477 }
|
|
478
|
|
479
|
|
480 /************************************************************************/
|
|
481 /* cursor functions */
|
|
482 /************************************************************************/
|
|
483
|
|
484 /* Check that this server supports cursors of size WIDTH * HEIGHT. If
|
|
485 not, signal an error. INSTANTIATOR is only used in the error
|
|
486 message. */
|
|
487
|
|
488 static void
|
|
489 check_pointer_sizes (Screen *xs, unsigned int width, unsigned int height,
|
|
490 Lisp_Object instantiator)
|
|
491 {
|
|
492 unsigned int best_width, best_height;
|
|
493 if (! XQueryBestCursor (DisplayOfScreen (xs), RootWindowOfScreen (xs),
|
|
494 width, height, &best_width, &best_height))
|
|
495 /* this means that an X error of some sort occurred (we trap
|
|
496 these so they're not fatal). */
|
|
497 signal_simple_error ("XQueryBestCursor() failed?", instantiator);
|
|
498
|
|
499 if (width > best_width || height > best_height)
|
|
500 error_with_frob (instantiator,
|
|
501 "pointer too large (%dx%d): "
|
|
502 "server requires %dx%d or smaller",
|
|
503 width, height, best_width, best_height);
|
|
504 }
|
|
505
|
|
506
|
|
507 static void
|
|
508 generate_cursor_fg_bg (Lisp_Object device, Lisp_Object *foreground,
|
|
509 Lisp_Object *background, XColor *xfg, XColor *xbg)
|
|
510 {
|
|
511 if (!NILP (*foreground) && !COLOR_INSTANCEP (*foreground))
|
|
512 *foreground =
|
|
513 Fmake_color_instance (*foreground, device,
|
|
514 encode_error_behavior_flag (ERROR_ME));
|
|
515 if (COLOR_INSTANCEP (*foreground))
|
|
516 *xfg = COLOR_INSTANCE_X_COLOR (XCOLOR_INSTANCE (*foreground));
|
|
517 else
|
|
518 {
|
|
519 xfg->pixel = 0;
|
|
520 xfg->red = xfg->green = xfg->blue = 0;
|
|
521 }
|
185
|
522
|
0
|
523 if (!NILP (*background) && !COLOR_INSTANCEP (*background))
|
|
524 *background =
|
|
525 Fmake_color_instance (*background, device,
|
|
526 encode_error_behavior_flag (ERROR_ME));
|
|
527 if (COLOR_INSTANCEP (*background))
|
|
528 *xbg = COLOR_INSTANCE_X_COLOR (XCOLOR_INSTANCE (*background));
|
|
529 else
|
|
530 {
|
|
531 xbg->pixel = 0;
|
|
532 xbg->red = xbg->green = xbg->blue = ~0;
|
|
533 }
|
|
534 }
|
|
535
|
|
536 static void
|
|
537 maybe_recolor_cursor (Lisp_Object image_instance, Lisp_Object foreground,
|
|
538 Lisp_Object background)
|
|
539 {
|
|
540 Lisp_Object device = XIMAGE_INSTANCE_DEVICE (image_instance);
|
|
541 XColor xfg, xbg;
|
|
542
|
|
543 generate_cursor_fg_bg (device, &foreground, &background, &xfg, &xbg);
|
|
544 if (!NILP (foreground) || !NILP (background))
|
|
545 {
|
|
546 XRecolorCursor (DEVICE_X_DISPLAY (XDEVICE (device)),
|
|
547 XIMAGE_INSTANCE_X_CURSOR (image_instance),
|
|
548 &xfg, &xbg);
|
|
549 XIMAGE_INSTANCE_PIXMAP_FG (image_instance) = foreground;
|
|
550 XIMAGE_INSTANCE_PIXMAP_BG (image_instance) = background;
|
|
551 }
|
|
552 }
|
|
553
|
|
554
|
|
555 /************************************************************************/
|
|
556 /* color pixmap functions */
|
|
557 /************************************************************************/
|
|
558
|
|
559 /* Initialize an image instance from an XImage.
|
|
560
|
|
561 DEST_MASK specifies the mask of allowed image types.
|
|
562
|
|
563 PIXELS and NPIXELS specify an array of pixels that are used in
|
|
564 the image. These need to be kept around for the duration of the
|
|
565 image. When the image instance is freed, XFreeColors() will
|
|
566 automatically be called on all the pixels specified here; thus,
|
|
567 you should have allocated the pixels yourself using XAllocColor()
|
|
568 or the like. The array passed in is used directly without
|
|
569 being copied, so it should be heap data created with xmalloc().
|
|
570 It will be freed using xfree() when the image instance is
|
|
571 destroyed.
|
|
572
|
|
573 If this fails, signal an error. INSTANTIATOR is only used
|
|
574 in the error message.
|
|
575
|
|
576 #### This should be able to handle conversion into `pointer'.
|
|
577 Use the same code as for `xpm'. */
|
|
578
|
|
579 static void
|
|
580 init_image_instance_from_x_image (struct Lisp_Image_Instance *ii,
|
|
581 XImage *ximage,
|
|
582 int dest_mask,
|
|
583 unsigned long *pixels,
|
|
584 int npixels,
|
|
585 Lisp_Object instantiator)
|
|
586 {
|
|
587 Lisp_Object device = IMAGE_INSTANCE_DEVICE (ii);
|
|
588 Display *dpy;
|
|
589 GC gc;
|
|
590 Drawable d;
|
|
591 Pixmap pixmap;
|
|
592
|
|
593 if (!DEVICE_X_P (XDEVICE (device)))
|
|
594 signal_simple_error ("Not an X device", device);
|
|
595
|
|
596 dpy = DEVICE_X_DISPLAY (XDEVICE (device));
|
219
|
597 d = XtWindow(DEVICE_XT_APP_SHELL (XDEVICE (device)));
|
0
|
598
|
|
599 if (!(dest_mask & IMAGE_COLOR_PIXMAP_MASK))
|
|
600 incompatible_image_types (instantiator, dest_mask,
|
|
601 IMAGE_COLOR_PIXMAP_MASK);
|
185
|
602
|
0
|
603 pixmap = XCreatePixmap (dpy, d, ximage->width,
|
|
604 ximage->height, ximage->depth);
|
|
605 if (!pixmap)
|
|
606 signal_simple_error ("Unable to create pixmap", instantiator);
|
|
607
|
|
608 gc = XCreateGC (dpy, pixmap, 0, NULL);
|
|
609 if (!gc)
|
|
610 {
|
|
611 XFreePixmap (dpy, pixmap);
|
|
612 signal_simple_error ("Unable to create GC", instantiator);
|
|
613 }
|
185
|
614
|
0
|
615 XPutImage (dpy, pixmap, gc, ximage, 0, 0, 0, 0,
|
|
616 ximage->width, ximage->height);
|
185
|
617
|
0
|
618 XFreeGC (dpy, gc);
|
|
619
|
|
620 x_initialize_pixmap_image_instance (ii, IMAGE_COLOR_PIXMAP);
|
|
621
|
|
622 IMAGE_INSTANCE_PIXMAP_FILENAME (ii) =
|
|
623 find_keyword_in_vector (instantiator, Q_file);
|
185
|
624
|
0
|
625 IMAGE_INSTANCE_X_PIXMAP (ii) = pixmap;
|
|
626 IMAGE_INSTANCE_X_MASK (ii) = 0;
|
|
627 IMAGE_INSTANCE_PIXMAP_WIDTH (ii) = ximage->width;
|
|
628 IMAGE_INSTANCE_PIXMAP_HEIGHT (ii) = ximage->height;
|
|
629 IMAGE_INSTANCE_PIXMAP_DEPTH (ii) = ximage->depth;
|
|
630 IMAGE_INSTANCE_X_PIXELS (ii) = pixels;
|
|
631 IMAGE_INSTANCE_X_NPIXELS (ii) = npixels;
|
|
632 }
|
|
633
|
|
634
|
|
635 /**********************************************************************
|
|
636 * XBM *
|
|
637 **********************************************************************/
|
|
638
|
|
639 /* Check if DATA represents a valid inline XBM spec (i.e. a list
|
|
640 of (width height bits), with checking done on the dimensions).
|
|
641 If not, signal an error. */
|
|
642
|
|
643 static void
|
|
644 check_valid_xbm_inline (Lisp_Object data)
|
|
645 {
|
|
646 Lisp_Object width, height, bits;
|
|
647
|
|
648 CHECK_CONS (data);
|
|
649 if (!CONSP (XCDR (data)) || !CONSP (XCDR (XCDR (data))) ||
|
|
650 !NILP (XCDR (XCDR (XCDR (data)))))
|
|
651 signal_simple_error ("Must be list of 3 elements", data);
|
|
652
|
|
653 width = XCAR (data);
|
|
654 height = XCAR (XCDR (data));
|
|
655 bits = XCAR (XCDR (XCDR (data)));
|
|
656
|
|
657 if (!INTP (width) || !INTP (height) || !STRINGP (bits))
|
|
658 signal_simple_error ("Must be (width height bits)",
|
|
659 vector3 (width, height, bits));
|
|
660
|
|
661 if (XINT (width) <= 0)
|
|
662 signal_simple_error ("Width must be > 0", width);
|
|
663
|
|
664 if (XINT (height) <= 0)
|
|
665 signal_simple_error ("Height must be > 0", height);
|
|
666
|
|
667 if (((unsigned) (XINT (width) * XINT (height)) / 8)
|
|
668 > string_char_length (XSTRING (bits)))
|
|
669 signal_simple_error ("data is too short for W and H",
|
|
670 vector3 (width, height, bits));
|
|
671 }
|
|
672
|
|
673 /* Validate method for XBM's. */
|
|
674
|
|
675 static void
|
|
676 xbm_validate (Lisp_Object instantiator)
|
|
677 {
|
|
678 file_or_data_must_be_present (instantiator);
|
|
679 }
|
|
680
|
|
681 /* Given a filename that is supposed to contain XBM data, return
|
|
682 the inline representation of it as (width height bits). Return
|
|
683 the hotspot through XHOT and YHOT, if those pointers are not 0.
|
|
684 If there is no hotspot, XHOT and YHOT will contain -1.
|
|
685
|
|
686 If the function fails:
|
|
687
|
|
688 -- if OK_IF_DATA_INVALID is set and the data was invalid,
|
|
689 return Qt.
|
|
690 -- maybe return an error, or return Qnil.
|
|
691 */
|
185
|
692
|
0
|
693
|
|
694 static Lisp_Object
|
|
695 bitmap_to_lisp_data (Lisp_Object name, int *xhot, int *yhot,
|
|
696 int ok_if_data_invalid)
|
|
697 {
|
|
698 unsigned int w, h;
|
|
699 Extbyte *data;
|
|
700 int result;
|
|
701 CONST char *filename_ext;
|
|
702
|
|
703 GET_C_STRING_FILENAME_DATA_ALLOCA (name, filename_ext);
|
|
704 result = XmuReadBitmapDataFromFile (filename_ext, &w, &h, &data, xhot, yhot);
|
|
705
|
|
706 if (result == BitmapSuccess)
|
|
707 {
|
|
708 Lisp_Object retval;
|
|
709 int len = (w + 7) / 8 * h;
|
|
710
|
|
711 retval = list3 (make_int (w), make_int (h),
|
|
712 make_ext_string (data, len, FORMAT_BINARY));
|
|
713 XFree ((char *) data);
|
|
714 return retval;
|
|
715 }
|
|
716
|
|
717 switch (result)
|
|
718 {
|
|
719 case BitmapOpenFailed:
|
|
720 {
|
|
721 /* should never happen */
|
|
722 signal_double_file_error ("Opening bitmap file",
|
|
723 "no such file or directory",
|
|
724 name);
|
|
725 }
|
|
726 case BitmapFileInvalid:
|
|
727 {
|
|
728 if (ok_if_data_invalid)
|
|
729 return Qt;
|
|
730 signal_double_file_error ("Reading bitmap file",
|
|
731 "invalid data in file",
|
|
732 name);
|
|
733 }
|
|
734 case BitmapNoMemory:
|
|
735 {
|
|
736 signal_double_file_error ("Reading bitmap file",
|
|
737 "out of memory",
|
|
738 name);
|
|
739 }
|
|
740 default:
|
|
741 {
|
|
742 signal_double_file_error_2 ("Reading bitmap file",
|
|
743 "unknown error code",
|
|
744 make_int (result), name);
|
|
745 }
|
|
746 }
|
|
747
|
|
748 return Qnil; /* not reached */
|
|
749 }
|
|
750
|
|
751 static Lisp_Object
|
|
752 xbm_mask_file_munging (Lisp_Object alist, Lisp_Object file,
|
|
753 Lisp_Object mask_file)
|
|
754 {
|
|
755 /* This is unclean but it's fairly standard -- a number of the
|
|
756 bitmaps in /usr/include/X11/bitmaps use it -- so we support
|
|
757 it. */
|
|
758 if (NILP (mask_file)
|
|
759 /* don't override explicitly specified mask data. */
|
|
760 && NILP (assq_no_quit (Q_mask_data, alist))
|
|
761 && !NILP (file))
|
|
762 {
|
|
763 mask_file =
|
|
764 locate_pixmap_file (concat2 (file, build_string ("Mask")));
|
|
765 if (NILP (mask_file))
|
|
766 mask_file =
|
|
767 locate_pixmap_file (concat2 (file, build_string ("msk")));
|
|
768 }
|
|
769
|
|
770 if (!NILP (mask_file))
|
|
771 {
|
|
772 Lisp_Object mask_data =
|
|
773 bitmap_to_lisp_data (mask_file, 0, 0, 0);
|
|
774 alist = remassq_no_quit (Q_mask_file, alist);
|
|
775 /* there can't be a :mask-data at this point. */
|
|
776 alist = Fcons (Fcons (Q_mask_file, mask_file),
|
|
777 Fcons (Fcons (Q_mask_data, mask_data), alist));
|
|
778 }
|
|
779
|
|
780 return alist;
|
|
781 }
|
|
782
|
|
783 /* Normalize method for XBM's. */
|
|
784
|
|
785 static Lisp_Object
|
|
786 xbm_normalize (Lisp_Object inst, Lisp_Object console_type)
|
|
787 {
|
|
788 Lisp_Object file = Qnil, mask_file = Qnil;
|
|
789 struct gcpro gcpro1, gcpro2, gcpro3;
|
|
790 Lisp_Object alist = Qnil;
|
185
|
791
|
0
|
792 GCPRO3 (file, mask_file, alist);
|
|
793
|
|
794 /* Now, convert any file data into inline data for both the regular
|
|
795 data and the mask data. At the end of this, `data' will contain
|
|
796 the inline data (if any) or Qnil, and `file' will contain
|
|
797 the name this data was derived from (if known) or Qnil.
|
|
798 Likewise for `mask_file' and `mask_data'.
|
|
799
|
|
800 Note that if we cannot generate any regular inline data, we
|
|
801 skip out. */
|
|
802
|
|
803 file = potential_pixmap_file_instantiator (inst, Q_file, Q_data);
|
|
804 mask_file = potential_pixmap_file_instantiator (inst, Q_mask_file,
|
|
805 Q_mask_data);
|
|
806
|
|
807 if (CONSP (file)) /* failure locating filename */
|
|
808 signal_double_file_error ("Opening bitmap file",
|
|
809 "no such file or directory",
|
|
810 Fcar (file));
|
|
811
|
|
812 if (NILP (file) && NILP (mask_file)) /* no conversion necessary */
|
|
813 RETURN_UNGCPRO (inst);
|
|
814
|
|
815 alist = tagged_vector_to_alist (inst);
|
|
816
|
|
817 if (!NILP (file))
|
|
818 {
|
|
819 int xhot, yhot;
|
|
820 Lisp_Object data = bitmap_to_lisp_data (file, &xhot, &yhot, 0);
|
|
821 alist = remassq_no_quit (Q_file, alist);
|
|
822 /* there can't be a :data at this point. */
|
|
823 alist = Fcons (Fcons (Q_file, file),
|
|
824 Fcons (Fcons (Q_data, data), alist));
|
|
825
|
|
826 if (xhot != -1 && NILP (assq_no_quit (Q_hotspot_x, alist)))
|
|
827 alist = Fcons (Fcons (Q_hotspot_x, make_int (xhot)),
|
|
828 alist);
|
|
829 if (yhot != -1 && NILP (assq_no_quit (Q_hotspot_y, alist)))
|
|
830 alist = Fcons (Fcons (Q_hotspot_y, make_int (yhot)),
|
|
831 alist);
|
|
832 }
|
|
833
|
|
834 alist = xbm_mask_file_munging (alist, file, mask_file);
|
|
835
|
|
836 {
|
|
837 Lisp_Object result = alist_to_tagged_vector (Qxbm, alist);
|
|
838 free_alist (alist);
|
|
839 RETURN_UNGCPRO (result);
|
|
840 }
|
|
841 }
|
|
842
|
|
843 /* Given inline data for a mono pixmap, create and return the
|
|
844 corresponding X object. */
|
|
845
|
|
846 static Pixmap
|
|
847 pixmap_from_xbm_inline (Lisp_Object device, int width, int height,
|
|
848 /* Note that data is in ext-format! */
|
|
849 CONST Extbyte *bits)
|
|
850 {
|
219
|
851 return XCreatePixmapFromBitmapData (DEVICE_X_DISPLAY (XDEVICE(device)),
|
|
852 XtWindow (DEVICE_XT_APP_SHELL (XDEVICE (device))),
|
0
|
853 (char *) bits, width, height,
|
|
854 1, 0, 1);
|
|
855 }
|
|
856
|
|
857 /* Given inline data for a mono pixmap, initialize the given
|
|
858 image instance accordingly. */
|
|
859
|
|
860 static void
|
|
861 init_image_instance_from_xbm_inline (struct Lisp_Image_Instance *ii,
|
|
862 int width, int height,
|
|
863 /* Note that data is in ext-format! */
|
|
864 CONST char *bits,
|
|
865 Lisp_Object instantiator,
|
|
866 Lisp_Object pointer_fg,
|
|
867 Lisp_Object pointer_bg,
|
|
868 int dest_mask,
|
|
869 Pixmap mask,
|
|
870 Lisp_Object mask_filename)
|
|
871 {
|
|
872 Lisp_Object device = IMAGE_INSTANCE_DEVICE (ii);
|
|
873 Lisp_Object foreground = find_keyword_in_vector (instantiator, Q_foreground);
|
|
874 Lisp_Object background = find_keyword_in_vector (instantiator, Q_background);
|
|
875 Display *dpy;
|
|
876 Screen *scr;
|
219
|
877 Drawable draw;
|
0
|
878 enum image_instance_type type;
|
|
879
|
|
880 if (!DEVICE_X_P (XDEVICE (device)))
|
|
881 signal_simple_error ("Not an X device", device);
|
|
882
|
|
883 dpy = DEVICE_X_DISPLAY (XDEVICE (device));
|
219
|
884 draw = XtWindow(DEVICE_XT_APP_SHELL (XDEVICE (device)));
|
0
|
885 scr = DefaultScreenOfDisplay (dpy);
|
|
886
|
|
887 if ((dest_mask & IMAGE_MONO_PIXMAP_MASK) &&
|
|
888 (dest_mask & IMAGE_COLOR_PIXMAP_MASK))
|
|
889 {
|
|
890 if (!NILP (foreground) || !NILP (background))
|
|
891 type = IMAGE_COLOR_PIXMAP;
|
|
892 else
|
|
893 type = IMAGE_MONO_PIXMAP;
|
|
894 }
|
|
895 else if (dest_mask & IMAGE_MONO_PIXMAP_MASK)
|
|
896 type = IMAGE_MONO_PIXMAP;
|
|
897 else if (dest_mask & IMAGE_COLOR_PIXMAP_MASK)
|
|
898 type = IMAGE_COLOR_PIXMAP;
|
|
899 else if (dest_mask & IMAGE_POINTER_MASK)
|
|
900 type = IMAGE_POINTER;
|
|
901 else
|
|
902 incompatible_image_types (instantiator, dest_mask,
|
|
903 IMAGE_MONO_PIXMAP_MASK | IMAGE_COLOR_PIXMAP_MASK
|
|
904 | IMAGE_POINTER_MASK);
|
|
905
|
|
906 x_initialize_pixmap_image_instance (ii, type);
|
|
907 IMAGE_INSTANCE_PIXMAP_WIDTH (ii) = width;
|
|
908 IMAGE_INSTANCE_PIXMAP_HEIGHT (ii) = height;
|
|
909 IMAGE_INSTANCE_PIXMAP_FILENAME (ii) =
|
|
910 find_keyword_in_vector (instantiator, Q_file);
|
|
911
|
|
912 switch (type)
|
|
913 {
|
|
914 case IMAGE_MONO_PIXMAP:
|
|
915 {
|
|
916 IMAGE_INSTANCE_X_PIXMAP (ii) =
|
|
917 pixmap_from_xbm_inline (device, width, height, (Extbyte *) bits);
|
|
918 }
|
|
919 break;
|
|
920
|
|
921 case IMAGE_COLOR_PIXMAP:
|
|
922 {
|
219
|
923 Dimension d = DEVICE_X_DEPTH (XDEVICE(device));
|
0
|
924 unsigned long fg = BlackPixelOfScreen (scr);
|
|
925 unsigned long bg = WhitePixelOfScreen (scr);
|
|
926
|
|
927 if (!NILP (foreground) && !COLOR_INSTANCEP (foreground))
|
|
928 foreground =
|
|
929 Fmake_color_instance (foreground, device,
|
|
930 encode_error_behavior_flag (ERROR_ME));
|
|
931
|
|
932 if (COLOR_INSTANCEP (foreground))
|
|
933 fg = COLOR_INSTANCE_X_COLOR (XCOLOR_INSTANCE (foreground)).pixel;
|
|
934
|
|
935 if (!NILP (background) && !COLOR_INSTANCEP (background))
|
|
936 background =
|
|
937 Fmake_color_instance (background, device,
|
|
938 encode_error_behavior_flag (ERROR_ME));
|
|
939
|
|
940 if (COLOR_INSTANCEP (background))
|
|
941 bg = COLOR_INSTANCE_X_COLOR (XCOLOR_INSTANCE (background)).pixel;
|
|
942
|
|
943 /* We used to duplicate the pixels using XAllocColor(), to protect
|
|
944 against their getting freed. Just as easy to just store the
|
|
945 color instances here and GC-protect them, so this doesn't
|
|
946 happen. */
|
|
947 IMAGE_INSTANCE_PIXMAP_FG (ii) = foreground;
|
|
948 IMAGE_INSTANCE_PIXMAP_BG (ii) = background;
|
|
949 IMAGE_INSTANCE_X_PIXMAP (ii) =
|
219
|
950 XCreatePixmapFromBitmapData (dpy, draw,
|
0
|
951 (char *) bits, width, height,
|
|
952 fg, bg, d);
|
|
953 IMAGE_INSTANCE_PIXMAP_DEPTH (ii) = d;
|
|
954 }
|
|
955 break;
|
|
956
|
|
957 case IMAGE_POINTER:
|
207
|
958 {
|
0
|
959 XColor fg_color, bg_color;
|
|
960 Pixmap source;
|
|
961
|
|
962 check_pointer_sizes (scr, width, height, instantiator);
|
|
963
|
|
964 source =
|
219
|
965 XCreatePixmapFromBitmapData (dpy, draw,
|
0
|
966 (char *) bits, width, height,
|
|
967 1, 0, 1);
|
|
968
|
|
969 if (NILP (foreground))
|
|
970 foreground = pointer_fg;
|
|
971 if (NILP (background))
|
|
972 background = pointer_bg;
|
|
973 generate_cursor_fg_bg (device, &foreground, &background,
|
|
974 &fg_color, &bg_color);
|
|
975
|
|
976 IMAGE_INSTANCE_PIXMAP_FG (ii) = foreground;
|
|
977 IMAGE_INSTANCE_PIXMAP_BG (ii) = background;
|
|
978 IMAGE_INSTANCE_PIXMAP_HOTSPOT_X (ii) =
|
|
979 find_keyword_in_vector (instantiator, Q_hotspot_x);
|
|
980 IMAGE_INSTANCE_PIXMAP_HOTSPOT_Y (ii) =
|
|
981 find_keyword_in_vector (instantiator, Q_hotspot_y);
|
|
982 IMAGE_INSTANCE_X_CURSOR (ii) =
|
|
983 XCreatePixmapCursor
|
|
984 (dpy, source, mask, &fg_color, &bg_color,
|
|
985 !NILP (IMAGE_INSTANCE_PIXMAP_HOTSPOT_X (ii)) ?
|
|
986 XINT (IMAGE_INSTANCE_PIXMAP_HOTSPOT_X (ii)) : 0,
|
|
987 !NILP (IMAGE_INSTANCE_PIXMAP_HOTSPOT_Y (ii)) ?
|
|
988 XINT (IMAGE_INSTANCE_PIXMAP_HOTSPOT_Y (ii)) : 0);
|
|
989 }
|
|
990 break;
|
|
991
|
|
992 default:
|
|
993 abort ();
|
|
994 }
|
|
995 }
|
207
|
996
|
0
|
997 static int
|
74
|
998 xbm_possible_dest_types (void)
|
0
|
999 {
|
74
|
1000 return
|
|
1001 IMAGE_MONO_PIXMAP_MASK |
|
|
1002 IMAGE_COLOR_PIXMAP_MASK |
|
0
|
1003 IMAGE_POINTER_MASK;
|
|
1004 }
|
|
1005
|
|
1006 static void
|
|
1007 xbm_instantiate_1 (Lisp_Object image_instance, Lisp_Object instantiator,
|
|
1008 Lisp_Object pointer_fg, Lisp_Object pointer_bg,
|
|
1009 int dest_mask, int width, int height,
|
|
1010 /* Note that data is in ext-format! */
|
|
1011 CONST char *bits)
|
|
1012 {
|
|
1013 Lisp_Object mask_data = find_keyword_in_vector (instantiator, Q_mask_data);
|
|
1014 Lisp_Object mask_file = find_keyword_in_vector (instantiator, Q_mask_file);
|
|
1015 struct Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance);
|
|
1016 Pixmap mask = 0;
|
|
1017 CONST char *gcc_may_you_rot_in_hell;
|
|
1018
|
|
1019 if (!NILP (mask_data))
|
207
|
1020 {
|
0
|
1021 GET_C_STRING_BINARY_DATA_ALLOCA (XCAR (XCDR (XCDR (mask_data))),
|
|
1022 gcc_may_you_rot_in_hell);
|
|
1023 mask =
|
|
1024 pixmap_from_xbm_inline (IMAGE_INSTANCE_DEVICE (ii),
|
|
1025 XINT (XCAR (mask_data)),
|
|
1026 XINT (XCAR (XCDR (mask_data))),
|
|
1027 (CONST unsigned char *)
|
|
1028 gcc_may_you_rot_in_hell);
|
207
|
1029 }
|
0
|
1030
|
|
1031 init_image_instance_from_xbm_inline (ii, width, height, bits,
|
|
1032 instantiator, pointer_fg, pointer_bg,
|
|
1033 dest_mask, mask, mask_file);
|
|
1034 }
|
|
1035
|
|
1036 /* Instantiate method for XBM's. */
|
|
1037
|
|
1038 static void
|
|
1039 xbm_instantiate (Lisp_Object image_instance, Lisp_Object instantiator,
|
207
|
1040 Lisp_Object pointer_fg, Lisp_Object pointer_bg,
|
|
1041 int dest_mask, Lisp_Object domain)
|
0
|
1042 {
|
|
1043 Lisp_Object data = find_keyword_in_vector (instantiator, Q_data);
|
|
1044 CONST char *gcc_go_home;
|
|
1045
|
|
1046 assert (!NILP (data));
|
|
1047
|
|
1048 GET_C_STRING_BINARY_DATA_ALLOCA (XCAR (XCDR (XCDR (data))),
|
|
1049 gcc_go_home);
|
|
1050
|
|
1051 xbm_instantiate_1 (image_instance, instantiator, pointer_fg,
|
|
1052 pointer_bg, dest_mask, XINT (XCAR (data)),
|
|
1053 XINT (XCAR (XCDR (data))), gcc_go_home);
|
|
1054 }
|
|
1055
|
|
1056
|
|
1057 #ifdef HAVE_XPM
|
|
1058
|
|
1059 /**********************************************************************
|
|
1060 * XPM *
|
|
1061 **********************************************************************/
|
|
1062
|
|
1063 static void
|
|
1064 check_valid_xpm_color_symbols (Lisp_Object data)
|
|
1065 {
|
|
1066 Lisp_Object rest;
|
185
|
1067
|
0
|
1068 for (rest = data; !NILP (rest); rest = XCDR (rest))
|
|
1069 {
|
|
1070 if (!CONSP (rest) ||
|
|
1071 !CONSP (XCAR (rest)) ||
|
|
1072 !STRINGP (XCAR (XCAR (rest))) ||
|
|
1073 (!STRINGP (XCDR (XCAR (rest))) &&
|
|
1074 !COLOR_SPECIFIERP (XCDR (XCAR (rest)))))
|
|
1075 signal_simple_error ("Invalid color symbol alist", data);
|
|
1076 }
|
|
1077 }
|
|
1078
|
|
1079 static void
|
|
1080 xpm_validate (Lisp_Object instantiator)
|
|
1081 {
|
|
1082 file_or_data_must_be_present (instantiator);
|
|
1083 }
|
|
1084
|
|
1085 static Lisp_Object
|
|
1086 pixmap_to_lisp_data (Lisp_Object name, int ok_if_data_invalid)
|
|
1087 {
|
|
1088 char **data;
|
|
1089 int result;
|
|
1090
|
14
|
1091 result = XpmReadFileToData ((char *) XSTRING_DATA (name), &data);
|
0
|
1092
|
|
1093 if (result == XpmSuccess)
|
|
1094 {
|
|
1095 Lisp_Object retval = Qnil;
|
|
1096 struct buffer *old_buffer = current_buffer;
|
|
1097 Lisp_Object temp_buffer =
|
|
1098 Fget_buffer_create (build_string (" *pixmap conversion*"));
|
|
1099 int elt;
|
|
1100 int height, width, ncolors;
|
|
1101 struct gcpro gcpro1, gcpro2, gcpro3;
|
|
1102 int speccount = specpdl_depth ();
|
|
1103
|
|
1104 GCPRO3 (name, retval, temp_buffer);
|
|
1105
|
|
1106 specbind (Qinhibit_quit, Qt);
|
|
1107 set_buffer_internal (XBUFFER (temp_buffer));
|
223
|
1108 Ferase_buffer (Qnil);
|
0
|
1109
|
|
1110 buffer_insert_c_string (current_buffer, "/* XPM */\r");
|
|
1111 buffer_insert_c_string (current_buffer, "static char *pixmap[] = {\r");
|
|
1112
|
|
1113 sscanf (data[0], "%d %d %d", &height, &width, &ncolors);
|
|
1114 for (elt = 0; elt <= width + ncolors; elt++)
|
|
1115 {
|
|
1116 buffer_insert_c_string (current_buffer, "\"");
|
|
1117 buffer_insert_c_string (current_buffer, data[elt]);
|
|
1118
|
|
1119 if (elt < width + ncolors)
|
|
1120 buffer_insert_c_string (current_buffer, "\",\r");
|
|
1121 else
|
|
1122 buffer_insert_c_string (current_buffer, "\"};\r");
|
|
1123 }
|
|
1124
|
223
|
1125 retval = Fbuffer_substring (Qnil, Qnil, Qnil);
|
0
|
1126 XpmFree (data);
|
|
1127
|
|
1128 set_buffer_internal (old_buffer);
|
|
1129 unbind_to (speccount, Qnil);
|
|
1130
|
|
1131 RETURN_UNGCPRO (retval);
|
|
1132 }
|
|
1133
|
|
1134 switch (result)
|
|
1135 {
|
|
1136 case XpmFileInvalid:
|
|
1137 {
|
|
1138 if (ok_if_data_invalid)
|
|
1139 return Qt;
|
|
1140 signal_simple_error ("invalid XPM data in file", name);
|
|
1141 }
|
|
1142 case XpmNoMemory:
|
|
1143 {
|
|
1144 signal_double_file_error ("Reading pixmap file",
|
|
1145 "out of memory", name);
|
|
1146 }
|
|
1147 case XpmOpenFailed:
|
|
1148 {
|
|
1149 /* should never happen? */
|
|
1150 signal_double_file_error ("Opening pixmap file",
|
|
1151 "no such file or directory", name);
|
|
1152 }
|
|
1153 default:
|
|
1154 {
|
|
1155 signal_double_file_error_2 ("Parsing pixmap file",
|
|
1156 "unknown error code",
|
|
1157 make_int (result), name);
|
|
1158 break;
|
|
1159 }
|
|
1160 }
|
|
1161
|
|
1162 return Qnil; /* not reached */
|
|
1163 }
|
|
1164
|
|
1165 Lisp_Object Vxpm_color_symbols;
|
|
1166
|
|
1167 static Lisp_Object
|
|
1168 evaluate_xpm_color_symbols (void)
|
|
1169 {
|
|
1170 Lisp_Object rest, results = Qnil;
|
|
1171 struct gcpro gcpro1, gcpro2;
|
|
1172
|
|
1173 GCPRO2 (rest, results);
|
|
1174 for (rest = Vxpm_color_symbols; !NILP (rest); rest = XCDR (rest))
|
|
1175 {
|
|
1176 Lisp_Object name, value, cons;
|
|
1177
|
|
1178 CHECK_CONS (rest);
|
|
1179 cons = XCAR (rest);
|
|
1180 CHECK_CONS (cons);
|
|
1181 name = XCAR (cons);
|
|
1182 CHECK_STRING (name);
|
|
1183 value = XCDR (cons);
|
|
1184 CHECK_CONS (value);
|
|
1185 value = XCAR (value);
|
|
1186 value = Feval (value);
|
|
1187 if (NILP (value))
|
|
1188 continue;
|
|
1189 if (!STRINGP (value) && !COLOR_SPECIFIERP (value))
|
|
1190 signal_simple_error
|
|
1191 ("Result from xpm-color-symbols eval must be nil, string, or color",
|
|
1192 value);
|
|
1193 results = Fcons (Fcons (name, value), results);
|
|
1194 }
|
|
1195 UNGCPRO; /* no more evaluation */
|
|
1196 return results;
|
|
1197 }
|
|
1198
|
|
1199 static Lisp_Object
|
|
1200 xpm_normalize (Lisp_Object inst, Lisp_Object console_type)
|
|
1201 {
|
|
1202 Lisp_Object file = Qnil;
|
|
1203 Lisp_Object color_symbols;
|
|
1204 struct gcpro gcpro1, gcpro2;
|
|
1205 Lisp_Object alist = Qnil;
|
185
|
1206
|
0
|
1207 GCPRO2 (file, alist);
|
|
1208
|
|
1209 /* Now, convert any file data into inline data. At the end of this,
|
|
1210 `data' will contain the inline data (if any) or Qnil, and
|
|
1211 `file' will contain the name this data was derived from (if
|
|
1212 known) or Qnil.
|
|
1213
|
|
1214 Note that if we cannot generate any regular inline data, we
|
|
1215 skip out. */
|
|
1216
|
|
1217 file = potential_pixmap_file_instantiator (inst, Q_file, Q_data);
|
|
1218
|
|
1219 if (CONSP (file)) /* failure locating filename */
|
|
1220 signal_double_file_error ("Opening pixmap file",
|
|
1221 "no such file or directory",
|
|
1222 Fcar (file));
|
|
1223
|
|
1224 color_symbols = find_keyword_in_vector_or_given (inst, Q_color_symbols,
|
|
1225 Qunbound);
|
|
1226
|
|
1227 if (NILP (file) && !UNBOUNDP (color_symbols))
|
|
1228 /* no conversion necessary */
|
|
1229 RETURN_UNGCPRO (inst);
|
|
1230
|
|
1231 alist = tagged_vector_to_alist (inst);
|
|
1232
|
|
1233 if (!NILP (file))
|
|
1234 {
|
|
1235 Lisp_Object data = pixmap_to_lisp_data (file, 0);
|
|
1236 alist = remassq_no_quit (Q_file, alist);
|
|
1237 /* there can't be a :data at this point. */
|
|
1238 alist = Fcons (Fcons (Q_file, file),
|
|
1239 Fcons (Fcons (Q_data, data), alist));
|
|
1240 }
|
|
1241
|
|
1242 if (UNBOUNDP (color_symbols))
|
|
1243 {
|
|
1244 color_symbols = evaluate_xpm_color_symbols ();
|
|
1245 alist = Fcons (Fcons (Q_color_symbols, color_symbols),
|
|
1246 alist);
|
|
1247 }
|
|
1248
|
|
1249 {
|
|
1250 Lisp_Object result = alist_to_tagged_vector (Qxpm, alist);
|
|
1251 free_alist (alist);
|
|
1252 RETURN_UNGCPRO (result);
|
|
1253 }
|
|
1254 }
|
|
1255
|
|
1256 static int
|
74
|
1257 xpm_possible_dest_types (void)
|
0
|
1258 {
|
74
|
1259 return
|
|
1260 IMAGE_MONO_PIXMAP_MASK |
|
|
1261 IMAGE_COLOR_PIXMAP_MASK |
|
0
|
1262 IMAGE_POINTER_MASK;
|
|
1263 }
|
|
1264
|
|
1265 /* xpm 3.2g and better has XpmCreatePixmapFromBuffer()...
|
|
1266 There was no version number in xpm.h before 3.3, but this should do.
|
|
1267 */
|
|
1268 #if (XpmVersion >= 3) || defined(XpmExactColors)
|
|
1269 # define XPM_DOES_BUFFERS
|
|
1270 #endif
|
|
1271
|
|
1272 #ifndef XPM_DOES_BUFFERS
|
|
1273 Your version of XPM is too old. You cannot compile with it.
|
|
1274 Upgrade to version 3.2g or better or compile with --with-xpm=no.
|
|
1275 #endif /* !XPM_DOES_BUFFERS */
|
|
1276
|
|
1277 static XpmColorSymbol *
|
|
1278 extract_xpm_color_names (XpmAttributes *xpmattrs, Lisp_Object device,
|
124
|
1279 Lisp_Object domain,
|
0
|
1280 Lisp_Object color_symbol_alist)
|
|
1281 {
|
|
1282 /* This function can GC */
|
219
|
1283 Display *dpy = DEVICE_X_DISPLAY (XDEVICE(device));
|
|
1284 Colormap cmap = DEVICE_X_COLORMAP (XDEVICE(device));
|
0
|
1285 XColor color;
|
|
1286 Lisp_Object rest;
|
|
1287 Lisp_Object results = Qnil;
|
|
1288 int i;
|
|
1289 XpmColorSymbol *symbols;
|
|
1290 struct gcpro gcpro1, gcpro2;
|
|
1291
|
|
1292 GCPRO2 (results, device);
|
|
1293
|
|
1294 /* We built up results to be (("name" . #<color>) ...) so that if an
|
|
1295 error happens we don't lose any malloc()ed data, or more importantly,
|
|
1296 leave any pixels allocated in the server. */
|
|
1297 i = 0;
|
|
1298 LIST_LOOP (rest, color_symbol_alist)
|
|
1299 {
|
|
1300 Lisp_Object cons = XCAR (rest);
|
|
1301 Lisp_Object name = XCAR (cons);
|
|
1302 Lisp_Object value = XCDR (cons);
|
|
1303 if (NILP (value))
|
|
1304 continue;
|
|
1305 if (STRINGP (value))
|
|
1306 value =
|
|
1307 Fmake_color_instance
|
|
1308 (value, device, encode_error_behavior_flag (ERROR_ME_NOT));
|
|
1309 else
|
|
1310 {
|
|
1311 assert (COLOR_SPECIFIERP (value));
|
124
|
1312 value = Fspecifier_instance (value, domain, Qnil, Qnil);
|
0
|
1313 }
|
|
1314 if (NILP (value))
|
|
1315 continue;
|
|
1316 results = noseeum_cons (noseeum_cons (name, value), results);
|
|
1317 i++;
|
|
1318 }
|
|
1319 UNGCPRO; /* no more evaluation */
|
|
1320
|
|
1321 if (i == 0) return 0;
|
|
1322
|
185
|
1323 symbols = xnew_array (XpmColorSymbol, i);
|
0
|
1324 xpmattrs->valuemask |= XpmColorSymbols;
|
|
1325 xpmattrs->colorsymbols = symbols;
|
|
1326 xpmattrs->numsymbols = i;
|
|
1327
|
|
1328 while (--i >= 0)
|
|
1329 {
|
|
1330 Lisp_Object cons = XCAR (results);
|
|
1331 color = COLOR_INSTANCE_X_COLOR (XCOLOR_INSTANCE (XCDR (cons)));
|
|
1332 /* Duplicate the pixel value so that we still have a lock on it if
|
|
1333 the pixel we were passed is later freed. */
|
|
1334 if (! XAllocColor (dpy, cmap, &color))
|
|
1335 abort (); /* it must be allocable since we're just duplicating it */
|
|
1336
|
14
|
1337 symbols [i].name = (char *) XSTRING_DATA (XCAR (cons));
|
0
|
1338 symbols [i].pixel = color.pixel;
|
|
1339 symbols [i].value = 0;
|
|
1340 free_cons (XCONS (cons));
|
|
1341 cons = results;
|
|
1342 results = XCDR (results);
|
|
1343 free_cons (XCONS (cons));
|
|
1344 }
|
|
1345 return symbols;
|
|
1346 }
|
|
1347
|
|
1348 static void
|
|
1349 xpm_free (XpmAttributes *xpmattrs)
|
|
1350 {
|
|
1351 /* Could conceivably lose if XpmXXX returned an error without first
|
|
1352 initializing this structure, if we didn't know that initializing it
|
|
1353 to all zeros was ok (and also that it's ok to call XpmFreeAttributes()
|
|
1354 multiple times, since it zeros slots as it frees them...) */
|
|
1355 XpmFreeAttributes (xpmattrs);
|
|
1356 }
|
|
1357
|
|
1358 static void
|
|
1359 xpm_instantiate (Lisp_Object image_instance, Lisp_Object instantiator,
|
|
1360 Lisp_Object pointer_fg, Lisp_Object pointer_bg,
|
124
|
1361 int dest_mask, Lisp_Object domain)
|
0
|
1362 {
|
|
1363 /* This function can GC */
|
|
1364 struct Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance);
|
|
1365 Lisp_Object data = find_keyword_in_vector (instantiator, Q_data);
|
|
1366 Lisp_Object device = IMAGE_INSTANCE_DEVICE (ii);
|
|
1367 Display *dpy;
|
|
1368 Screen *xs;
|
219
|
1369 Colormap cmap;
|
|
1370 int depth;
|
0
|
1371 Pixmap pixmap;
|
|
1372 Pixmap mask = 0;
|
|
1373 XpmAttributes xpmattrs;
|
|
1374 int result;
|
|
1375 XpmColorSymbol *color_symbols;
|
|
1376 Lisp_Object color_symbol_alist = find_keyword_in_vector (instantiator,
|
|
1377 Q_color_symbols);
|
|
1378 enum image_instance_type type;
|
|
1379 int force_mono;
|
|
1380 unsigned int w, h;
|
|
1381
|
|
1382 if (!DEVICE_X_P (XDEVICE (device)))
|
|
1383 signal_simple_error ("Not an X device", device);
|
|
1384
|
|
1385 dpy = DEVICE_X_DISPLAY (XDEVICE (device));
|
219
|
1386 cmap = DEVICE_X_COLORMAP (XDEVICE(device));
|
|
1387 depth = DEVICE_X_DEPTH (XDEVICE(device));
|
0
|
1388 xs = DefaultScreenOfDisplay (dpy);
|
|
1389
|
|
1390 if (dest_mask & IMAGE_COLOR_PIXMAP_MASK)
|
|
1391 type = IMAGE_COLOR_PIXMAP;
|
|
1392 else if (dest_mask & IMAGE_MONO_PIXMAP_MASK)
|
|
1393 type = IMAGE_MONO_PIXMAP;
|
|
1394 else if (dest_mask & IMAGE_POINTER_MASK)
|
|
1395 type = IMAGE_POINTER;
|
|
1396 else
|
|
1397 incompatible_image_types (instantiator, dest_mask,
|
|
1398 IMAGE_MONO_PIXMAP_MASK | IMAGE_COLOR_PIXMAP_MASK
|
|
1399 | IMAGE_POINTER_MASK);
|
|
1400 force_mono = (type != IMAGE_COLOR_PIXMAP);
|
|
1401
|
|
1402 x_initialize_pixmap_image_instance (ii, type);
|
|
1403
|
|
1404 assert (!NILP (data));
|
|
1405
|
|
1406 retry:
|
|
1407
|
|
1408 memset (&xpmattrs, 0, sizeof (xpmattrs)); /* want XpmInitAttributes() */
|
|
1409 xpmattrs.valuemask = XpmReturnPixels;
|
|
1410 if (force_mono)
|
|
1411 {
|
|
1412 /* Without this, we get a 1-bit version of the color image, which
|
|
1413 isn't quite right. With this, we get the mono image, which might
|
|
1414 be very different looking. */
|
|
1415 xpmattrs.valuemask |= XpmColorKey;
|
|
1416 xpmattrs.color_key = XPM_MONO;
|
|
1417 xpmattrs.depth = 1;
|
|
1418 xpmattrs.valuemask |= XpmDepth;
|
|
1419 }
|
|
1420 else
|
|
1421 {
|
|
1422 xpmattrs.closeness = 65535;
|
|
1423 xpmattrs.valuemask |= XpmCloseness;
|
219
|
1424 xpmattrs.depth = depth;
|
|
1425 xpmattrs.valuemask |= XpmDepth;
|
|
1426 xpmattrs.visual = DEVICE_X_VISUAL (XDEVICE(device));
|
|
1427 xpmattrs.valuemask |= XpmVisual;
|
|
1428 xpmattrs.colormap = cmap;
|
|
1429 xpmattrs.valuemask |= XpmColormap;
|
0
|
1430 }
|
185
|
1431
|
124
|
1432 color_symbols = extract_xpm_color_names (&xpmattrs, device, domain,
|
0
|
1433 color_symbol_alist);
|
|
1434
|
|
1435 result = XpmCreatePixmapFromBuffer (dpy,
|
219
|
1436 XtWindow(DEVICE_XT_APP_SHELL (XDEVICE(device))),
|
14
|
1437 (char *) XSTRING_DATA (data),
|
0
|
1438 &pixmap, &mask, &xpmattrs);
|
|
1439
|
|
1440 if (color_symbols)
|
|
1441 {
|
|
1442 xfree (color_symbols);
|
|
1443 xpmattrs.colorsymbols = 0; /* in case XpmFreeAttr is too smart... */
|
|
1444 xpmattrs.numsymbols = 0;
|
|
1445 }
|
|
1446
|
|
1447 switch (result)
|
|
1448 {
|
|
1449 case XpmSuccess:
|
|
1450 break;
|
|
1451 case XpmFileInvalid:
|
|
1452 {
|
|
1453 xpm_free (&xpmattrs);
|
|
1454 signal_simple_error ("invalid XPM data", data);
|
|
1455 }
|
|
1456 case XpmColorFailed:
|
|
1457 case XpmColorError:
|
|
1458 {
|
|
1459 xpm_free (&xpmattrs);
|
|
1460 if (force_mono)
|
|
1461 {
|
|
1462 /* second time; blow out. */
|
|
1463 signal_double_file_error ("Reading pixmap data",
|
|
1464 "color allocation failed",
|
|
1465 data);
|
|
1466 }
|
|
1467 else
|
|
1468 {
|
|
1469 if (! (dest_mask & IMAGE_MONO_PIXMAP_MASK))
|
|
1470 {
|
|
1471 /* second time; blow out. */
|
|
1472 signal_double_file_error ("Reading pixmap data",
|
|
1473 "color allocation failed",
|
|
1474 data);
|
|
1475 }
|
|
1476 force_mono = 1;
|
|
1477 IMAGE_INSTANCE_TYPE (ii) = IMAGE_MONO_PIXMAP;
|
|
1478 goto retry;
|
|
1479 }
|
|
1480 }
|
|
1481 case XpmNoMemory:
|
|
1482 {
|
|
1483 xpm_free (&xpmattrs);
|
|
1484 signal_double_file_error ("Parsing pixmap data",
|
|
1485 "out of memory", data);
|
|
1486 }
|
|
1487 default:
|
|
1488 {
|
|
1489 xpm_free (&xpmattrs);
|
|
1490 signal_double_file_error_2 ("Parsing pixmap data",
|
|
1491 "unknown error code",
|
|
1492 make_int (result), data);
|
|
1493 }
|
|
1494 }
|
|
1495
|
|
1496 w = xpmattrs.width;
|
|
1497 h = xpmattrs.height;
|
|
1498
|
|
1499 {
|
|
1500 int npixels = xpmattrs.npixels;
|
185
|
1501 Pixel *pixels;
|
0
|
1502
|
|
1503 if (npixels != 0)
|
|
1504 {
|
185
|
1505 pixels = xnew_array (Pixel, npixels);
|
0
|
1506 memcpy (pixels, xpmattrs.pixels, npixels * sizeof (Pixel));
|
|
1507 }
|
|
1508 else
|
185
|
1509 pixels = NULL;
|
0
|
1510
|
|
1511 IMAGE_INSTANCE_X_PIXMAP (ii) = pixmap;
|
|
1512 IMAGE_INSTANCE_X_MASK (ii) = mask;
|
|
1513 IMAGE_INSTANCE_X_PIXELS (ii) = pixels;
|
|
1514 IMAGE_INSTANCE_X_NPIXELS (ii) = npixels;
|
|
1515 IMAGE_INSTANCE_PIXMAP_WIDTH (ii) = w;
|
|
1516 IMAGE_INSTANCE_PIXMAP_HEIGHT (ii) = h;
|
|
1517 IMAGE_INSTANCE_PIXMAP_FILENAME (ii) =
|
|
1518 find_keyword_in_vector (instantiator, Q_file);
|
|
1519 }
|
|
1520
|
|
1521 switch (type)
|
|
1522 {
|
|
1523 case IMAGE_MONO_PIXMAP:
|
|
1524 break;
|
|
1525
|
|
1526 case IMAGE_COLOR_PIXMAP:
|
|
1527 {
|
219
|
1528 IMAGE_INSTANCE_PIXMAP_DEPTH (ii) = depth;
|
0
|
1529 }
|
|
1530 break;
|
|
1531
|
|
1532 case IMAGE_POINTER:
|
|
1533 {
|
|
1534 int npixels = xpmattrs.npixels;
|
|
1535 Pixel *pixels = xpmattrs.pixels;
|
|
1536 XColor fg, bg;
|
|
1537 int i;
|
|
1538 int xhot = 0, yhot = 0;
|
|
1539
|
|
1540 if (xpmattrs.valuemask & XpmHotspot)
|
|
1541 {
|
|
1542 xhot = xpmattrs.x_hotspot;
|
|
1543 XSETINT (IMAGE_INSTANCE_PIXMAP_HOTSPOT_X (ii), xpmattrs.x_hotspot);
|
|
1544 }
|
|
1545 if (xpmattrs.valuemask & XpmHotspot)
|
|
1546 {
|
|
1547 yhot = xpmattrs.y_hotspot;
|
|
1548 XSETINT (IMAGE_INSTANCE_PIXMAP_HOTSPOT_Y (ii), xpmattrs.y_hotspot);
|
|
1549 }
|
|
1550 check_pointer_sizes (xs, w, h, instantiator);
|
|
1551
|
|
1552 /* If the loaded pixmap has colors allocated (meaning it came from an
|
|
1553 XPM file), then use those as the default colors for the cursor we
|
|
1554 create. Otherwise, default to pointer_fg and pointer_bg.
|
|
1555 */
|
|
1556 if (npixels >= 2)
|
|
1557 {
|
|
1558 /* With an XBM file, it's obvious which bit is foreground
|
|
1559 and which is background, or rather, it's implicit: in
|
|
1560 an XBM file, a 1 bit is foreground, and a 0 bit is
|
|
1561 background.
|
185
|
1562
|
0
|
1563 XCreatePixmapCursor() assumes this property of the
|
|
1564 pixmap it is called with as well; the `foreground'
|
|
1565 color argument is used for the 1 bits.
|
|
1566
|
|
1567 With an XPM file, it's tricker, since the elements of
|
|
1568 the pixmap don't represent FG and BG, but are actual
|
|
1569 pixel values. So we need to figure out which of those
|
|
1570 pixels is the foreground color and which is the
|
|
1571 background. We do it by comparing RGB and assuming
|
|
1572 that the darker color is the foreground. This works
|
|
1573 with the result of xbmtopbm|ppmtoxpm, at least.
|
185
|
1574
|
0
|
1575 It might be nice if there was some way to tag the
|
|
1576 colors in the XPM file with whether they are the
|
|
1577 foreground - perhaps with logical color names somehow?
|
185
|
1578
|
0
|
1579 Once we have decided which color is the foreground, we
|
|
1580 need to ensure that that color corresponds to a `1' bit
|
|
1581 in the Pixmap. The XPM library wrote into the (1-bit)
|
|
1582 pixmap with XPutPixel, which will ignore all but the
|
|
1583 least significant bit.
|
185
|
1584
|
0
|
1585 This means that a 1 bit in the image corresponds to
|
|
1586 `fg' only if `fg.pixel' is odd.
|
185
|
1587
|
0
|
1588 (This also means that the image will be all the same
|
|
1589 color if both `fg' and `bg' are odd or even, but we can
|
|
1590 safely assume that that won't happen if the XPM file is
|
|
1591 sensible I think.)
|
185
|
1592
|
0
|
1593 The desired result is that the image use `1' to
|
|
1594 represent the foreground color, and `0' to represent
|
|
1595 the background color. So, we may need to invert the
|
|
1596 image to accomplish this; we invert if fg is
|
|
1597 odd. (Remember that WhitePixel and BlackPixel are not
|
|
1598 necessarily 1 and 0 respectively, though I think it
|
|
1599 might be safe to assume that one of them is always 1
|
|
1600 and the other is always 0. We also pretty much need to
|
|
1601 assume that one is even and the other is odd.)
|
|
1602 */
|
|
1603
|
|
1604 fg.pixel = pixels[0]; /* pick a pixel at random. */
|
|
1605 bg.pixel = fg.pixel;
|
|
1606 for (i = 1; i < npixels; i++) /* Look for an "other" pixel value.*/
|
|
1607 {
|
|
1608 bg.pixel = pixels[i];
|
|
1609 if (fg.pixel != bg.pixel)
|
|
1610 break;
|
|
1611 }
|
|
1612
|
|
1613 /* If (fg.pixel == bg.pixel) then probably something has
|
|
1614 gone wrong, but I don't think signalling an error would
|
|
1615 be appropriate. */
|
|
1616
|
219
|
1617 XQueryColor (dpy, cmap, &fg);
|
|
1618 XQueryColor (dpy, cmap, &bg);
|
0
|
1619
|
|
1620 /* If the foreground is lighter than the background, swap them.
|
|
1621 (This occurs semi-randomly, depending on the ordering of the
|
|
1622 color list in the XPM file.)
|
|
1623 */
|
|
1624 {
|
|
1625 unsigned short fg_total = ((fg.red / 3) + (fg.green / 3)
|
|
1626 + (fg.blue / 3));
|
|
1627 unsigned short bg_total = ((bg.red / 3) + (bg.green / 3)
|
|
1628 + (bg.blue / 3));
|
|
1629 if (fg_total > bg_total)
|
|
1630 {
|
|
1631 XColor swap;
|
|
1632 swap = fg;
|
|
1633 fg = bg;
|
|
1634 bg = swap;
|
|
1635 }
|
|
1636 }
|
185
|
1637
|
0
|
1638 /* If the fg pixel corresponds to a `0' in the bitmap, invert it.
|
|
1639 (This occurs (only?) on servers with Black=0, White=1.)
|
|
1640 */
|
|
1641 if ((fg.pixel & 1) == 0)
|
|
1642 {
|
|
1643 XGCValues gcv;
|
|
1644 GC gc;
|
|
1645 gcv.function = GXxor;
|
|
1646 gcv.foreground = 1;
|
|
1647 gc = XCreateGC (dpy, pixmap, (GCFunction | GCForeground),
|
|
1648 &gcv);
|
|
1649 XFillRectangle (dpy, pixmap, gc, 0, 0, w, h);
|
|
1650 XFreeGC (dpy, gc);
|
|
1651 }
|
|
1652 }
|
|
1653 else
|
|
1654 {
|
|
1655 generate_cursor_fg_bg (device, &pointer_fg, &pointer_bg,
|
|
1656 &fg, &bg);
|
|
1657 IMAGE_INSTANCE_PIXMAP_FG (ii) = pointer_fg;
|
|
1658 IMAGE_INSTANCE_PIXMAP_BG (ii) = pointer_bg;
|
|
1659 }
|
|
1660
|
|
1661 IMAGE_INSTANCE_X_CURSOR (ii) =
|
|
1662 XCreatePixmapCursor
|
|
1663 (dpy, pixmap, mask, &fg, &bg, xhot, yhot);
|
|
1664 }
|
|
1665
|
|
1666 break;
|
|
1667
|
|
1668 default:
|
|
1669 abort ();
|
|
1670 }
|
185
|
1671
|
0
|
1672 xpm_free (&xpmattrs); /* after we've read pixels and hotspot */
|
|
1673 }
|
|
1674
|
|
1675 #endif /* HAVE_XPM */
|
|
1676
|
|
1677
|
207
|
1678 #ifdef HAVE_IMAGEMAGICK
|
|
1679 /**********************************************************************
|
|
1680 * ImageMagick *
|
|
1681 **********************************************************************/
|
231
|
1682 JMP_BUF imagick_jump;
|
|
1683 Lisp_Object imagick_err; /* slightly hackish way to return a proper error message */
|
|
1684
|
207
|
1685 static void
|
|
1686 imagick_validate (Lisp_Object instantiator)
|
|
1687 {
|
|
1688 file_or_data_must_be_present (instantiator);
|
|
1689 }
|
|
1690
|
231
|
1691 static void
|
|
1692 imagick_error_handler (const char *message,const char *qualifier)
|
|
1693 {
|
|
1694 /* ImageMagick defaults to exiting on errors, which is an anti-thing.
|
|
1695 * Dump the info into imagick_err, and jmp back */
|
|
1696 if (qualifier != NULL)
|
|
1697 imagick_err = emacs_doprnt_string_c((CONST Bufbyte *) GETTEXT ("ImageMagick error: %s (%s)"),
|
|
1698 Qnil, -1, message, qualifier);
|
|
1699 else
|
|
1700 imagick_err = emacs_doprnt_string_c((CONST Bufbyte *) GETTEXT ("ImageMagick error: %s"),
|
|
1701 Qnil, -1, message);
|
|
1702 LONGJMP(imagick_jump,1);
|
|
1703 }
|
|
1704
|
|
1705 static void
|
|
1706 imagick_warning_handler (const char *message,const char *qualifier)
|
|
1707 {
|
|
1708 if (qualifier != NULL)
|
|
1709 warn_when_safe(Qimagick, Qwarning, "ImageMagick warning: %s (%s)",message,qualifier);
|
|
1710 else
|
|
1711 warn_when_safe(Qimagick, Qwarning, "ImageMagick warning: %s",message);
|
|
1712 }
|
|
1713
|
207
|
1714 static Lisp_Object
|
|
1715 imagick_normalize (Lisp_Object inst, Lisp_Object console_type)
|
|
1716 {
|
|
1717 return simple_image_type_normalize (inst, console_type, Qimagick);
|
|
1718 }
|
|
1719
|
|
1720 static int
|
|
1721 imagick_possible_dest_types (void)
|
|
1722 {
|
|
1723 return IMAGE_COLOR_PIXMAP_MASK;
|
|
1724 }
|
|
1725
|
|
1726 struct imagick_unwind_data
|
|
1727 {
|
|
1728 Display *dpy;
|
221
|
1729 Colormap cmap;
|
207
|
1730 FILE *instream;
|
|
1731 Image *image;
|
|
1732 XImage *ximage;
|
|
1733 unsigned long *pixels;
|
|
1734 unsigned long npixels;
|
|
1735 char tempfile[50];
|
|
1736 int tempfile_needs_to_be_removed;
|
|
1737 };
|
|
1738
|
|
1739 static Lisp_Object
|
|
1740 imagick_instantiate_unwind (Lisp_Object unwind_obj)
|
|
1741 {
|
|
1742 struct imagick_unwind_data *data =
|
|
1743 (struct imagick_unwind_data *) get_opaque_ptr (unwind_obj);
|
|
1744
|
|
1745 free_opaque_ptr (unwind_obj);
|
|
1746 if (data->instream)
|
|
1747 fclose (data->instream);
|
|
1748 if (data->tempfile_needs_to_be_removed)
|
|
1749 unlink (data->tempfile);
|
|
1750
|
|
1751 if (data->image) {
|
|
1752 DestroyImage(data->image);
|
|
1753 }
|
|
1754
|
221
|
1755 if (data->ximage) {
|
|
1756 if (data->ximage->data) {
|
207
|
1757 xfree (data->ximage->data);
|
|
1758 data->ximage->data = NULL;
|
|
1759 }
|
|
1760 XDestroyImage (data->ximage);
|
|
1761 }
|
221
|
1762
|
|
1763 if (data->npixels > 0) {
|
|
1764 XFreeColors(data->dpy, data->cmap, data->pixels, data->npixels, 0L);
|
|
1765 xfree (data->pixels);
|
|
1766 }
|
207
|
1767
|
|
1768 return Qnil;
|
|
1769 }
|
|
1770
|
|
1771 static void
|
|
1772 imagick_instantiate (Lisp_Object image_instance, Lisp_Object instantiator,
|
|
1773 Lisp_Object pointer_fg, Lisp_Object pointer_bg,
|
|
1774 int dest_mask, Lisp_Object domain)
|
|
1775 {
|
221
|
1776 struct Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance);
|
|
1777 Lisp_Object device = IMAGE_INSTANCE_DEVICE (ii);
|
|
1778 Display *dpy;
|
|
1779 Screen *scr;
|
|
1780 Visual *visual;
|
|
1781 Colormap cmap;
|
|
1782 Dimension depth;
|
|
1783 struct imagick_unwind_data unwind;
|
225
|
1784 int speccount;
|
221
|
1785 ImageInfo image_info;
|
|
1786
|
|
1787 /* ImageMagick variables */
|
|
1788
|
|
1789 /* Basic error checking */
|
|
1790 if (!DEVICE_X_P (XDEVICE (device)))
|
|
1791 signal_simple_error ("Not an X device", device);
|
|
1792
|
|
1793 dpy = DEVICE_X_DISPLAY (XDEVICE (device));
|
|
1794 scr = DefaultScreenOfDisplay (dpy);
|
|
1795 depth = DEVICE_X_DEPTH (XDEVICE (device));
|
|
1796 visual = DEVICE_X_VISUAL (XDEVICE (device));
|
|
1797 cmap = DEVICE_X_COLORMAP (XDEVICE(device));
|
|
1798
|
|
1799 /* Set up the unwind */
|
|
1800 memset (&unwind, 0, sizeof (unwind));
|
|
1801 unwind.dpy = dpy;
|
|
1802 unwind.cmap = cmap;
|
225
|
1803 speccount = specpdl_depth();
|
221
|
1804 record_unwind_protect(imagick_instantiate_unwind,make_opaque_ptr(&unwind));
|
|
1805
|
231
|
1806 /* Set up error handlers */
|
|
1807 if (SETJMP(imagick_jump))
|
|
1808 {
|
|
1809 /* signal error GCPROs it's arguments */
|
|
1810 signal_error(Qerror, list2(imagick_err, instantiator));
|
|
1811 }
|
|
1812
|
|
1813 SetErrorHandler(imagick_error_handler);
|
|
1814 SetWarningHandler(imagick_warning_handler);
|
|
1815
|
221
|
1816 /* Write out to a temp file - not sure if ImageMagick supports the
|
|
1817 ** notion of an abstract 'data source' right now.
|
|
1818 ** JH: It doesn't as of 3.9.3
|
|
1819 */
|
|
1820 {
|
|
1821 Lisp_Object data = find_keyword_in_vector (instantiator, Q_data);
|
|
1822
|
|
1823 assert (!NILP (data));
|
|
1824
|
|
1825 write_lisp_string_to_temp_file (data, unwind.tempfile);
|
|
1826 unwind.tempfile_needs_to_be_removed = 1;
|
|
1827
|
|
1828 if ((unwind.instream = fopen (unwind.tempfile, "rb")) == NULL)
|
|
1829 report_file_error ("Opening ImageMagick temp file",
|
|
1830 list1 (build_string (unwind.tempfile)));
|
|
1831 }
|
|
1832
|
|
1833 /* Initialize structures and read in the image */
|
|
1834 GetImageInfo(&image_info);
|
|
1835 strcpy(image_info.filename,unwind.tempfile);
|
|
1836 unwind.image = ReadImage(&image_info);
|
|
1837
|
|
1838 if (unwind.image == (Image *) NULL) {
|
|
1839 signal_simple_error ("Unable to read image.",instantiator);
|
|
1840 }
|
207
|
1841
|
215
|
1842 #if 1
|
221
|
1843 /*
|
|
1844 * For now, force dithering everything, and deal with all images as if they
|
|
1845 * were PseudoClass images
|
|
1846 */
|
|
1847 if (unwind.image->class != PseudoClass) {
|
|
1848 QuantizeInfo quantize_info;
|
|
1849 GetQuantizeInfo(&quantize_info);
|
|
1850 quantize_info.number_colors=256;
|
|
1851 quantize_info.tree_depth=8;
|
|
1852 quantize_info.dither=True;
|
|
1853 quantize_info.colorspace=RGBColorspace;
|
|
1854 QuantizeImage(&quantize_info, unwind.image);
|
|
1855 SyncImage(unwind.image);
|
|
1856 /* #### It would probably be a good idea to sort the colormap by popularity,
|
|
1857 * so that in case we run out of entries in the map, it will likely be on
|
|
1858 * the less used colors
|
|
1859 */
|
|
1860 } else {
|
|
1861 CompressColormap(unwind.image);
|
|
1862 SyncImage(unwind.image);
|
|
1863 }
|
|
1864
|
|
1865 #endif
|
|
1866
|
|
1867 #if 0
|
|
1868 DescribeImage(unwind.image,stderr,1);
|
215
|
1869 #endif
|
|
1870
|
221
|
1871 unwind.ximage = XCreateImage(dpy, visual, depth,
|
|
1872 (depth == 1) ? XYPixmap : ZPixmap,
|
|
1873 0, 0,
|
|
1874 unwind.image->columns,
|
|
1875 unwind.image->rows,
|
|
1876 XBitmapPad(dpy), 0);
|
|
1877
|
|
1878 if (!unwind.ximage) {
|
|
1879 signal_simple_error("Unable to allocate XImage structure",
|
|
1880 instantiator);
|
|
1881 }
|
|
1882
|
|
1883 unwind.ximage->data = (char *) xmalloc(unwind.ximage->bytes_per_line *
|
|
1884 unwind.ximage->height);
|
|
1885
|
|
1886 if (unwind.ximage->data == (char *)NULL) {
|
|
1887 signal_simple_error("Unable to allocate XImage data information",
|
|
1888 instantiator);
|
|
1889 }
|
|
1890
|
|
1891
|
|
1892 /*
|
|
1893 ** First pull out all of the colors used, and create a lookup for them
|
|
1894 */
|
|
1895
|
|
1896 if (unwind.image->class == PseudoClass) {
|
|
1897 int i;
|
|
1898
|
|
1899 unwind.npixels = unwind.image->colors;
|
|
1900 unwind.pixels = xmalloc(unwind.npixels * sizeof(unsigned long));
|
|
1901 for (i = 0; i < unwind.npixels; i++) {
|
|
1902 XColor color;
|
|
1903 /* ImageMagic uses 8bit values for colors, whilst X expects 16bits */
|
|
1904 color.red = unwind.image->colormap[i].red << 8;
|
|
1905 color.green = unwind.image->colormap[i].green << 8;
|
|
1906 color.blue = unwind.image->colormap[i].blue << 8;
|
|
1907 color.flags = DoRed | DoGreen | DoBlue;
|
|
1908 allocate_nearest_color (dpy, cmap, visual, &color);
|
|
1909 unwind.pixels[i] = color.pixel;
|
|
1910 }
|
|
1911 }
|
|
1912
|
|
1913 /*
|
|
1914 ** Need to pull the data from the 'Image' structure in
|
|
1915 ** unwind.image and convert it to an 'XImage' in unwind.ximage
|
|
1916 */
|
|
1917 {
|
|
1918 int i,j,x,b;
|
|
1919 unsigned int bytes_per_pixel, scanline_pad;
|
|
1920 unsigned long pixval;
|
243
|
1921 unsigned char *q, *pixar;
|
221
|
1922 RunlengthPacket *p;
|
|
1923
|
|
1924 q = (unsigned char *) unwind.ximage->data;
|
|
1925 x = 0;
|
|
1926 p = unwind.image->pixels;
|
|
1927 scanline_pad = unwind.ximage->bytes_per_line -
|
|
1928 ((unwind.ximage->width * unwind.ximage->bits_per_pixel) >> 3);
|
|
1929
|
|
1930 /* Convert to multi-byte color-mapped X image. */
|
|
1931 bytes_per_pixel=unwind.ximage->bits_per_pixel >> 3;
|
|
1932
|
243
|
1933 pixar = (unsigned char *) alloca (bytes_per_pixel);
|
|
1934
|
221
|
1935 for (i=0; i < unwind.image->packets; i++) {
|
|
1936 if (unwind.image->class == PseudoClass)
|
|
1937 pixval = unwind.pixels[p->index];
|
|
1938 else
|
215
|
1939 {
|
221
|
1940 /* ### NOW what? */
|
|
1941 pixval = 0;
|
|
1942 }
|
225
|
1943
|
|
1944 for (b=0; b < bytes_per_pixel; b++) {
|
|
1945 if (unwind.ximage->bitmap_bit_order == LSBFirst)
|
|
1946 pixar[b] = (unsigned char)pixval;
|
|
1947 else
|
|
1948 pixar[bytes_per_pixel - 1 - b] = (unsigned char)pixval;
|
|
1949 pixval>>=8;
|
|
1950 }
|
|
1951
|
221
|
1952 for (j=0; j <= ((int) p->length); j++) {
|
|
1953 for (b=0; b < bytes_per_pixel; b++)
|
225
|
1954 *q++= pixar[b];
|
221
|
1955 x++;
|
|
1956 if (x == unwind.ximage->width) {
|
|
1957 x=0;
|
|
1958 q+=scanline_pad;
|
215
|
1959 }
|
221
|
1960 }
|
|
1961 p++;
|
|
1962 }
|
|
1963 }
|
|
1964
|
|
1965 init_image_instance_from_x_image (ii, unwind.ximage, dest_mask,
|
|
1966 unwind.pixels, unwind.npixels,
|
|
1967 instantiator);
|
|
1968
|
|
1969 /* And we are done!
|
|
1970 ** Now that we've succeeded, we don't want the pixels
|
|
1971 ** freed right now. They're kept around in the image instance
|
|
1972 ** structure until it's destroyed.
|
|
1973 */
|
|
1974 unwind.npixels = 0;
|
|
1975 unbind_to (speccount, Qnil);
|
207
|
1976 }
|
|
1977
|
|
1978 #endif /* HAVE_IMAGEMAGICK */
|
|
1979
|
|
1980
|
0
|
1981 #ifdef HAVE_XFACE
|
|
1982
|
|
1983 /**********************************************************************
|
|
1984 * X-Face *
|
|
1985 **********************************************************************/
|
|
1986
|
|
1987 static void
|
|
1988 xface_validate (Lisp_Object instantiator)
|
|
1989 {
|
|
1990 file_or_data_must_be_present (instantiator);
|
|
1991 }
|
|
1992
|
|
1993 static Lisp_Object
|
|
1994 xface_normalize (Lisp_Object inst, Lisp_Object console_type)
|
|
1995 {
|
116
|
1996 /* This funcation can call lisp */
|
0
|
1997 Lisp_Object file = Qnil, mask_file = Qnil;
|
|
1998 struct gcpro gcpro1, gcpro2, gcpro3;
|
|
1999 Lisp_Object alist = Qnil;
|
185
|
2000
|
0
|
2001 GCPRO3 (file, mask_file, alist);
|
|
2002
|
|
2003 /* Now, convert any file data into inline data for both the regular
|
|
2004 data and the mask data. At the end of this, `data' will contain
|
|
2005 the inline data (if any) or Qnil, and `file' will contain
|
|
2006 the name this data was derived from (if known) or Qnil.
|
|
2007 Likewise for `mask_file' and `mask_data'.
|
|
2008
|
|
2009 Note that if we cannot generate any regular inline data, we
|
|
2010 skip out. */
|
|
2011
|
|
2012 file = potential_pixmap_file_instantiator (inst, Q_file, Q_data);
|
|
2013 mask_file = potential_pixmap_file_instantiator (inst, Q_mask_file,
|
|
2014 Q_mask_data);
|
|
2015
|
|
2016 if (CONSP (file)) /* failure locating filename */
|
|
2017 signal_double_file_error ("Opening bitmap file",
|
|
2018 "no such file or directory",
|
|
2019 Fcar (file));
|
|
2020
|
|
2021 if (NILP (file) && NILP (mask_file)) /* no conversion necessary */
|
|
2022 RETURN_UNGCPRO (inst);
|
|
2023
|
|
2024 alist = tagged_vector_to_alist (inst);
|
|
2025
|
|
2026 {
|
|
2027 Lisp_Object data = make_string_from_file (file);
|
|
2028 alist = remassq_no_quit (Q_file, alist);
|
|
2029 /* there can't be a :data at this point. */
|
|
2030 alist = Fcons (Fcons (Q_file, file),
|
|
2031 Fcons (Fcons (Q_data, data), alist));
|
|
2032 }
|
|
2033
|
|
2034 alist = xbm_mask_file_munging (alist, file, mask_file);
|
|
2035
|
|
2036 {
|
|
2037 Lisp_Object result = alist_to_tagged_vector (Qxface, alist);
|
|
2038 free_alist (alist);
|
|
2039 RETURN_UNGCPRO (result);
|
|
2040 }
|
|
2041 }
|
|
2042
|
|
2043 static int
|
74
|
2044 xface_possible_dest_types (void)
|
0
|
2045 {
|
74
|
2046 return
|
|
2047 IMAGE_MONO_PIXMAP_MASK |
|
|
2048 IMAGE_COLOR_PIXMAP_MASK |
|
0
|
2049 IMAGE_POINTER_MASK;
|
|
2050 }
|
|
2051
|
|
2052 #if defined(EXTERN)
|
|
2053 /* This is about to get redefined! */
|
|
2054 #undef EXTERN
|
|
2055 #endif
|
|
2056 /* We have to define SYSV32 so that compface.h includes string.h
|
|
2057 instead of strings.h. */
|
|
2058 #define SYSV32
|
185
|
2059 #ifdef __cplusplus
|
|
2060 extern "C" {
|
|
2061 #endif
|
0
|
2062 #include <compface.h>
|
185
|
2063 #ifdef __cplusplus
|
|
2064 }
|
|
2065 #endif
|
0
|
2066 /* JMP_BUF cannot be used here because if it doesn't get defined
|
|
2067 to jmp_buf we end up with a conflicting type error with the
|
|
2068 definition in compface.h */
|
|
2069 extern jmp_buf comp_env;
|
|
2070 #undef SYSV32
|
|
2071
|
|
2072 static void
|
|
2073 xface_instantiate (Lisp_Object image_instance, Lisp_Object instantiator,
|
|
2074 Lisp_Object pointer_fg, Lisp_Object pointer_bg,
|
124
|
2075 int dest_mask, Lisp_Object domain)
|
0
|
2076 {
|
|
2077 Lisp_Object data = find_keyword_in_vector (instantiator, Q_data);
|
|
2078 int i, stattis;
|
|
2079 char *p, *bits, *bp;
|
16
|
2080 CONST char * volatile emsg = 0;
|
|
2081 CONST char * volatile dstring;
|
0
|
2082
|
|
2083 assert (!NILP (data));
|
|
2084
|
|
2085 GET_C_STRING_BINARY_DATA_ALLOCA (data, dstring);
|
|
2086
|
|
2087 if ((p = strchr (dstring, ':')))
|
|
2088 {
|
|
2089 dstring = p + 1;
|
|
2090 }
|
|
2091
|
|
2092 /* Must use setjmp not SETJMP because we used jmp_buf above not JMP_BUF */
|
|
2093 if (!(stattis = setjmp (comp_env)))
|
|
2094 {
|
|
2095 UnCompAll ((char *) dstring);
|
|
2096 UnGenFace ();
|
|
2097 }
|
|
2098
|
|
2099 switch (stattis)
|
|
2100 {
|
|
2101 case -2:
|
|
2102 emsg = "uncompface: internal error";
|
|
2103 break;
|
|
2104 case -1:
|
|
2105 emsg = "uncompface: insufficient or invalid data";
|
|
2106 break;
|
|
2107 case 1:
|
|
2108 emsg = "uncompface: excess data ignored";
|
|
2109 break;
|
|
2110 }
|
|
2111
|
|
2112 if (emsg)
|
|
2113 signal_simple_error_2 (emsg, data, Qimage);
|
|
2114
|
|
2115 bp = bits = (char *) alloca (PIXELS / 8);
|
|
2116
|
|
2117 /* the compface library exports char F[], which uses a single byte per
|
|
2118 pixel to represent a 48x48 bitmap. Yuck. */
|
|
2119 for (i = 0, p = F; i < (PIXELS / 8); ++i)
|
|
2120 {
|
|
2121 int n, b;
|
|
2122 /* reverse the bit order of each byte... */
|
|
2123 for (b = n = 0; b < 8; ++b)
|
|
2124 {
|
|
2125 n |= ((*p++) << b);
|
|
2126 }
|
|
2127 *bp++ = (char) n;
|
|
2128 }
|
|
2129
|
|
2130 xbm_instantiate_1 (image_instance, instantiator, pointer_fg,
|
|
2131 pointer_bg, dest_mask, 48, 48, bits);
|
|
2132 }
|
|
2133
|
|
2134 #endif /* HAVE_XFACE */
|
|
2135
|
|
2136
|
|
2137 /**********************************************************************
|
122
|
2138 * Autodetect *
|
0
|
2139 **********************************************************************/
|
|
2140
|
|
2141 static void
|
122
|
2142 autodetect_validate (Lisp_Object instantiator)
|
0
|
2143 {
|
|
2144 data_must_be_present (instantiator);
|
|
2145 }
|
|
2146
|
|
2147 static Lisp_Object
|
122
|
2148 autodetect_normalize (Lisp_Object instantiator,
|
120
|
2149 Lisp_Object console_type)
|
0
|
2150 {
|
|
2151 Lisp_Object file = find_keyword_in_vector (instantiator, Q_data);
|
|
2152 Lisp_Object filename = Qnil;
|
|
2153 Lisp_Object data = Qnil;
|
|
2154 struct gcpro gcpro1, gcpro2, gcpro3;
|
|
2155 Lisp_Object alist = Qnil;
|
|
2156
|
|
2157 GCPRO3 (filename, data, alist);
|
|
2158
|
|
2159 if (NILP (file)) /* no conversion necessary */
|
|
2160 RETURN_UNGCPRO (instantiator);
|
|
2161
|
|
2162 alist = tagged_vector_to_alist (instantiator);
|
|
2163
|
|
2164 filename = locate_pixmap_file (file);
|
|
2165 if (!NILP (filename))
|
|
2166 {
|
|
2167 int xhot, yhot;
|
|
2168 /* #### Apparently some versions of XpmReadFileToData, which is
|
|
2169 called by pixmap_to_lisp_data, don't return an error value
|
|
2170 if the given file is not a valid XPM file. Instead, they
|
|
2171 just seg fault. It is definitely caused by passing a
|
|
2172 bitmap. To try and avoid this we check for bitmaps first. */
|
185
|
2173
|
0
|
2174 data = bitmap_to_lisp_data (filename, &xhot, &yhot, 1);
|
|
2175
|
|
2176 if (!EQ (data, Qt))
|
|
2177 {
|
|
2178 alist = remassq_no_quit (Q_data, alist);
|
|
2179 alist = Fcons (Fcons (Q_file, filename),
|
|
2180 Fcons (Fcons (Q_data, data), alist));
|
|
2181 if (xhot != -1)
|
|
2182 alist = Fcons (Fcons (Q_hotspot_x, make_int (xhot)),
|
|
2183 alist);
|
|
2184 if (yhot != -1)
|
|
2185 alist = Fcons (Fcons (Q_hotspot_y, make_int (yhot)),
|
|
2186 alist);
|
|
2187
|
|
2188 alist = xbm_mask_file_munging (alist, filename, Qnil);
|
|
2189
|
|
2190 {
|
|
2191 Lisp_Object result = alist_to_tagged_vector (Qxbm, alist);
|
|
2192 free_alist (alist);
|
|
2193 RETURN_UNGCPRO (result);
|
|
2194 }
|
|
2195 }
|
|
2196
|
|
2197 #ifdef HAVE_XPM
|
|
2198 data = pixmap_to_lisp_data (filename, 1);
|
|
2199
|
|
2200 if (!EQ (data, Qt))
|
|
2201 {
|
|
2202 alist = remassq_no_quit (Q_data, alist);
|
|
2203 alist = Fcons (Fcons (Q_file, filename),
|
|
2204 Fcons (Fcons (Q_data, data), alist));
|
|
2205 alist = Fcons (Fcons (Q_color_symbols,
|
|
2206 evaluate_xpm_color_symbols ()),
|
|
2207 alist);
|
|
2208 {
|
|
2209 Lisp_Object result = alist_to_tagged_vector (Qxpm, alist);
|
|
2210 free_alist (alist);
|
|
2211 RETURN_UNGCPRO (result);
|
|
2212 }
|
|
2213 }
|
|
2214 #endif
|
|
2215 }
|
|
2216
|
|
2217 /* If we couldn't convert it, just put it back as it is.
|
|
2218 We might try to further frob it later as a cursor-font
|
|
2219 specification. (We can't do that now because we don't know
|
|
2220 what dest-types it's going to be instantiated into.) */
|
|
2221 {
|
122
|
2222 Lisp_Object result = alist_to_tagged_vector (Qautodetect, alist);
|
0
|
2223 free_alist (alist);
|
|
2224 RETURN_UNGCPRO (result);
|
|
2225 }
|
|
2226 }
|
|
2227
|
|
2228 static int
|
122
|
2229 autodetect_possible_dest_types (void)
|
0
|
2230 {
|
74
|
2231 return
|
|
2232 IMAGE_MONO_PIXMAP_MASK |
|
|
2233 IMAGE_COLOR_PIXMAP_MASK |
|
|
2234 IMAGE_POINTER_MASK |
|
|
2235 IMAGE_TEXT_MASK;
|
0
|
2236 }
|
|
2237
|
|
2238 static void
|
122
|
2239 autodetect_instantiate (Lisp_Object image_instance,
|
120
|
2240 Lisp_Object instantiator,
|
|
2241 Lisp_Object pointer_fg,
|
|
2242 Lisp_Object pointer_bg,
|
124
|
2243 int dest_mask, Lisp_Object domain)
|
0
|
2244 {
|
|
2245 Lisp_Object data = find_keyword_in_vector (instantiator, Q_data);
|
|
2246 struct gcpro gcpro1, gcpro2, gcpro3;
|
|
2247 Lisp_Object alist = Qnil;
|
|
2248 Lisp_Object result = Qnil;
|
|
2249 int is_cursor_font = 0;
|
|
2250
|
|
2251 GCPRO3 (data, alist, result);
|
|
2252
|
|
2253 alist = tagged_vector_to_alist (instantiator);
|
|
2254 if (dest_mask & IMAGE_POINTER_MASK)
|
|
2255 {
|
|
2256 CONST char *name_ext;
|
|
2257 GET_C_STRING_FILENAME_DATA_ALLOCA (data, name_ext);
|
|
2258 if (XmuCursorNameToIndex (name_ext) != -1)
|
|
2259 {
|
|
2260 result = alist_to_tagged_vector (Qcursor_font, alist);
|
|
2261 is_cursor_font = 1;
|
|
2262 }
|
|
2263 }
|
|
2264
|
|
2265 if (!is_cursor_font)
|
|
2266 result = alist_to_tagged_vector (Qstring, alist);
|
|
2267 free_alist (alist);
|
|
2268
|
|
2269 if (is_cursor_font)
|
|
2270 cursor_font_instantiate (image_instance, result, pointer_fg,
|
124
|
2271 pointer_bg, dest_mask, domain);
|
0
|
2272 else
|
|
2273 string_instantiate (image_instance, result, pointer_fg,
|
124
|
2274 pointer_bg, dest_mask, domain);
|
0
|
2275
|
|
2276 UNGCPRO;
|
|
2277 }
|
|
2278
|
|
2279
|
|
2280 /**********************************************************************
|
|
2281 * Font *
|
|
2282 **********************************************************************/
|
|
2283
|
|
2284 static void
|
|
2285 font_validate (Lisp_Object instantiator)
|
|
2286 {
|
|
2287 data_must_be_present (instantiator);
|
|
2288 }
|
|
2289
|
|
2290 /* XmuCvtStringToCursor is bogus in the following ways:
|
|
2291
|
|
2292 - When it can't convert the given string to a real cursor, it will
|
|
2293 sometimes return a "success" value, after triggering a BadPixmap
|
|
2294 error. It then gives you a cursor that will itself generate BadCursor
|
|
2295 errors. So we install this error handler to catch/notice the X error
|
|
2296 and take that as meaning "couldn't convert."
|
|
2297
|
|
2298 - When you tell it to find a cursor file that doesn't exist, it prints
|
|
2299 an error message on stderr. You can't make it not do that.
|
|
2300
|
|
2301 - Also, using Xmu means we can't properly hack Lisp_Image_Instance
|
|
2302 objects, or XPM files, or $XBMLANGPATH.
|
|
2303 */
|
|
2304
|
|
2305 /* Duplicate the behavior of XmuCvtStringToCursor() to bypass its bogusness. */
|
|
2306
|
|
2307 static int XLoadFont_got_error;
|
|
2308
|
|
2309 static int
|
|
2310 XLoadFont_error_handler (Display *dpy, XErrorEvent *xerror)
|
|
2311 {
|
|
2312 XLoadFont_got_error = 1;
|
|
2313 return 0;
|
|
2314 }
|
|
2315
|
|
2316 static Font
|
|
2317 safe_XLoadFont (Display *dpy, char *name)
|
|
2318 {
|
|
2319 Font font;
|
|
2320 int (*old_handler) (Display *, XErrorEvent *);
|
|
2321 XLoadFont_got_error = 0;
|
|
2322 XSync (dpy, 0);
|
|
2323 old_handler = XSetErrorHandler (XLoadFont_error_handler);
|
|
2324 font = XLoadFont (dpy, name);
|
|
2325 XSync (dpy, 0);
|
|
2326 XSetErrorHandler (old_handler);
|
|
2327 if (XLoadFont_got_error) return 0;
|
|
2328 return font;
|
|
2329 }
|
|
2330
|
|
2331 static int
|
74
|
2332 font_possible_dest_types (void)
|
0
|
2333 {
|
|
2334 return IMAGE_POINTER_MASK;
|
|
2335 }
|
|
2336
|
|
2337 static void
|
|
2338 font_instantiate (Lisp_Object image_instance, Lisp_Object instantiator,
|
|
2339 Lisp_Object pointer_fg, Lisp_Object pointer_bg,
|
124
|
2340 int dest_mask, Lisp_Object domain)
|
0
|
2341 {
|
|
2342 /* This function can GC */
|
|
2343 Lisp_Object data = find_keyword_in_vector (instantiator, Q_data);
|
|
2344 struct Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance);
|
|
2345 Lisp_Object device = IMAGE_INSTANCE_DEVICE (ii);
|
|
2346 Display *dpy;
|
|
2347 XColor fg, bg;
|
|
2348 Font source, mask;
|
|
2349 char source_name[MAXPATHLEN], mask_name[MAXPATHLEN], dummy;
|
|
2350 int source_char, mask_char;
|
|
2351 int count;
|
|
2352 Lisp_Object foreground, background;
|
|
2353
|
|
2354 if (!DEVICE_X_P (XDEVICE (device)))
|
|
2355 signal_simple_error ("Not an X device", device);
|
|
2356
|
|
2357 dpy = DEVICE_X_DISPLAY (XDEVICE (device));
|
|
2358
|
|
2359 if (!STRINGP (data) ||
|
14
|
2360 strncmp ("FONT ", (char *) XSTRING_DATA (data), 5))
|
0
|
2361 signal_simple_error ("Invalid font-glyph instantiator",
|
|
2362 instantiator);
|
|
2363
|
|
2364 if (!(dest_mask & IMAGE_POINTER_MASK))
|
|
2365 incompatible_image_types (instantiator, dest_mask, IMAGE_POINTER_MASK);
|
|
2366
|
|
2367 foreground = find_keyword_in_vector (instantiator, Q_foreground);
|
|
2368 if (NILP (foreground))
|
|
2369 foreground = pointer_fg;
|
|
2370 background = find_keyword_in_vector (instantiator, Q_background);
|
|
2371 if (NILP (background))
|
|
2372 background = pointer_bg;
|
|
2373
|
|
2374 generate_cursor_fg_bg (device, &foreground, &background, &fg, &bg);
|
|
2375
|
14
|
2376 count = sscanf ((char *) XSTRING_DATA (data),
|
0
|
2377 "FONT %s %d %s %d %c",
|
|
2378 source_name, &source_char,
|
|
2379 mask_name, &mask_char, &dummy);
|
|
2380 /* Allow "%s %d %d" as well... */
|
|
2381 if (count == 3 && (1 == sscanf (mask_name, "%d %c", &mask_char, &dummy)))
|
|
2382 count = 4, mask_name[0] = 0;
|
|
2383
|
|
2384 if (count != 2 && count != 4)
|
|
2385 signal_simple_error ("invalid cursor specification", data);
|
|
2386 source = safe_XLoadFont (dpy, source_name);
|
|
2387 if (! source)
|
|
2388 signal_simple_error_2 ("couldn't load font",
|
|
2389 build_string (source_name),
|
|
2390 data);
|
|
2391 if (count == 2)
|
|
2392 mask = 0;
|
|
2393 else if (!mask_name[0])
|
|
2394 mask = source;
|
|
2395 else
|
|
2396 {
|
|
2397 mask = safe_XLoadFont (dpy, mask_name);
|
|
2398 if (!mask)
|
|
2399 /* continuable */
|
|
2400 Fsignal (Qerror, list3 (build_string ("couldn't load font"),
|
|
2401 build_string (mask_name), data));
|
|
2402 }
|
|
2403 if (!mask)
|
|
2404 mask_char = 0;
|
|
2405
|
|
2406 /* #### call XQueryTextExtents() and check_pointer_sizes() here. */
|
|
2407
|
|
2408 x_initialize_pixmap_image_instance (ii, IMAGE_POINTER);
|
|
2409 IMAGE_INSTANCE_X_CURSOR (ii) =
|
|
2410 XCreateGlyphCursor (dpy, source, mask, source_char, mask_char,
|
|
2411 &fg, &bg);
|
|
2412 XIMAGE_INSTANCE_PIXMAP_FG (image_instance) = foreground;
|
|
2413 XIMAGE_INSTANCE_PIXMAP_BG (image_instance) = background;
|
|
2414 XUnloadFont (dpy, source);
|
|
2415 if (mask && mask != source) XUnloadFont (dpy, mask);
|
|
2416 }
|
|
2417
|
|
2418
|
|
2419 /**********************************************************************
|
|
2420 * Cursor-Font *
|
|
2421 **********************************************************************/
|
|
2422
|
|
2423 static void
|
|
2424 cursor_font_validate (Lisp_Object instantiator)
|
|
2425 {
|
|
2426 data_must_be_present (instantiator);
|
|
2427 }
|
|
2428
|
|
2429 static int
|
74
|
2430 cursor_font_possible_dest_types (void)
|
0
|
2431 {
|
|
2432 return IMAGE_POINTER_MASK;
|
|
2433 }
|
|
2434
|
|
2435 static void
|
|
2436 cursor_font_instantiate (Lisp_Object image_instance, Lisp_Object instantiator,
|
|
2437 Lisp_Object pointer_fg, Lisp_Object pointer_bg,
|
124
|
2438 int dest_mask, Lisp_Object domain)
|
0
|
2439 {
|
|
2440 /* This function can GC */
|
|
2441 Lisp_Object data = find_keyword_in_vector (instantiator, Q_data);
|
|
2442 struct Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance);
|
|
2443 Lisp_Object device = IMAGE_INSTANCE_DEVICE (ii);
|
|
2444 Display *dpy;
|
|
2445 int i;
|
|
2446 CONST char *name_ext;
|
|
2447 Lisp_Object foreground, background;
|
|
2448
|
|
2449 if (!DEVICE_X_P (XDEVICE (device)))
|
|
2450 signal_simple_error ("Not an X device", device);
|
|
2451
|
|
2452 dpy = DEVICE_X_DISPLAY (XDEVICE (device));
|
|
2453
|
|
2454 if (!(dest_mask & IMAGE_POINTER_MASK))
|
|
2455 incompatible_image_types (instantiator, dest_mask, IMAGE_POINTER_MASK);
|
|
2456
|
|
2457 GET_C_STRING_FILENAME_DATA_ALLOCA (data, name_ext);
|
|
2458 if ((i = XmuCursorNameToIndex (name_ext)) == -1)
|
|
2459 signal_simple_error ("Unrecognized cursor-font name", data);
|
|
2460
|
|
2461 x_initialize_pixmap_image_instance (ii, IMAGE_POINTER);
|
|
2462 IMAGE_INSTANCE_X_CURSOR (ii) = XCreateFontCursor (dpy, i);
|
|
2463 foreground = find_keyword_in_vector (instantiator, Q_foreground);
|
|
2464 if (NILP (foreground))
|
|
2465 foreground = pointer_fg;
|
|
2466 background = find_keyword_in_vector (instantiator, Q_background);
|
|
2467 if (NILP (background))
|
|
2468 background = pointer_bg;
|
|
2469 maybe_recolor_cursor (image_instance, foreground, background);
|
|
2470 }
|
|
2471
|
|
2472 static int
|
|
2473 x_colorize_image_instance (Lisp_Object image_instance,
|
|
2474 Lisp_Object foreground, Lisp_Object background)
|
|
2475 {
|
|
2476 struct Lisp_Image_Instance *p;
|
|
2477
|
|
2478 p = XIMAGE_INSTANCE (image_instance);
|
|
2479
|
|
2480 switch (IMAGE_INSTANCE_TYPE (p))
|
|
2481 {
|
|
2482 case IMAGE_MONO_PIXMAP:
|
|
2483 IMAGE_INSTANCE_TYPE (p) = IMAGE_COLOR_PIXMAP;
|
|
2484 /* Make sure there aren't two pointers to the same mask, causing
|
|
2485 it to get freed twice. */
|
|
2486 IMAGE_INSTANCE_X_MASK (p) = 0;
|
|
2487 break;
|
|
2488
|
|
2489 default:
|
|
2490 return 0;
|
|
2491 }
|
|
2492
|
|
2493 {
|
|
2494 Display *dpy = DEVICE_X_DISPLAY (XDEVICE (IMAGE_INSTANCE_DEVICE (p)));
|
219
|
2495 Drawable draw = XtWindow(DEVICE_XT_APP_SHELL (XDEVICE (IMAGE_INSTANCE_DEVICE (p))));
|
|
2496 Dimension d = DEVICE_X_DEPTH (XDEVICE (IMAGE_INSTANCE_DEVICE (p)));
|
|
2497 Pixmap new = XCreatePixmap (dpy, draw,
|
0
|
2498 IMAGE_INSTANCE_PIXMAP_WIDTH (p),
|
|
2499 IMAGE_INSTANCE_PIXMAP_HEIGHT (p), d);
|
|
2500 XColor color;
|
|
2501 XGCValues gcv;
|
|
2502 GC gc;
|
|
2503 color = COLOR_INSTANCE_X_COLOR (XCOLOR_INSTANCE (foreground));
|
|
2504 gcv.foreground = color.pixel;
|
|
2505 color = COLOR_INSTANCE_X_COLOR (XCOLOR_INSTANCE (background));
|
|
2506 gcv.background = color.pixel;
|
|
2507 gc = XCreateGC (dpy, new, GCBackground|GCForeground, &gcv);
|
|
2508 XCopyPlane (dpy, IMAGE_INSTANCE_X_PIXMAP (p), new, gc, 0, 0,
|
|
2509 IMAGE_INSTANCE_PIXMAP_WIDTH (p),
|
|
2510 IMAGE_INSTANCE_PIXMAP_HEIGHT (p),
|
|
2511 0, 0, 1);
|
|
2512 XFreeGC (dpy, gc);
|
|
2513 IMAGE_INSTANCE_X_PIXMAP (p) = new;
|
|
2514 IMAGE_INSTANCE_PIXMAP_DEPTH (p) = d;
|
|
2515 IMAGE_INSTANCE_PIXMAP_FG (p) = foreground;
|
|
2516 IMAGE_INSTANCE_PIXMAP_BG (p) = background;
|
|
2517 return 1;
|
|
2518 }
|
|
2519 }
|
|
2520
|
|
2521
|
114
|
2522 #if HAVE_SUBWINDOWS
|
0
|
2523 /************************************************************************/
|
|
2524 /* subwindows */
|
|
2525 /************************************************************************/
|
|
2526
|
|
2527 Lisp_Object Qsubwindowp;
|
|
2528 static Lisp_Object mark_subwindow (Lisp_Object, void (*) (Lisp_Object));
|
|
2529 static void print_subwindow (Lisp_Object, Lisp_Object, int);
|
|
2530 static void finalize_subwindow (void *, int);
|
|
2531 static int subwindow_equal (Lisp_Object o1, Lisp_Object o2, int depth);
|
|
2532 static unsigned long subwindow_hash (Lisp_Object obj, int depth);
|
|
2533 DEFINE_LRECORD_IMPLEMENTATION ("subwindow", subwindow,
|
|
2534 mark_subwindow, print_subwindow,
|
|
2535 finalize_subwindow, subwindow_equal,
|
|
2536 subwindow_hash, struct Lisp_Subwindow);
|
|
2537
|
|
2538 static Lisp_Object
|
|
2539 mark_subwindow (Lisp_Object obj, void (*markobj) (Lisp_Object))
|
|
2540 {
|
|
2541 struct Lisp_Subwindow *sw = XSUBWINDOW (obj);
|
|
2542 return sw->frame;
|
|
2543 }
|
|
2544
|
|
2545 static void
|
|
2546 print_subwindow (Lisp_Object obj, Lisp_Object printcharfun, int escapeflag)
|
|
2547 {
|
|
2548 char buf[100];
|
|
2549 struct Lisp_Subwindow *sw = XSUBWINDOW (obj);
|
|
2550 struct frame *frm = XFRAME (sw->frame);
|
|
2551
|
|
2552 if (print_readably)
|
|
2553 error ("printing unreadable object #<subwindow 0x%x>",
|
|
2554 sw->header.uid);
|
|
2555
|
|
2556 write_c_string ("#<subwindow", printcharfun);
|
|
2557 sprintf (buf, " %dx%d", sw->width, sw->height);
|
|
2558 write_c_string (buf, printcharfun);
|
|
2559
|
|
2560 /* This is stolen from frame.c. Subwindows are strange in that they
|
|
2561 are specific to a particular frame so we want to print in their
|
|
2562 description what that frame is. */
|
185
|
2563
|
0
|
2564 write_c_string (" on #<", printcharfun);
|
|
2565 if (!FRAME_LIVE_P (frm))
|
|
2566 write_c_string ("dead", printcharfun);
|
|
2567 else if (FRAME_TTY_P (frm))
|
|
2568 write_c_string ("tty", printcharfun);
|
|
2569 else if (FRAME_X_P (frm))
|
|
2570 write_c_string ("x", printcharfun);
|
|
2571 else
|
|
2572 write_c_string ("UNKNOWN", printcharfun);
|
|
2573 write_c_string ("-frame ", printcharfun);
|
|
2574 print_internal (frm->name, printcharfun, 1);
|
|
2575 sprintf (buf, " 0x%x>", frm->header.uid);
|
|
2576 write_c_string (buf, printcharfun);
|
|
2577
|
|
2578 sprintf (buf, ") 0x%x>", sw->header.uid);
|
|
2579 write_c_string (buf, printcharfun);
|
|
2580 }
|
|
2581
|
|
2582 static void
|
|
2583 finalize_subwindow (void *header, int for_disksave)
|
|
2584 {
|
|
2585 struct Lisp_Subwindow *sw = (struct Lisp_Subwindow *) header;
|
|
2586 if (for_disksave) finalose (sw);
|
|
2587 if (sw->subwindow)
|
|
2588 {
|
|
2589 XDestroyWindow (DisplayOfScreen (sw->xscreen), sw->subwindow);
|
|
2590 sw->subwindow = 0;
|
|
2591 }
|
|
2592 }
|
|
2593
|
|
2594 /* subwindows are equal iff they have the same window XID */
|
|
2595 static int
|
|
2596 subwindow_equal (Lisp_Object o1, Lisp_Object o2, int depth)
|
|
2597 {
|
|
2598 return (XSUBWINDOW (o1)->subwindow == XSUBWINDOW (o2)->subwindow);
|
|
2599 }
|
|
2600
|
|
2601 static unsigned long
|
|
2602 subwindow_hash (Lisp_Object obj, int depth)
|
|
2603 {
|
|
2604 return XSUBWINDOW (obj)->subwindow;
|
|
2605 }
|
|
2606
|
|
2607 /* #### PROBLEM: The display routines assume that the glyph is only
|
|
2608 being displayed in one buffer. If it is in two different buffers
|
|
2609 which are both being displayed simultaneously you will lose big time.
|
|
2610 This can be dealt with in the new redisplay. */
|
|
2611
|
70
|
2612 /* #### These are completely un-re-implemented in 19.14. Get it done
|
|
2613 for 19.15. */
|
0
|
2614
|
20
|
2615 DEFUN ("make-subwindow", Fmake_subwindow, 0, 3, 0, /*
|
0
|
2616 Creates a new `subwindow' object of size WIDTH x HEIGHT.
|
|
2617 The default is a window of size 1x1, which is also the minimum allowed
|
|
2618 window size. Subwindows are per-frame. A buffer being shown in two
|
|
2619 different frames will only display a subwindow glyph in the frame in
|
|
2620 which it was actually created. If two windows on the same frame are
|
|
2621 displaying the buffer then the most recently used window will actually
|
|
2622 display the window. If the frame is not specified, the selected frame
|
|
2623 is used.
|
|
2624
|
|
2625 Subwindows are not currently implemented.
|
20
|
2626 */
|
|
2627 (width, height, frame))
|
0
|
2628 {
|
|
2629 Display *dpy;
|
|
2630 Screen *xs;
|
|
2631 Window pw;
|
|
2632 struct frame *f;
|
|
2633 unsigned int iw, ih;
|
|
2634 XSetWindowAttributes xswa;
|
|
2635 Mask valueMask = 0;
|
|
2636
|
140
|
2637 error ("subwindows are not functional in 20.2; they may be again someday");
|
0
|
2638
|
|
2639 f = decode_x_frame (frame);
|
|
2640
|
|
2641 xs = LISP_DEVICE_TO_X_SCREEN (FRAME_DEVICE (f));
|
|
2642 dpy = DisplayOfScreen (xs);
|
|
2643 pw = XtWindow (FRAME_X_TEXT_WIDGET (f));
|
|
2644
|
|
2645 if (NILP (width))
|
|
2646 iw = 1;
|
|
2647 else
|
|
2648 {
|
|
2649 CHECK_INT (width);
|
|
2650 iw = XINT (width);
|
|
2651 if (iw < 1) iw = 1;
|
|
2652 }
|
|
2653 if (NILP (height))
|
|
2654 ih = 1;
|
|
2655 else
|
|
2656 {
|
|
2657 CHECK_INT (height);
|
|
2658 ih = XINT (height);
|
|
2659 if (ih < 1) ih = 1;
|
|
2660 }
|
|
2661
|
|
2662 {
|
185
|
2663 struct Lisp_Subwindow *sw =
|
|
2664 alloc_lcrecord_type (struct Lisp_Subwindow, lrecord_subwindow);
|
0
|
2665 Lisp_Object val;
|
|
2666 sw->frame = frame;
|
|
2667 sw->xscreen = xs;
|
|
2668 sw->parent_window = pw;
|
|
2669 sw->height = ih;
|
|
2670 sw->width = iw;
|
|
2671
|
|
2672 xswa.backing_store = Always;
|
|
2673 valueMask |= CWBackingStore;
|
|
2674
|
|
2675 xswa.colormap = DefaultColormapOfScreen (xs);
|
|
2676 valueMask |= CWColormap;
|
|
2677
|
|
2678 sw->subwindow = XCreateWindow (dpy, pw, 0, 0, iw, ih, 0, CopyFromParent,
|
|
2679 InputOutput, CopyFromParent, valueMask,
|
|
2680 &xswa);
|
|
2681
|
|
2682 XSETSUBWINDOW (val, sw);
|
|
2683 return val;
|
|
2684 }
|
|
2685 }
|
|
2686
|
|
2687 /* #### Should this function exist? */
|
20
|
2688 DEFUN ("change-subwindow-property", Fchange_subwindow_property, 3, 3, 0, /*
|
0
|
2689 For the given SUBWINDOW, set PROPERTY to DATA, which is a string.
|
|
2690 Subwindows are not currently implemented.
|
20
|
2691 */
|
|
2692 (subwindow, property, data))
|
0
|
2693 {
|
|
2694 Atom property_atom;
|
|
2695 struct Lisp_Subwindow *sw;
|
|
2696 Display *dpy;
|
|
2697
|
|
2698 CHECK_SUBWINDOW (subwindow);
|
|
2699 CHECK_STRING (property);
|
|
2700 CHECK_STRING (data);
|
|
2701
|
|
2702 sw = XSUBWINDOW (subwindow);
|
|
2703 dpy = DisplayOfScreen (LISP_DEVICE_TO_X_SCREEN
|
|
2704 (FRAME_DEVICE (XFRAME (sw->frame))));
|
|
2705
|
16
|
2706 property_atom = XInternAtom (dpy, (char *) XSTRING_DATA (property), False);
|
0
|
2707 XChangeProperty (dpy, sw->subwindow, property_atom, XA_STRING, 8,
|
16
|
2708 PropModeReplace,
|
|
2709 XSTRING_DATA (data),
|
14
|
2710 XSTRING_LENGTH (data));
|
0
|
2711
|
|
2712 return (property);
|
|
2713 }
|
|
2714
|
20
|
2715 DEFUN ("subwindowp", Fsubwindowp, 1, 1, 0, /*
|
0
|
2716 Return non-nil if OBJECT is a subwindow.
|
|
2717 Subwindows are not currently implemented.
|
20
|
2718 */
|
|
2719 (object))
|
0
|
2720 {
|
|
2721 return (SUBWINDOWP (object) ? Qt : Qnil);
|
|
2722 }
|
|
2723
|
20
|
2724 DEFUN ("subwindow-width", Fsubwindow_width, 1, 1, 0, /*
|
0
|
2725 Width of SUBWINDOW.
|
|
2726 Subwindows are not currently implemented.
|
20
|
2727 */
|
|
2728 (subwindow))
|
0
|
2729 {
|
|
2730 CHECK_SUBWINDOW (subwindow);
|
|
2731 return (make_int (XSUBWINDOW (subwindow)->width));
|
|
2732 }
|
|
2733
|
20
|
2734 DEFUN ("subwindow-height", Fsubwindow_height, 1, 1, 0, /*
|
0
|
2735 Height of SUBWINDOW.
|
|
2736 Subwindows are not currently implemented.
|
20
|
2737 */
|
|
2738 (subwindow))
|
0
|
2739 {
|
|
2740 CHECK_SUBWINDOW (subwindow);
|
|
2741 return (make_int (XSUBWINDOW (subwindow)->height));
|
|
2742 }
|
|
2743
|
20
|
2744 DEFUN ("subwindow-xid", Fsubwindow_xid, 1, 1, 0, /*
|
0
|
2745 Return the xid of SUBWINDOW as a number.
|
|
2746 Subwindows are not currently implemented.
|
20
|
2747 */
|
|
2748 (subwindow))
|
0
|
2749 {
|
|
2750 CHECK_SUBWINDOW (subwindow);
|
|
2751 return (make_int (XSUBWINDOW (subwindow)->subwindow));
|
|
2752 }
|
|
2753
|
20
|
2754 DEFUN ("resize-subwindow", Fresize_subwindow, 1, 3, 0, /*
|
0
|
2755 Resize SUBWINDOW to WIDTH x HEIGHT.
|
|
2756 If a value is nil that parameter is not changed.
|
|
2757 Subwindows are not currently implemented.
|
20
|
2758 */
|
|
2759 (subwindow, width, height))
|
0
|
2760 {
|
|
2761 int neww, newh;
|
|
2762 struct Lisp_Subwindow *sw;
|
|
2763
|
|
2764 CHECK_SUBWINDOW (subwindow);
|
|
2765 sw = XSUBWINDOW (subwindow);
|
|
2766
|
|
2767 if (NILP (width))
|
|
2768 neww = sw->width;
|
|
2769 else
|
|
2770 neww = XINT (width);
|
|
2771
|
|
2772 if (NILP (height))
|
|
2773 newh = sw->height;
|
|
2774 else
|
|
2775 newh = XINT (height);
|
|
2776
|
|
2777 XResizeWindow (DisplayOfScreen (sw->xscreen), sw->subwindow, neww, newh);
|
|
2778
|
|
2779 sw->height = newh;
|
|
2780 sw->width = neww;
|
|
2781
|
|
2782 return subwindow;
|
|
2783 }
|
|
2784
|
20
|
2785 DEFUN ("force-subwindow-map", Fforce_subwindow_map, 1, 1, 0, /*
|
0
|
2786 Generate a Map event for SUBWINDOW.
|
|
2787 Subwindows are not currently implemented.
|
20
|
2788 */
|
|
2789 (subwindow))
|
0
|
2790 {
|
|
2791 CHECK_SUBWINDOW (subwindow);
|
|
2792
|
|
2793 XMapWindow (DisplayOfScreen (XSUBWINDOW (subwindow)->xscreen),
|
|
2794 XSUBWINDOW (subwindow)->subwindow);
|
|
2795
|
|
2796 return subwindow;
|
|
2797 }
|
114
|
2798 #endif
|
0
|
2799
|
|
2800 /************************************************************************/
|
|
2801 /* initialization */
|
|
2802 /************************************************************************/
|
|
2803
|
|
2804 void
|
|
2805 syms_of_glyphs_x (void)
|
|
2806 {
|
114
|
2807 #if HAVE_SUBWINDOWS
|
0
|
2808 defsymbol (&Qsubwindowp, "subwindowp");
|
|
2809
|
20
|
2810 DEFSUBR (Fmake_subwindow);
|
|
2811 DEFSUBR (Fchange_subwindow_property);
|
|
2812 DEFSUBR (Fsubwindowp);
|
|
2813 DEFSUBR (Fsubwindow_width);
|
|
2814 DEFSUBR (Fsubwindow_height);
|
|
2815 DEFSUBR (Fsubwindow_xid);
|
|
2816 DEFSUBR (Fresize_subwindow);
|
|
2817 DEFSUBR (Fforce_subwindow_map);
|
114
|
2818 #endif
|
0
|
2819
|
|
2820 defkeyword (&Q_mask_file, ":mask-file");
|
|
2821 defkeyword (&Q_mask_data, ":mask-data");
|
|
2822 defkeyword (&Q_hotspot_x, ":hotspot-x");
|
|
2823 defkeyword (&Q_hotspot_y, ":hotspot-y");
|
|
2824 defkeyword (&Q_foreground, ":foreground");
|
|
2825 defkeyword (&Q_background, ":background");
|
|
2826
|
|
2827 #ifdef HAVE_XPM
|
|
2828 defkeyword (&Q_color_symbols, ":color-symbols");
|
|
2829 #endif
|
|
2830 }
|
|
2831
|
|
2832 void
|
|
2833 console_type_create_glyphs_x (void)
|
|
2834 {
|
|
2835 /* image methods */
|
|
2836
|
|
2837 CONSOLE_HAS_METHOD (x, print_image_instance);
|
|
2838 CONSOLE_HAS_METHOD (x, finalize_image_instance);
|
|
2839 CONSOLE_HAS_METHOD (x, image_instance_equal);
|
|
2840 CONSOLE_HAS_METHOD (x, image_instance_hash);
|
|
2841 CONSOLE_HAS_METHOD (x, colorize_image_instance);
|
|
2842 }
|
|
2843
|
|
2844 void
|
|
2845 image_instantiator_format_create_glyphs_x (void)
|
|
2846 {
|
|
2847 /* image-instantiator types */
|
|
2848
|
|
2849 INITIALIZE_IMAGE_INSTANTIATOR_FORMAT (xbm, "xbm");
|
|
2850
|
|
2851 IIFORMAT_HAS_METHOD (xbm, validate);
|
|
2852 IIFORMAT_HAS_METHOD (xbm, normalize);
|
|
2853 IIFORMAT_HAS_METHOD (xbm, possible_dest_types);
|
|
2854 IIFORMAT_HAS_METHOD (xbm, instantiate);
|
|
2855
|
|
2856 IIFORMAT_VALID_KEYWORD (xbm, Q_data, check_valid_xbm_inline);
|
|
2857 IIFORMAT_VALID_KEYWORD (xbm, Q_file, check_valid_string);
|
|
2858 IIFORMAT_VALID_KEYWORD (xbm, Q_mask_data, check_valid_xbm_inline);
|
|
2859 IIFORMAT_VALID_KEYWORD (xbm, Q_mask_file, check_valid_string);
|
|
2860 IIFORMAT_VALID_KEYWORD (xbm, Q_hotspot_x, check_valid_int);
|
|
2861 IIFORMAT_VALID_KEYWORD (xbm, Q_hotspot_y, check_valid_int);
|
|
2862 IIFORMAT_VALID_KEYWORD (xbm, Q_foreground, check_valid_string);
|
|
2863 IIFORMAT_VALID_KEYWORD (xbm, Q_background, check_valid_string);
|
|
2864
|
|
2865 INITIALIZE_IMAGE_INSTANTIATOR_FORMAT (cursor_font, "cursor-font");
|
|
2866
|
|
2867 IIFORMAT_HAS_METHOD (cursor_font, validate);
|
|
2868 IIFORMAT_HAS_METHOD (cursor_font, possible_dest_types);
|
|
2869 IIFORMAT_HAS_METHOD (cursor_font, instantiate);
|
|
2870
|
|
2871 IIFORMAT_VALID_KEYWORD (cursor_font, Q_data, check_valid_string);
|
|
2872 IIFORMAT_VALID_KEYWORD (cursor_font, Q_foreground, check_valid_string);
|
|
2873 IIFORMAT_VALID_KEYWORD (cursor_font, Q_background, check_valid_string);
|
|
2874
|
|
2875 INITIALIZE_IMAGE_INSTANTIATOR_FORMAT (font, "font");
|
|
2876
|
|
2877 IIFORMAT_HAS_METHOD (font, validate);
|
|
2878 IIFORMAT_HAS_METHOD (font, possible_dest_types);
|
|
2879 IIFORMAT_HAS_METHOD (font, instantiate);
|
|
2880
|
|
2881 IIFORMAT_VALID_KEYWORD (font, Q_data, check_valid_string);
|
|
2882 IIFORMAT_VALID_KEYWORD (font, Q_foreground, check_valid_string);
|
|
2883 IIFORMAT_VALID_KEYWORD (font, Q_background, check_valid_string);
|
|
2884
|
207
|
2885 #ifdef HAVE_IMAGEMAGICK
|
|
2886 INITIALIZE_IMAGE_INSTANTIATOR_FORMAT (imagick, "imagick");
|
|
2887
|
|
2888 IIFORMAT_HAS_METHOD (imagick, validate);
|
|
2889 IIFORMAT_HAS_METHOD (imagick, normalize);
|
|
2890 IIFORMAT_HAS_METHOD (imagick, possible_dest_types);
|
|
2891 IIFORMAT_HAS_METHOD (imagick, instantiate);
|
|
2892
|
|
2893 IIFORMAT_VALID_KEYWORD (imagick, Q_data, check_valid_string);
|
|
2894 IIFORMAT_VALID_KEYWORD (imagick, Q_file, check_valid_string);
|
221
|
2895
|
|
2896 #ifdef OLDCOMPAT /* old graphics compatibility */
|
|
2897 #define IIFORMAT_USES_METHOD(format, source, m) \
|
|
2898 (format##_image_instantiator_methods->m##_method = source##_##m)
|
|
2899
|
|
2900 INITIALIZE_IMAGE_INSTANTIATOR_FORMAT (tiff, "tiff");
|
|
2901 IIFORMAT_USES_METHOD (tiff, imagick, validate);
|
|
2902 IIFORMAT_USES_METHOD (tiff, imagick, normalize);
|
|
2903 IIFORMAT_USES_METHOD (tiff, imagick, possible_dest_types);
|
|
2904 IIFORMAT_USES_METHOD (tiff, imagick, instantiate);
|
|
2905 IIFORMAT_VALID_KEYWORD (tiff, Q_data, check_valid_string);
|
|
2906 IIFORMAT_VALID_KEYWORD (tiff, Q_file, check_valid_string);
|
|
2907
|
|
2908 INITIALIZE_IMAGE_INSTANTIATOR_FORMAT (png, "png");
|
|
2909 IIFORMAT_USES_METHOD (png, imagick, validate);
|
|
2910 IIFORMAT_USES_METHOD (png, imagick, normalize);
|
|
2911 IIFORMAT_USES_METHOD (png, imagick, possible_dest_types);
|
|
2912 IIFORMAT_USES_METHOD (png, imagick, instantiate);
|
|
2913 IIFORMAT_VALID_KEYWORD (png, Q_data, check_valid_string);
|
|
2914 IIFORMAT_VALID_KEYWORD (png, Q_file, check_valid_string);
|
|
2915
|
|
2916 INITIALIZE_IMAGE_INSTANTIATOR_FORMAT (gif, "gif");
|
|
2917 IIFORMAT_USES_METHOD (gif, imagick, validate);
|
|
2918 IIFORMAT_USES_METHOD (gif, imagick, normalize);
|
|
2919 IIFORMAT_USES_METHOD (gif, imagick, possible_dest_types);
|
|
2920 IIFORMAT_USES_METHOD (gif, imagick, instantiate);
|
|
2921 IIFORMAT_VALID_KEYWORD (gif, Q_data, check_valid_string);
|
|
2922 IIFORMAT_VALID_KEYWORD (gif, Q_file, check_valid_string);
|
|
2923
|
|
2924 INITIALIZE_IMAGE_INSTANTIATOR_FORMAT (jpeg, "jpeg");
|
|
2925 IIFORMAT_USES_METHOD (jpeg, imagick, validate);
|
|
2926 IIFORMAT_USES_METHOD (jpeg, imagick, normalize);
|
|
2927 IIFORMAT_USES_METHOD (jpeg, imagick, possible_dest_types);
|
|
2928 IIFORMAT_USES_METHOD (jpeg, imagick, instantiate);
|
|
2929 IIFORMAT_VALID_KEYWORD (jpeg, Q_data, check_valid_string);
|
|
2930 IIFORMAT_VALID_KEYWORD (jpeg, Q_file, check_valid_string);
|
|
2931
|
|
2932 #endif /* old compat */
|
|
2933
|
0
|
2934 #endif
|
|
2935
|
|
2936 #ifdef HAVE_XPM
|
|
2937 INITIALIZE_IMAGE_INSTANTIATOR_FORMAT (xpm, "xpm");
|
|
2938
|
|
2939 IIFORMAT_HAS_METHOD (xpm, validate);
|
|
2940 IIFORMAT_HAS_METHOD (xpm, normalize);
|
|
2941 IIFORMAT_HAS_METHOD (xpm, possible_dest_types);
|
|
2942 IIFORMAT_HAS_METHOD (xpm, instantiate);
|
|
2943
|
|
2944 IIFORMAT_VALID_KEYWORD (xpm, Q_data, check_valid_string);
|
|
2945 IIFORMAT_VALID_KEYWORD (xpm, Q_file, check_valid_string);
|
|
2946 IIFORMAT_VALID_KEYWORD (xpm, Q_color_symbols, check_valid_xpm_color_symbols);
|
|
2947 #endif
|
|
2948
|
|
2949 #ifdef HAVE_XFACE
|
|
2950 INITIALIZE_IMAGE_INSTANTIATOR_FORMAT (xface, "xface");
|
|
2951
|
|
2952 IIFORMAT_HAS_METHOD (xface, validate);
|
|
2953 IIFORMAT_HAS_METHOD (xface, normalize);
|
|
2954 IIFORMAT_HAS_METHOD (xface, possible_dest_types);
|
|
2955 IIFORMAT_HAS_METHOD (xface, instantiate);
|
|
2956
|
|
2957 IIFORMAT_VALID_KEYWORD (xface, Q_data, check_valid_string);
|
|
2958 IIFORMAT_VALID_KEYWORD (xface, Q_file, check_valid_string);
|
|
2959 IIFORMAT_VALID_KEYWORD (xface, Q_hotspot_x, check_valid_int);
|
|
2960 IIFORMAT_VALID_KEYWORD (xface, Q_hotspot_y, check_valid_int);
|
|
2961 IIFORMAT_VALID_KEYWORD (xface, Q_foreground, check_valid_string);
|
|
2962 IIFORMAT_VALID_KEYWORD (xface, Q_background, check_valid_string);
|
185
|
2963 #endif
|
0
|
2964
|
122
|
2965 INITIALIZE_IMAGE_INSTANTIATOR_FORMAT (autodetect,
|
|
2966 "autodetect");
|
|
2967
|
|
2968 IIFORMAT_HAS_METHOD (autodetect, validate);
|
|
2969 IIFORMAT_HAS_METHOD (autodetect, normalize);
|
|
2970 IIFORMAT_HAS_METHOD (autodetect, possible_dest_types);
|
|
2971 IIFORMAT_HAS_METHOD (autodetect, instantiate);
|
|
2972
|
|
2973 IIFORMAT_VALID_KEYWORD (autodetect, Q_data, check_valid_string);
|
0
|
2974 }
|
|
2975
|
|
2976 void
|
|
2977 vars_of_glyphs_x (void)
|
|
2978 {
|
|
2979 #ifdef HAVE_XPM
|
|
2980 Fprovide (Qxpm);
|
|
2981
|
|
2982 DEFVAR_LISP ("xpm-color-symbols", &Vxpm_color_symbols /*
|
|
2983 Definitions of logical color-names used when reading XPM files.
|
|
2984 Elements of this list should be of the form (COLOR-NAME FORM-TO-EVALUATE).
|
|
2985 The COLOR-NAME should be a string, which is the name of the color to define;
|
|
2986 the FORM should evaluate to a `color' specifier object, or a string to be
|
|
2987 passed to `make-color-instance'. If a loaded XPM file references a symbolic
|
|
2988 color called COLOR-NAME, it will display as the computed color instead.
|
|
2989
|
|
2990 The default value of this variable defines the logical color names
|
|
2991 \"foreground\" and \"background\" to be the colors of the `default' face.
|
|
2992 */ );
|
|
2993 Vxpm_color_symbols = Qnil; /* initialized in x-faces.el */
|
185
|
2994 #endif
|
0
|
2995
|
207
|
2996 #ifdef HAVE_IMAGEMAGICK
|
|
2997 Fprovide (Qimagick);
|
221
|
2998
|
|
2999 #ifdef OLDCOMPAT
|
|
3000 Fprovide (Qtiff);
|
|
3001 Fprovide (Qpng);
|
|
3002 Fprovide (Qgif);
|
|
3003 Fprovide (Qjpeg);
|
|
3004 #endif
|
207
|
3005 #endif
|
|
3006
|
0
|
3007 #ifdef HAVE_XFACE
|
|
3008 Fprovide (Qxface);
|
185
|
3009 #endif
|
0
|
3010
|
|
3011 DEFVAR_LISP ("x-bitmap-file-path", &Vx_bitmap_file_path /*
|
|
3012 A list of the directories in which X bitmap files may be found.
|
185
|
3013 If nil, this is initialized from the "*bitmapFilePath" resource.
|
0
|
3014 This is used by the `make-image-instance' function (however, note that if
|
|
3015 the environment variable XBMLANGPATH is set, it is consulted first).
|
|
3016 */ );
|
|
3017 Vx_bitmap_file_path = Qnil;
|
|
3018 }
|
|
3019
|
|
3020 void
|
|
3021 complex_vars_of_glyphs_x (void)
|
|
3022 {
|
|
3023 #define BUILD_GLYPH_INST(variable, name) \
|
|
3024 Fadd_spec_to_specifier \
|
|
3025 (GLYPH_IMAGE (XGLYPH (variable)), \
|
|
3026 vector3 (Qxbm, Q_data, \
|
|
3027 list3 (make_int (name##_width), \
|
|
3028 make_int (name##_height), \
|
|
3029 make_ext_string (name##_bits, \
|
|
3030 sizeof (name##_bits), \
|
|
3031 FORMAT_BINARY))), \
|
|
3032 Qglobal, Qx, Qnil)
|
|
3033
|
|
3034 BUILD_GLYPH_INST (Vtruncation_glyph, truncator);
|
|
3035 BUILD_GLYPH_INST (Vcontinuation_glyph, continuer);
|
|
3036 BUILD_GLYPH_INST (Vxemacs_logo, xemacs);
|
74
|
3037 BUILD_GLYPH_INST (Vhscroll_glyph, hscroll);
|
0
|
3038
|
|
3039 #undef BUILD_GLYPH_INST
|
|
3040 }
|