comparison src/glyphs-x.c @ 388:aabb7f5b1c81 r21-2-9

Import from CVS: tag r21-2-9
author cvs
date Mon, 13 Aug 2007 11:09:42 +0200
parents bbff43aa5eb7
children 1f50e6fe4f3f
comparison
equal deleted inserted replaced
387:f892a9d0bb8d 388:aabb7f5b1c81
85 DEFINE_DEVICE_IIFORMAT (x, xpm); 85 DEFINE_DEVICE_IIFORMAT (x, xpm);
86 #endif 86 #endif
87 DEFINE_DEVICE_IIFORMAT (x, xbm); 87 DEFINE_DEVICE_IIFORMAT (x, xbm);
88 DEFINE_DEVICE_IIFORMAT (x, subwindow); 88 DEFINE_DEVICE_IIFORMAT (x, subwindow);
89 #ifdef HAVE_XFACE 89 #ifdef HAVE_XFACE
90 DEFINE_IMAGE_INSTANTIATOR_FORMAT (xface); 90 DEFINE_DEVICE_IIFORMAT (x, xface);
91 Lisp_Object Qxface;
92 #endif 91 #endif
93 92
94 DEFINE_IMAGE_INSTANTIATOR_FORMAT (cursor_font); 93 DEFINE_IMAGE_INSTANTIATOR_FORMAT (cursor_font);
95 Lisp_Object Qcursor_font; 94 Lisp_Object Qcursor_font;
96 95
1485 #ifdef HAVE_XFACE 1484 #ifdef HAVE_XFACE
1486 1485
1487 /********************************************************************** 1486 /**********************************************************************
1488 * X-Face * 1487 * X-Face *
1489 **********************************************************************/ 1488 **********************************************************************/
1490
1491 static void
1492 xface_validate (Lisp_Object instantiator)
1493 {
1494 file_or_data_must_be_present (instantiator);
1495 }
1496
1497 static Lisp_Object
1498 xface_normalize (Lisp_Object inst, Lisp_Object console_type)
1499 {
1500 /* This function can call lisp */
1501 Lisp_Object file = Qnil, mask_file = Qnil;
1502 struct gcpro gcpro1, gcpro2, gcpro3;
1503 Lisp_Object alist = Qnil;
1504
1505 GCPRO3 (file, mask_file, alist);
1506
1507 /* Now, convert any file data into inline data for both the regular
1508 data and the mask data. At the end of this, `data' will contain
1509 the inline data (if any) or Qnil, and `file' will contain
1510 the name this data was derived from (if known) or Qnil.
1511 Likewise for `mask_file' and `mask_data'.
1512
1513 Note that if we cannot generate any regular inline data, we
1514 skip out. */
1515
1516 file = potential_pixmap_file_instantiator (inst, Q_file, Q_data,
1517 console_type);
1518 mask_file = potential_pixmap_file_instantiator (inst, Q_mask_file,
1519 Q_mask_data, console_type);
1520
1521 if (CONSP (file)) /* failure locating filename */
1522 signal_double_file_error ("Opening bitmap file",
1523 "no such file or directory",
1524 Fcar (file));
1525
1526 if (NILP (file) && NILP (mask_file)) /* no conversion necessary */
1527 RETURN_UNGCPRO (inst);
1528
1529 alist = tagged_vector_to_alist (inst);
1530
1531 {
1532 Lisp_Object data = make_string_from_file (file);
1533 alist = remassq_no_quit (Q_file, alist);
1534 /* there can't be a :data at this point. */
1535 alist = Fcons (Fcons (Q_file, file),
1536 Fcons (Fcons (Q_data, data), alist));
1537 }
1538
1539 alist = xbm_mask_file_munging (alist, file, mask_file, console_type);
1540
1541 {
1542 Lisp_Object result = alist_to_tagged_vector (Qxface, alist);
1543 free_alist (alist);
1544 RETURN_UNGCPRO (result);
1545 }
1546 }
1547
1548 static int
1549 xface_possible_dest_types (void)
1550 {
1551 return
1552 IMAGE_MONO_PIXMAP_MASK |
1553 IMAGE_COLOR_PIXMAP_MASK |
1554 IMAGE_POINTER_MASK;
1555 }
1556
1557 #if defined(EXTERN) 1489 #if defined(EXTERN)
1558 /* This is about to get redefined! */ 1490 /* This is about to get redefined! */
1559 #undef EXTERN 1491 #undef EXTERN
1560 #endif 1492 #endif
1561 /* We have to define SYSV32 so that compface.h includes string.h 1493 /* We have to define SYSV32 so that compface.h includes string.h
1573 definition in compface.h */ 1505 definition in compface.h */
1574 extern jmp_buf comp_env; 1506 extern jmp_buf comp_env;
1575 #undef SYSV32 1507 #undef SYSV32
1576 1508
1577 static void 1509 static void
1578 xface_instantiate (Lisp_Object image_instance, Lisp_Object instantiator, 1510 x_xface_instantiate (Lisp_Object image_instance, Lisp_Object instantiator,
1579 Lisp_Object pointer_fg, Lisp_Object pointer_bg, 1511 Lisp_Object pointer_fg, Lisp_Object pointer_bg,
1580 int dest_mask, Lisp_Object domain) 1512 int dest_mask, Lisp_Object domain)
1581 { 1513 {
1582 Lisp_Object data = find_keyword_in_vector (instantiator, Q_data); 1514 Lisp_Object data = find_keyword_in_vector (instantiator, Q_data);
1583 int i, stattis; 1515 int i, stattis;
1584 char *p, *bits, *bp; 1516 char *p, *bits, *bp;
1585 CONST char * volatile emsg = 0; 1517 CONST char * volatile emsg = 0;
2198 IIFORMAT_VALID_KEYWORD (font, Q_data, check_valid_string); 2130 IIFORMAT_VALID_KEYWORD (font, Q_data, check_valid_string);
2199 IIFORMAT_VALID_KEYWORD (font, Q_foreground, check_valid_string); 2131 IIFORMAT_VALID_KEYWORD (font, Q_foreground, check_valid_string);
2200 IIFORMAT_VALID_KEYWORD (font, Q_background, check_valid_string); 2132 IIFORMAT_VALID_KEYWORD (font, Q_background, check_valid_string);
2201 2133
2202 #ifdef HAVE_XFACE 2134 #ifdef HAVE_XFACE
2203 INITIALIZE_IMAGE_INSTANTIATOR_FORMAT (xface, "xface"); 2135 INITIALIZE_DEVICE_IIFORMAT (x, xface);
2204 2136 IIFORMAT_HAS_DEVMETHOD (x, xface, instantiate);
2205 IIFORMAT_HAS_METHOD (xface, validate);
2206 IIFORMAT_HAS_METHOD (xface, normalize);
2207 IIFORMAT_HAS_METHOD (xface, possible_dest_types);
2208 IIFORMAT_HAS_METHOD (xface, instantiate);
2209
2210 IIFORMAT_VALID_KEYWORD (xface, Q_data, check_valid_string);
2211 IIFORMAT_VALID_KEYWORD (xface, Q_file, check_valid_string);
2212 IIFORMAT_VALID_KEYWORD (xface, Q_hotspot_x, check_valid_int);
2213 IIFORMAT_VALID_KEYWORD (xface, Q_hotspot_y, check_valid_int);
2214 IIFORMAT_VALID_KEYWORD (xface, Q_foreground, check_valid_string);
2215 IIFORMAT_VALID_KEYWORD (xface, Q_background, check_valid_string);
2216 #endif 2137 #endif
2217 2138
2218 INITIALIZE_IMAGE_INSTANTIATOR_FORMAT (autodetect, 2139 INITIALIZE_IMAGE_INSTANTIATOR_FORMAT (autodetect,
2219 "autodetect"); 2140 "autodetect");
2220 2141
2227 } 2148 }
2228 2149
2229 void 2150 void
2230 vars_of_glyphs_x (void) 2151 vars_of_glyphs_x (void)
2231 { 2152 {
2232 #ifdef HAVE_XFACE
2233 Fprovide (Qxface);
2234 #endif
2235
2236 DEFVAR_LISP ("x-bitmap-file-path", &Vx_bitmap_file_path /* 2153 DEFVAR_LISP ("x-bitmap-file-path", &Vx_bitmap_file_path /*
2237 A list of the directories in which X bitmap files may be found. 2154 A list of the directories in which X bitmap files may be found.
2238 If nil, this is initialized from the "*bitmapFilePath" resource. 2155 If nil, this is initialized from the "*bitmapFilePath" resource.
2239 This is used by the `make-image-instance' function (however, note that if 2156 This is used by the `make-image-instance' function (however, note that if
2240 the environment variable XBMLANGPATH is set, it is consulted first). 2157 the environment variable XBMLANGPATH is set, it is consulted first).