comparison src/glyphs.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 74fd4e045ea6
comparison
equal deleted inserted replaced
387:f892a9d0bb8d 388:aabb7f5b1c81
86 #define BitmapSuccess 0 86 #define BitmapSuccess 0
87 #define BitmapOpenFailed 1 87 #define BitmapOpenFailed 1
88 #define BitmapFileInvalid 2 88 #define BitmapFileInvalid 2
89 #define BitmapNoMemory 3 89 #define BitmapNoMemory 3
90 #endif 90 #endif
91 #endif
92
93 #ifdef HAVE_XFACE
94 DEFINE_IMAGE_INSTANTIATOR_FORMAT (xface);
95 Lisp_Object Qxface;
91 #endif 96 #endif
92 97
93 #ifdef HAVE_XPM 98 #ifdef HAVE_XPM
94 DEFINE_IMAGE_INSTANTIATOR_FORMAT (xpm); 99 DEFINE_IMAGE_INSTANTIATOR_FORMAT (xpm);
95 Lisp_Object Qxpm; 100 Lisp_Object Qxpm;
1999 } 2004 }
2000 2005
2001 #endif 2006 #endif
2002 2007
2003 2008
2009 #ifdef HAVE_XFACE
2010 /**********************************************************************
2011 * X-Face *
2012 **********************************************************************/
2013
2014 static void
2015 xface_validate (Lisp_Object instantiator)
2016 {
2017 file_or_data_must_be_present (instantiator);
2018 }
2019
2020 static Lisp_Object
2021 xface_normalize (Lisp_Object inst, Lisp_Object console_type)
2022 {
2023 /* This function can call lisp */
2024 Lisp_Object file = Qnil, mask_file = Qnil;
2025 struct gcpro gcpro1, gcpro2, gcpro3;
2026 Lisp_Object alist = Qnil;
2027
2028 GCPRO3 (file, mask_file, alist);
2029
2030 /* Now, convert any file data into inline data for both the regular
2031 data and the mask data. At the end of this, `data' will contain
2032 the inline data (if any) or Qnil, and `file' will contain
2033 the name this data was derived from (if known) or Qnil.
2034 Likewise for `mask_file' and `mask_data'.
2035
2036 Note that if we cannot generate any regular inline data, we
2037 skip out. */
2038
2039 file = potential_pixmap_file_instantiator (inst, Q_file, Q_data,
2040 console_type);
2041 mask_file = potential_pixmap_file_instantiator (inst, Q_mask_file,
2042 Q_mask_data, console_type);
2043
2044 if (CONSP (file)) /* failure locating filename */
2045 signal_double_file_error ("Opening bitmap file",
2046 "no such file or directory",
2047 Fcar (file));
2048
2049 if (NILP (file) && NILP (mask_file)) /* no conversion necessary */
2050 RETURN_UNGCPRO (inst);
2051
2052 alist = tagged_vector_to_alist (inst);
2053
2054 {
2055 Lisp_Object data = make_string_from_file (file);
2056 alist = remassq_no_quit (Q_file, alist);
2057 /* there can't be a :data at this point. */
2058 alist = Fcons (Fcons (Q_file, file),
2059 Fcons (Fcons (Q_data, data), alist));
2060 }
2061
2062 alist = xbm_mask_file_munging (alist, file, mask_file, console_type);
2063
2064 {
2065 Lisp_Object result = alist_to_tagged_vector (Qxface, alist);
2066 free_alist (alist);
2067 RETURN_UNGCPRO (result);
2068 }
2069 }
2070
2071 static int
2072 xface_possible_dest_types (void)
2073 {
2074 return
2075 IMAGE_MONO_PIXMAP_MASK |
2076 IMAGE_COLOR_PIXMAP_MASK |
2077 IMAGE_POINTER_MASK;
2078 }
2079
2080 #endif /* HAVE_XFACE */
2081
2082
2004 #ifdef HAVE_XPM 2083 #ifdef HAVE_XPM
2005 2084
2006 /********************************************************************** 2085 /**********************************************************************
2007 * XPM * 2086 * XPM *
2008 **********************************************************************/ 2087 **********************************************************************/
3537 /* If we didn't find the glyph, add it and then return its index. */ 3616 /* If we didn't find the glyph, add it and then return its index. */
3538 add_subwindow_cachel (f, subwindow); 3617 add_subwindow_cachel (f, subwindow);
3539 return elt; 3618 return elt;
3540 } 3619 }
3541 3620
3621 /* redisplay in general assumes that drawing something will erase
3622 what was there before. unfortunately this does not apply to
3623 subwindows that need to be specifically unmapped in order to
3624 disappear. we take a brute force approach - on the basis that its
3625 cheap - and unmap all subwindows in a display line */
3542 void 3626 void
3543 reset_subwindow_cachels (struct frame *f) 3627 reset_subwindow_cachels (struct frame *f)
3544 { 3628 {
3629 int elt;
3630 for (elt = 0; elt < Dynarr_length (f->subwindow_cachels); elt++)
3631 {
3632 struct subwindow_cachel *cachel =
3633 Dynarr_atp (f->subwindow_cachels, elt);
3634
3635 if (!NILP (cachel->subwindow) && cachel->being_displayed)
3636 {
3637 struct Lisp_Image_Instance* ii = XIMAGE_INSTANCE (cachel->subwindow);
3638 MAYBE_DEVMETH (XDEVICE (f->device), unmap_subwindow, (ii));
3639 }
3640 }
3545 Dynarr_reset (f->subwindow_cachels); 3641 Dynarr_reset (f->subwindow_cachels);
3546 } 3642 }
3547 3643
3548 void 3644 void
3549 mark_subwindow_cachels_as_not_updated (struct frame *f) 3645 mark_subwindow_cachels_as_not_updated (struct frame *f)
4030 IIFORMAT_VALID_KEYWORD (xbm, Q_hotspot_y, check_valid_int); 4126 IIFORMAT_VALID_KEYWORD (xbm, Q_hotspot_y, check_valid_int);
4031 IIFORMAT_VALID_KEYWORD (xbm, Q_foreground, check_valid_string); 4127 IIFORMAT_VALID_KEYWORD (xbm, Q_foreground, check_valid_string);
4032 IIFORMAT_VALID_KEYWORD (xbm, Q_background, check_valid_string); 4128 IIFORMAT_VALID_KEYWORD (xbm, Q_background, check_valid_string);
4033 #endif /* HAVE_WINDOW_SYSTEM */ 4129 #endif /* HAVE_WINDOW_SYSTEM */
4034 4130
4131 #ifdef HAVE_XFACE
4132 INITIALIZE_IMAGE_INSTANTIATOR_FORMAT (xface, "xface");
4133
4134 IIFORMAT_HAS_METHOD (xface, validate);
4135 IIFORMAT_HAS_METHOD (xface, normalize);
4136 IIFORMAT_HAS_METHOD (xface, possible_dest_types);
4137
4138 IIFORMAT_VALID_KEYWORD (xface, Q_data, check_valid_string);
4139 IIFORMAT_VALID_KEYWORD (xface, Q_file, check_valid_string);
4140 IIFORMAT_VALID_KEYWORD (xface, Q_hotspot_x, check_valid_int);
4141 IIFORMAT_VALID_KEYWORD (xface, Q_hotspot_y, check_valid_int);
4142 IIFORMAT_VALID_KEYWORD (xface, Q_foreground, check_valid_string);
4143 IIFORMAT_VALID_KEYWORD (xface, Q_background, check_valid_string);
4144 #endif
4145
4035 #ifdef HAVE_XPM 4146 #ifdef HAVE_XPM
4036 INITIALIZE_IMAGE_INSTANTIATOR_FORMAT (xpm, "xpm"); 4147 INITIALIZE_IMAGE_INSTANTIATOR_FORMAT (xpm, "xpm");
4037 4148
4038 IIFORMAT_HAS_METHOD (xpm, validate); 4149 IIFORMAT_HAS_METHOD (xpm, validate);
4039 IIFORMAT_HAS_METHOD (xpm, normalize); 4150 IIFORMAT_HAS_METHOD (xpm, normalize);
4108 The default value of this variable defines the logical color names 4219 The default value of this variable defines the logical color names
4109 \"foreground\" and \"background\" to be the colors of the `default' face. 4220 \"foreground\" and \"background\" to be the colors of the `default' face.
4110 */ ); 4221 */ );
4111 Vxpm_color_symbols = Qnil; /* initialized in x-faces.el */ 4222 Vxpm_color_symbols = Qnil; /* initialized in x-faces.el */
4112 #endif /* HAVE_XPM */ 4223 #endif /* HAVE_XPM */
4224 #ifdef HAVE_XFACE
4225 Fprovide (Qxface);
4226 #endif
4113 } 4227 }
4114 4228
4115 void 4229 void
4116 specifier_vars_of_glyphs (void) 4230 specifier_vars_of_glyphs (void)
4117 { 4231 {