Mercurial > hg > xemacs-beta
comparison src/glyphs.c @ 5118:e0db3c197671 ben-lisp-object
merge up to latest default branch, doesn't compile yet
author | Ben Wing <ben@xemacs.org> |
---|---|
date | Sat, 26 Dec 2009 21:18:49 -0600 |
parents | 3742ea8250b5 8f1ee2d15784 |
children | d1247f3cc363 |
comparison
equal
deleted
inserted
replaced
5117:3742ea8250b5 | 5118:e0db3c197671 |
---|---|
1 /* Generic glyph/image implementation + display tables | 1 /* Generic glyph/image implementation + display tables |
2 Copyright (C) 1994, 1995 Board of Trustees, University of Illinois. | 2 Copyright (C) 1994, 1995 Board of Trustees, University of Illinois |
3 Copyright (C) 1995 Tinker Systems | 3 Copyright (C) 1995 Tinker Systems |
4 Copyright (C) 1995, 1996, 2000, 2001, 2002, 2004, 2005 Ben Wing | 4 Copyright (C) 1995, 1996, 2000, 2001, 2002, 2004, 2005 Ben Wing |
5 Copyright (C) 1995 Sun Microsystems | 5 Copyright (C) 1995 Sun Microsystems |
6 Copyright (C) 1998, 1999, 2000 Andy Piper | 6 Copyright (C) 1998, 1999, 2000 Andy Piper |
7 Copyright (C) 2007 Didier Verna | |
7 | 8 |
8 This file is part of XEmacs. | 9 This file is part of XEmacs. |
9 | 10 |
10 XEmacs is free software; you can redistribute it and/or modify it | 11 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 under the terms of the GNU General Public License as published by the |
471 GCPRO1 (alist); | 472 GCPRO1 (alist); |
472 | 473 |
473 for (len -= 2; len >= 1; len -= 2) | 474 for (len -= 2; len >= 1; len -= 2) |
474 { | 475 { |
475 /* Keyword comparisons can be done with eq, the value must be | 476 /* Keyword comparisons can be done with eq, the value must be |
476 done with equal. | 477 done with equal. |
477 #### Note that this does not optimize re-ordering. */ | 478 #### Note that this does not optimize re-ordering. */ |
478 if (!EQ (elt[len], old_elt[len]) | 479 if (!EQ (elt[len], old_elt[len]) |
479 || !internal_equal (elt[len+1], old_elt[len+1], 0)) | 480 || !internal_equal (elt[len+1], old_elt[len+1], 0)) |
480 alist = Fcons (Fcons (elt[len], elt[len+1]), alist); | 481 alist = Fcons (Fcons (elt[len], elt[len+1]), alist); |
481 } | 482 } |
482 | 483 |
911 { XD_LISP_OBJECT, offsetof (Lisp_Image_Instance, domain) }, | 912 { XD_LISP_OBJECT, offsetof (Lisp_Image_Instance, domain) }, |
912 { XD_LISP_OBJECT, offsetof (Lisp_Image_Instance, device) }, | 913 { XD_LISP_OBJECT, offsetof (Lisp_Image_Instance, device) }, |
913 { XD_LISP_OBJECT, offsetof (Lisp_Image_Instance, name) }, | 914 { XD_LISP_OBJECT, offsetof (Lisp_Image_Instance, name) }, |
914 { XD_LISP_OBJECT, offsetof (Lisp_Image_Instance, parent) }, | 915 { XD_LISP_OBJECT, offsetof (Lisp_Image_Instance, parent) }, |
915 { XD_LISP_OBJECT, offsetof (Lisp_Image_Instance, instantiator) }, | 916 { XD_LISP_OBJECT, offsetof (Lisp_Image_Instance, instantiator) }, |
916 { XD_UNION, offsetof (struct Lisp_Image_Instance, u), | 917 { XD_UNION, offsetof (struct Lisp_Image_Instance, u), |
917 XD_INDIRECT (0, 0), { &image_instance_data_description } }, | 918 XD_INDIRECT (0, 0), { &image_instance_data_description } }, |
918 { XD_END } | 919 { XD_END } |
919 }; | 920 }; |
920 | 921 |
921 static Lisp_Object | 922 static Lisp_Object |
990 { | 991 { |
991 Lisp_Image_Instance *ii = XIMAGE_INSTANCE (obj); | 992 Lisp_Image_Instance *ii = XIMAGE_INSTANCE (obj); |
992 | 993 |
993 if (print_readably) | 994 if (print_readably) |
994 printing_unreadable_object ("#<image-instance 0x%x>", | 995 printing_unreadable_object ("#<image-instance 0x%x>", |
995 ii->header.uid); | 996 ii->header.uid); |
996 write_fmt_string_lisp (printcharfun, "#<image-instance (%s) ", 1, | 997 write_fmt_string_lisp (printcharfun, "#<image-instance (%s) ", 1, |
997 Fimage_instance_type (obj)); | 998 Fimage_instance_type (obj)); |
998 if (!NILP (ii->name)) | 999 if (!NILP (ii->name)) |
999 write_fmt_string_lisp (printcharfun, "%S ", 1, ii->name); | 1000 write_fmt_string_lisp (printcharfun, "%S ", 1, ii->name); |
1000 write_fmt_string_lisp (printcharfun, "on %s ", 1, ii->domain); | 1001 write_fmt_string_lisp (printcharfun, "on %s ", 1, ii->domain); |
1092 | 1093 |
1093 if (!FRAME_LIVE_P (f)) | 1094 if (!FRAME_LIVE_P (f)) |
1094 write_c_string (printcharfun, "dead"); | 1095 write_c_string (printcharfun, "dead"); |
1095 else | 1096 else |
1096 write_c_string (printcharfun, | 1097 write_c_string (printcharfun, |
1097 DEVICE_TYPE_NAME (XDEVICE (FRAME_DEVICE (f)))); | 1098 DEVICE_TYPE_NAME (XDEVICE (FRAME_DEVICE (f)))); |
1098 } | 1099 } |
1099 write_c_string (printcharfun, "-frame>"); | 1100 write_c_string (printcharfun, "-frame>"); |
1100 write_fmt_string (printcharfun, " 0x%p", | 1101 write_fmt_string (printcharfun, " 0x%p", |
1101 IMAGE_INSTANCE_SUBWINDOW_ID (ii)); | 1102 IMAGE_INSTANCE_SUBWINDOW_ID (ii)); |
1102 | 1103 |
1290 depth + 1)); | 1291 depth + 1)); |
1291 break; | 1292 break; |
1292 | 1293 |
1293 case IMAGE_WIDGET: | 1294 case IMAGE_WIDGET: |
1294 /* We need the hash to be equivalent to what should be | 1295 /* We need the hash to be equivalent to what should be |
1295 displayed. */ | 1296 displayed. */ |
1296 hash = HASH5 (hash, | 1297 hash = HASH5 (hash, |
1297 LISP_HASH (IMAGE_INSTANCE_WIDGET_TYPE (i)), | 1298 LISP_HASH (IMAGE_INSTANCE_WIDGET_TYPE (i)), |
1298 internal_hash (IMAGE_INSTANCE_WIDGET_PROPS (i), depth + 1), | 1299 internal_hash (IMAGE_INSTANCE_WIDGET_PROPS (i), depth + 1), |
1299 internal_hash (IMAGE_INSTANCE_WIDGET_ITEMS (i), depth + 1), | 1300 internal_hash (IMAGE_INSTANCE_WIDGET_ITEMS (i), depth + 1), |
1300 internal_hash (IMAGE_INSTANCE_LAYOUT_CHILDREN (i), | 1301 internal_hash (IMAGE_INSTANCE_LAYOUT_CHILDREN (i), |
1311 (XDEVICE (image_instance_device (obj)), | 1312 (XDEVICE (image_instance_device (obj)), |
1312 image_instance_hash, (i, depth), | 1313 image_instance_hash, (i, depth), |
1313 0)); | 1314 0)); |
1314 } | 1315 } |
1315 | 1316 |
1316 DEFINE_NONDUMPABLE_LISP_OBJECT ("image-instance", image_instance, | 1317 DEFINE_NODUMP_LISP_OBJECT ("image-instance", image_instance, |
1317 mark_image_instance, print_image_instance, | 1318 mark_image_instance, print_image_instance, |
1318 finalize_image_instance, image_instance_equal, | 1319 finalize_image_instance, image_instance_equal, |
1319 image_instance_hash, | 1320 image_instance_hash, |
1320 image_instance_description, | 1321 image_instance_description, |
1321 Lisp_Image_Instance); | 1322 Lisp_Image_Instance); |
2230 DOESNT_RETURN | 2231 DOESNT_RETURN |
2231 signal_double_image_error (const CIbyte *string1, const CIbyte *string2, | 2232 signal_double_image_error (const CIbyte *string1, const CIbyte *string2, |
2232 Lisp_Object data) | 2233 Lisp_Object data) |
2233 { | 2234 { |
2234 signal_error_1 (Qimage_conversion_error, | 2235 signal_error_1 (Qimage_conversion_error, |
2235 list3 (build_msg_string (string1), | 2236 list3 (build_msg_string (string1), |
2236 build_msg_string (string2), | 2237 build_msg_string (string2), |
2237 data)); | 2238 data)); |
2238 } | 2239 } |
2239 | 2240 |
2240 DOESNT_RETURN | 2241 DOESNT_RETURN |
2241 signal_double_image_error_2 (const CIbyte *string1, const CIbyte *string2, | 2242 signal_double_image_error_2 (const CIbyte *string1, const CIbyte *string2, |
2242 Lisp_Object data1, Lisp_Object data2) | 2243 Lisp_Object data1, Lisp_Object data2) |
2243 { | 2244 { |
2244 signal_error_1 (Qimage_conversion_error, | 2245 signal_error_1 (Qimage_conversion_error, |
2245 list4 (build_msg_string (string1), | 2246 list4 (build_msg_string (string1), |
2246 build_msg_string (string2), | 2247 build_msg_string (string2), |
2247 data1, data2)); | 2248 data1, data2)); |
2248 } | 2249 } |
2249 | 2250 |
2250 /**************************************************************************** | 2251 /**************************************************************************** |
2524 | 2525 |
2525 /************************************************************************/ | 2526 /************************************************************************/ |
2526 /* pixmap file functions */ | 2527 /* pixmap file functions */ |
2527 /************************************************************************/ | 2528 /************************************************************************/ |
2528 | 2529 |
2529 /* If INSTANTIATOR refers to inline data, return Qnil. | 2530 /* If INSTANTIATOR refers to inline data, return Qt. |
2530 If INSTANTIATOR refers to data in a file, return the full filename | 2531 If INSTANTIATOR refers to data in a file, return the full filename |
2531 if it exists; otherwise, return a cons of (filename). | 2532 if it exists, Qnil if there's no console method for locating the file, or |
2533 (filename) if there was an error locating the file. | |
2532 | 2534 |
2533 FILE_KEYWORD and DATA_KEYWORD are symbols specifying the | 2535 FILE_KEYWORD and DATA_KEYWORD are symbols specifying the |
2534 keywords used to look up the file and inline data, | 2536 keywords used to look up the file and inline data, |
2535 respectively, in the instantiator. Normally these would | 2537 respectively, in the instantiator. Normally these would |
2536 be Q_file and Q_data, but might be different for mask data. */ | 2538 be Q_file and Q_data, but might be different for mask data. */ |
2549 data = find_keyword_in_vector (instantiator, data_keyword); | 2551 data = find_keyword_in_vector (instantiator, data_keyword); |
2550 file = find_keyword_in_vector (instantiator, file_keyword); | 2552 file = find_keyword_in_vector (instantiator, file_keyword); |
2551 | 2553 |
2552 if (!NILP (file) && NILP (data)) | 2554 if (!NILP (file) && NILP (data)) |
2553 { | 2555 { |
2554 Lisp_Object retval = MAYBE_LISP_CONTYPE_METH | 2556 struct console_methods *meths |
2555 (decode_console_type(console_type, ERROR_ME), | 2557 = decode_console_type(console_type, ERROR_ME); |
2556 locate_pixmap_file, (file)); | 2558 |
2557 | 2559 if (HAS_CONTYPE_METH_P (meths, locate_pixmap_file)) |
2558 if (!NILP (retval)) | 2560 { |
2559 return retval; | 2561 Lisp_Object retval |
2560 else | 2562 = CONTYPE_METH (meths, locate_pixmap_file, (file)); |
2561 return Fcons (file, Qnil); /* should have been file */ | 2563 |
2562 } | 2564 if (!NILP (retval)) |
2563 | 2565 return retval; |
2564 return Qnil; | 2566 else |
2567 return Fcons (file, Qnil); /* should have been file */ | |
2568 } | |
2569 else /* method unavailable */ | |
2570 return Qnil; | |
2571 } | |
2572 | |
2573 return Qt; | |
2565 } | 2574 } |
2566 | 2575 |
2567 Lisp_Object | 2576 Lisp_Object |
2568 simple_image_type_normalize (Lisp_Object inst, Lisp_Object console_type, | 2577 simple_image_type_normalize (Lisp_Object inst, Lisp_Object console_type, |
2569 Lisp_Object image_type_tag) | 2578 Lisp_Object image_type_tag) |
2584 skip out. */ | 2593 skip out. */ |
2585 | 2594 |
2586 file = potential_pixmap_file_instantiator (inst, Q_file, Q_data, | 2595 file = potential_pixmap_file_instantiator (inst, Q_file, Q_data, |
2587 console_type); | 2596 console_type); |
2588 | 2597 |
2598 if (NILP (file)) /* normalization impossible for the console type */ | |
2599 RETURN_UNGCPRO (Qnil); | |
2600 | |
2589 if (CONSP (file)) /* failure locating filename */ | 2601 if (CONSP (file)) /* failure locating filename */ |
2590 signal_double_image_error ("Opening pixmap file", | 2602 signal_double_image_error ("Opening pixmap file", |
2591 "no such file or directory", | 2603 "no such file or directory", |
2592 Fcar (file)); | 2604 Fcar (file)); |
2593 | 2605 |
2594 if (NILP (file)) /* no conversion necessary */ | 2606 if (EQ (file, Qt)) /* no conversion necessary */ |
2595 RETURN_UNGCPRO (inst); | 2607 RETURN_UNGCPRO (inst); |
2596 | 2608 |
2597 alist = tagged_vector_to_alist (inst); | 2609 alist = tagged_vector_to_alist (inst); |
2598 | 2610 |
2599 { | 2611 { |
2735 Lisp_Object mask_file, Lisp_Object console_type) | 2747 Lisp_Object mask_file, Lisp_Object console_type) |
2736 { | 2748 { |
2737 /* This is unclean but it's fairly standard -- a number of the | 2749 /* This is unclean but it's fairly standard -- a number of the |
2738 bitmaps in /usr/include/X11/bitmaps use it -- so we support | 2750 bitmaps in /usr/include/X11/bitmaps use it -- so we support |
2739 it. */ | 2751 it. */ |
2740 if (NILP (mask_file) | 2752 if (EQ (mask_file, Qt) |
2741 /* don't override explicitly specified mask data. */ | 2753 /* don't override explicitly specified mask data. */ |
2742 && NILP (assq_no_quit (Q_mask_data, alist)) | 2754 && NILP (assq_no_quit (Q_mask_data, alist)) |
2743 && !NILP (file)) | 2755 && !EQ (file, Qt)) |
2744 { | 2756 { |
2745 mask_file = MAYBE_LISP_CONTYPE_METH | 2757 mask_file = MAYBE_LISP_CONTYPE_METH |
2746 (decode_console_type(console_type, ERROR_ME), | 2758 (decode_console_type(console_type, ERROR_ME), |
2747 locate_pixmap_file, (concat2 (file, build_string ("Mask")))); | 2759 locate_pixmap_file, (concat2 (file, build_string ("Mask")))); |
2748 if (NILP (mask_file)) | 2760 if (NILP (mask_file)) |
2788 file = potential_pixmap_file_instantiator (inst, Q_file, Q_data, | 2800 file = potential_pixmap_file_instantiator (inst, Q_file, Q_data, |
2789 console_type); | 2801 console_type); |
2790 mask_file = potential_pixmap_file_instantiator (inst, Q_mask_file, | 2802 mask_file = potential_pixmap_file_instantiator (inst, Q_mask_file, |
2791 Q_mask_data, console_type); | 2803 Q_mask_data, console_type); |
2792 | 2804 |
2805 if (NILP (file)) /* normalization impossible for the console type */ | |
2806 RETURN_UNGCPRO (Qnil); | |
2807 | |
2793 if (CONSP (file)) /* failure locating filename */ | 2808 if (CONSP (file)) /* failure locating filename */ |
2794 signal_double_image_error ("Opening bitmap file", | 2809 signal_double_image_error ("Opening bitmap file", |
2795 "no such file or directory", | 2810 "no such file or directory", |
2796 Fcar (file)); | 2811 Fcar (file)); |
2797 | 2812 |
2798 if (NILP (file) && NILP (mask_file)) /* no conversion necessary */ | 2813 if (EQ (file, Qt) && EQ (mask_file, Qt)) /* no conversion necessary */ |
2799 RETURN_UNGCPRO (inst); | 2814 RETURN_UNGCPRO (inst); |
2800 | 2815 |
2801 alist = tagged_vector_to_alist (inst); | 2816 alist = tagged_vector_to_alist (inst); |
2802 | 2817 |
2803 if (!NILP (file)) | 2818 if (!EQ (file, Qt)) |
2804 { | 2819 { |
2805 int xhot, yhot; | 2820 int xhot, yhot; |
2806 Lisp_Object data = bitmap_to_lisp_data (file, &xhot, &yhot, 0); | 2821 Lisp_Object data = bitmap_to_lisp_data (file, &xhot, &yhot, 0); |
2807 alist = remassq_no_quit (Q_file, alist); | 2822 alist = remassq_no_quit (Q_file, alist); |
2808 /* there can't be a :data at this point. */ | 2823 /* there can't be a :data at this point. */ |
2873 file = potential_pixmap_file_instantiator (inst, Q_file, Q_data, | 2888 file = potential_pixmap_file_instantiator (inst, Q_file, Q_data, |
2874 console_type); | 2889 console_type); |
2875 mask_file = potential_pixmap_file_instantiator (inst, Q_mask_file, | 2890 mask_file = potential_pixmap_file_instantiator (inst, Q_mask_file, |
2876 Q_mask_data, console_type); | 2891 Q_mask_data, console_type); |
2877 | 2892 |
2893 if (NILP (file)) /* normalization impossible for the console type */ | |
2894 RETURN_UNGCPRO (Qnil); | |
2895 | |
2878 if (CONSP (file)) /* failure locating filename */ | 2896 if (CONSP (file)) /* failure locating filename */ |
2879 signal_double_image_error ("Opening bitmap file", | 2897 signal_double_image_error ("Opening bitmap file", |
2880 "no such file or directory", | 2898 "no such file or directory", |
2881 Fcar (file)); | 2899 Fcar (file)); |
2882 | 2900 |
2883 if (NILP (file) && NILP (mask_file)) /* no conversion necessary */ | 2901 if (EQ (file, Qt) && EQ (mask_file, Qt)) /* no conversion necessary */ |
2884 RETURN_UNGCPRO (inst); | 2902 RETURN_UNGCPRO (inst); |
2885 | 2903 |
2886 alist = tagged_vector_to_alist (inst); | 2904 alist = tagged_vector_to_alist (inst); |
2887 | 2905 |
2888 { | 2906 { |
2907 /* #### FIXME: what if EQ (file, Qt) && !EQ (mask, Qt) ? Is that possible? | |
2908 If so, we have a problem... -- dvl */ | |
2889 Lisp_Object data = make_string_from_file (file); | 2909 Lisp_Object data = make_string_from_file (file); |
2890 alist = remassq_no_quit (Q_file, alist); | 2910 alist = remassq_no_quit (Q_file, alist); |
2891 /* there can't be a :data at this point. */ | 2911 /* there can't be a :data at this point. */ |
2892 alist = Fcons (Fcons (Q_file, file), | 2912 alist = Fcons (Fcons (Q_file, file), |
2893 Fcons (Fcons (Q_data, data), alist)); | 2913 Fcons (Fcons (Q_data, data), alist)); |
3054 name = XCAR (cons); | 3074 name = XCAR (cons); |
3055 CHECK_STRING (name); | 3075 CHECK_STRING (name); |
3056 value = XCDR (cons); | 3076 value = XCDR (cons); |
3057 CHECK_CONS (value); | 3077 CHECK_CONS (value); |
3058 value = XCAR (value); | 3078 value = XCAR (value); |
3059 value = Feval (value); | 3079 value = IGNORE_MULTIPLE_VALUES (Feval (value)); |
3060 if (NILP (value)) | 3080 if (NILP (value)) |
3061 continue; | 3081 continue; |
3062 if (!STRINGP (value) && !COLOR_SPECIFIERP (value)) | 3082 if (!STRINGP (value) && !COLOR_SPECIFIERP (value)) |
3063 invalid_argument | 3083 invalid_argument |
3064 ("Result from xpm-color-symbols eval must be nil, string, or color", | 3084 ("Result from xpm-color-symbols eval must be nil, string, or color", |
3089 skip out. */ | 3109 skip out. */ |
3090 | 3110 |
3091 file = potential_pixmap_file_instantiator (inst, Q_file, Q_data, | 3111 file = potential_pixmap_file_instantiator (inst, Q_file, Q_data, |
3092 console_type); | 3112 console_type); |
3093 | 3113 |
3114 if (NILP (file)) /* normalization impossible for the console type */ | |
3115 RETURN_UNGCPRO (Qnil); | |
3116 | |
3094 if (CONSP (file)) /* failure locating filename */ | 3117 if (CONSP (file)) /* failure locating filename */ |
3095 signal_double_image_error ("Opening pixmap file", | 3118 signal_double_image_error ("Opening pixmap file", |
3096 "no such file or directory", | 3119 "no such file or directory", |
3097 Fcar (file)); | 3120 Fcar (file)); |
3098 | 3121 |
3099 color_symbols = find_keyword_in_vector_or_given (inst, Q_color_symbols, | 3122 color_symbols = find_keyword_in_vector_or_given (inst, Q_color_symbols, |
3100 Qunbound); | 3123 Qunbound); |
3101 | 3124 |
3102 if (NILP (file) && !UNBOUNDP (color_symbols)) | 3125 if (EQ (file, Qt) && !UNBOUNDP (color_symbols)) |
3103 /* no conversion necessary */ | 3126 /* no conversion necessary */ |
3104 RETURN_UNGCPRO (inst); | 3127 RETURN_UNGCPRO (inst); |
3105 | 3128 |
3106 alist = tagged_vector_to_alist (inst); | 3129 alist = tagged_vector_to_alist (inst); |
3107 | 3130 |
3108 if (!NILP (file)) | 3131 if (!NILP (file) && !EQ (file, Qt)) |
3109 { | 3132 { |
3110 Lisp_Object data = pixmap_to_lisp_data (file, 0); | 3133 Lisp_Object data = pixmap_to_lisp_data (file, 0); |
3111 alist = remassq_no_quit (Q_file, alist); | 3134 alist = remassq_no_quit (Q_file, alist); |
3112 /* there can't be a :data at this point. */ | 3135 /* there can't be a :data at this point. */ |
3113 alist = Fcons (Fcons (Q_file, file), | 3136 alist = Fcons (Fcons (Q_file, file), |
3231 displayed in the given domain. */ | 3254 displayed in the given domain. */ |
3232 | 3255 |
3233 static Lisp_Object | 3256 static Lisp_Object |
3234 image_instantiate (Lisp_Object specifier, Lisp_Object UNUSED (matchspec), | 3257 image_instantiate (Lisp_Object specifier, Lisp_Object UNUSED (matchspec), |
3235 Lisp_Object domain, Lisp_Object instantiator, | 3258 Lisp_Object domain, Lisp_Object instantiator, |
3236 Lisp_Object depth) | 3259 Lisp_Object depth, int no_fallback) |
3237 { | 3260 { |
3238 Lisp_Object glyph = IMAGE_SPECIFIER_ATTACHEE (XIMAGE_SPECIFIER (specifier)); | 3261 Lisp_Object glyph = IMAGE_SPECIFIER_ATTACHEE (XIMAGE_SPECIFIER (specifier)); |
3239 int dest_mask = XIMAGE_SPECIFIER_ALLOWED (specifier); | 3262 int dest_mask = XIMAGE_SPECIFIER_ALLOWED (specifier); |
3240 int pointerp = dest_mask & image_instance_type_to_mask (IMAGE_POINTER); | 3263 int pointerp = dest_mask & image_instance_type_to_mask (IMAGE_POINTER); |
3241 | 3264 |
3270 && EQ (INSTANTIATOR_TYPE (instantiator), Qinherit)) | 3293 && EQ (INSTANTIATOR_TYPE (instantiator), Qinherit)) |
3271 { | 3294 { |
3272 assert (XVECTOR_LENGTH (instantiator) == 3); | 3295 assert (XVECTOR_LENGTH (instantiator) == 3); |
3273 return (FACE_PROPERTY_INSTANCE | 3296 return (FACE_PROPERTY_INSTANCE |
3274 (Fget_face (XVECTOR_DATA (instantiator)[2]), | 3297 (Fget_face (XVECTOR_DATA (instantiator)[2]), |
3275 Qbackground_pixmap, domain, 1, depth)); | 3298 Qbackground_pixmap, domain, no_fallback, depth)); |
3276 } | 3299 } |
3277 else | 3300 else |
3278 { | 3301 { |
3279 Lisp_Object instance = Qnil; | 3302 Lisp_Object instance = Qnil; |
3280 Lisp_Object subtable = Qnil; | 3303 Lisp_Object subtable = Qnil; |
3354 } | 3377 } |
3355 else | 3378 else |
3356 ABORT (); /* We're not allowed anything else currently. */ | 3379 ABORT (); /* We're not allowed anything else currently. */ |
3357 | 3380 |
3358 /* If we don't have an instance at this point then create | 3381 /* If we don't have an instance at this point then create |
3359 one. */ | 3382 one. */ |
3360 if (UNBOUNDP (instance)) | 3383 if (UNBOUNDP (instance)) |
3361 { | 3384 { |
3362 Lisp_Object locative = | 3385 Lisp_Object locative = |
3363 noseeum_cons (Qnil, | 3386 noseeum_cons (Qnil, |
3364 noseeum_cons (hash_key, | 3387 noseeum_cons (hash_key, |
3401 #endif | 3424 #endif |
3402 } | 3425 } |
3403 else if (NILP (instance)) | 3426 else if (NILP (instance)) |
3404 gui_error ("Can't instantiate image (probably cached)", instantiator); | 3427 gui_error ("Can't instantiate image (probably cached)", instantiator); |
3405 /* We found an instance. However, because we are using the glyph | 3428 /* We found an instance. However, because we are using the glyph |
3406 as the hash key instead of the instantiator, the current | 3429 as the hash key instead of the instantiator, the current |
3407 instantiator may not be the same as the original. Thus we | 3430 instantiator may not be the same as the original. Thus we |
3408 must update the instance based on the new | 3431 must update the instance based on the new |
3409 instantiator. Preserving instance identity like this is | 3432 instantiator. Preserving instance identity like this is |
3410 important to stop excessive window system widget creation and | 3433 important to stop excessive window system widget creation and |
3411 deletion - and hence flashing. */ | 3434 deletion - and hence flashing. */ |
3412 else | 3435 else |
3413 { | 3436 { |
3414 /* #### This function should be able to cope with *all* | 3437 /* #### This function should be able to cope with *all* |
3415 changes to the instantiator, but currently only copes | 3438 changes to the instantiator, but currently only copes |
3416 with the most used properties. This means that it is | 3439 with the most used properties. This means that it is |
3785 { XD_LISP_OBJECT, offsetof (Lisp_Glyph, face) }, | 3808 { XD_LISP_OBJECT, offsetof (Lisp_Glyph, face) }, |
3786 { XD_LISP_OBJECT, offsetof (Lisp_Glyph, plist) }, | 3809 { XD_LISP_OBJECT, offsetof (Lisp_Glyph, plist) }, |
3787 { XD_END } | 3810 { XD_END } |
3788 }; | 3811 }; |
3789 | 3812 |
3790 DEFINE_LISP_OBJECT_WITH_PROPS ("glyph", glyph, | 3813 DEFINE_DUMPABLE_LISP_OBJECT_WITH_PROPS ("glyph", glyph, |
3791 mark_glyph, print_glyph, 0, | 3814 mark_glyph, print_glyph, 0, |
3792 glyph_equal, glyph_hash, | 3815 glyph_equal, glyph_hash, |
3793 glyph_description, | 3816 glyph_description, |
3794 glyph_getprop, glyph_putprop, | 3817 glyph_getprop, glyph_putprop, |
3795 glyph_remprop, glyph_plist, | 3818 glyph_remprop, glyph_plist, |
4254 image_instance_layout (instance, width, height, xoffset, yoffset, domain); | 4277 image_instance_layout (instance, width, height, xoffset, yoffset, domain); |
4255 } | 4278 } |
4256 | 4279 |
4257 | 4280 |
4258 /***************************************************************************** | 4281 /***************************************************************************** |
4259 * glyph cachel functions * | 4282 * glyph cachel functions * |
4260 *****************************************************************************/ | 4283 *****************************************************************************/ |
4261 | 4284 |
4262 /* #### All of this is 95% copied from face cachels. Consider | 4285 /* #### All of this is 95% copied from face cachels. Consider |
4263 consolidating. | 4286 consolidating. |
4264 | 4287 |
4427 #endif /* MEMORY_USAGE_STATS */ | 4450 #endif /* MEMORY_USAGE_STATS */ |
4428 | 4451 |
4429 | 4452 |
4430 | 4453 |
4431 /***************************************************************************** | 4454 /***************************************************************************** |
4432 * subwindow cachel functions * | 4455 * subwindow cachel functions * |
4433 *****************************************************************************/ | 4456 *****************************************************************************/ |
4434 /* Subwindows are curious in that you have to physically unmap them to | 4457 /* Subwindows are curious in that you have to physically unmap them to |
4435 not display them. It is problematic deciding what to do in | 4458 not display them. It is problematic deciding what to do in |
4436 redisplay. We have two caches - a per-window instance cache that | 4459 redisplay. We have two caches - a per-window instance cache that |
4437 keeps track of subwindows on a window, these are linked to their | 4460 keeps track of subwindows on a window, these are linked to their |
4533 the repainting necessary. Worse, we can get in an endless cycle of | 4556 the repainting necessary. Worse, we can get in an endless cycle of |
4534 redisplay if we are not careful. Thus we keep a per-frame list of | 4557 redisplay if we are not careful. Thus we keep a per-frame list of |
4535 expose events that are going to come and ignore them as | 4558 expose events that are going to come and ignore them as |
4536 required. */ | 4559 required. */ |
4537 | 4560 |
4561 #ifndef NEW_GC | |
4538 struct expose_ignore_blocktype | 4562 struct expose_ignore_blocktype |
4539 { | 4563 { |
4540 Blocktype_declare (struct expose_ignore); | 4564 Blocktype_declare (struct expose_ignore); |
4541 } *the_expose_ignore_blocktype; | 4565 } *the_expose_ignore_blocktype; |
4566 #endif /* not NEW_GC */ | |
4542 | 4567 |
4543 int | 4568 int |
4544 check_for_ignored_expose (struct frame* f, int x, int y, int width, int height) | 4569 check_for_ignored_expose (struct frame* f, int x, int y, int width, int height) |
4545 { | 4570 { |
4546 struct expose_ignore *ei, *prev; | 4571 struct expose_ignore *ei, *prev; |
4567 prev->next = ei->next; | 4592 prev->next = ei->next; |
4568 | 4593 |
4569 if (ei == f->subwindow_exposures_tail) | 4594 if (ei == f->subwindow_exposures_tail) |
4570 f->subwindow_exposures_tail = prev; | 4595 f->subwindow_exposures_tail = prev; |
4571 | 4596 |
4597 #ifndef NEW_GC | |
4572 Blocktype_free (the_expose_ignore_blocktype, ei); | 4598 Blocktype_free (the_expose_ignore_blocktype, ei); |
4599 #endif /* not NEW_GC */ | |
4573 return 1; | 4600 return 1; |
4574 } | 4601 } |
4575 prev = ei; | 4602 prev = ei; |
4576 } | 4603 } |
4577 return 0; | 4604 return 0; |
4582 { | 4609 { |
4583 if (!hold_ignored_expose_registration) | 4610 if (!hold_ignored_expose_registration) |
4584 { | 4611 { |
4585 struct expose_ignore *ei; | 4612 struct expose_ignore *ei; |
4586 | 4613 |
4614 #ifdef NEW_GC | |
4615 ei = alloc_lrecord_type (struct expose_ignore, &lrecord_expose_ignore); | |
4616 #else /* not NEW_GC */ | |
4587 ei = Blocktype_alloc (the_expose_ignore_blocktype); | 4617 ei = Blocktype_alloc (the_expose_ignore_blocktype); |
4618 #endif /* not NEW_GC */ | |
4588 | 4619 |
4589 ei->next = NULL; | 4620 ei->next = NULL; |
4590 ei->x = x; | 4621 ei->x = x; |
4591 ei->y = y; | 4622 ei->y = y; |
4592 ei->width = width; | 4623 ei->width = width; |
4787 | 4818 |
4788 /* make sure we don't get expose events */ | 4819 /* make sure we don't get expose events */ |
4789 register_ignored_expose (f, IMAGE_INSTANCE_DISPLAY_X (ii), | 4820 register_ignored_expose (f, IMAGE_INSTANCE_DISPLAY_X (ii), |
4790 IMAGE_INSTANCE_DISPLAY_Y (ii), | 4821 IMAGE_INSTANCE_DISPLAY_Y (ii), |
4791 IMAGE_INSTANCE_DISPLAY_WIDTH (ii), | 4822 IMAGE_INSTANCE_DISPLAY_WIDTH (ii), |
4792 IMAGE_INSTANCE_DISPLAY_HEIGHT (ii)); | 4823 IMAGE_INSTANCE_DISPLAY_HEIGHT (ii)); |
4793 IMAGE_INSTANCE_SUBWINDOW_DISPLAYEDP (ii) = 0; | 4824 IMAGE_INSTANCE_SUBWINDOW_DISPLAYEDP (ii) = 0; |
4794 | 4825 |
4795 MAYBE_DEVMETH (XDEVICE (IMAGE_INSTANCE_DEVICE (ii)), | 4826 MAYBE_DEVMETH (XDEVICE (IMAGE_INSTANCE_DEVICE (ii)), |
4796 unmap_subwindow, (ii)); | 4827 unmap_subwindow, (ii)); |
4797 } | 4828 } |
5063 && | 5094 && |
5064 !disable_animated_pixmaps) | 5095 !disable_animated_pixmaps) |
5065 { | 5096 { |
5066 /* Increment the index of the image slice we are currently | 5097 /* Increment the index of the image slice we are currently |
5067 viewing. */ | 5098 viewing. */ |
5068 IMAGE_INSTANCE_PIXMAP_SLICE (ii) = | 5099 IMAGE_INSTANCE_PIXMAP_SLICE (ii) = |
5069 (IMAGE_INSTANCE_PIXMAP_SLICE (ii) + 1) | 5100 (IMAGE_INSTANCE_PIXMAP_SLICE (ii) + 1) |
5070 % IMAGE_INSTANCE_PIXMAP_MAXSLICE (ii); | 5101 % IMAGE_INSTANCE_PIXMAP_MAXSLICE (ii); |
5071 /* We might need to kick redisplay at this point - but we | 5102 /* We might need to kick redisplay at this point - but we |
5072 also might not. */ | 5103 also might not. */ |
5073 MARK_DEVICE_FRAMES_GLYPHS_CHANGED | 5104 MARK_DEVICE_FRAMES_GLYPHS_CHANGED |
5423 } | 5454 } |
5424 | 5455 |
5425 void | 5456 void |
5426 reinit_vars_of_glyphs (void) | 5457 reinit_vars_of_glyphs (void) |
5427 { | 5458 { |
5459 #ifndef NEW_GC | |
5428 the_expose_ignore_blocktype = | 5460 the_expose_ignore_blocktype = |
5429 Blocktype_new (struct expose_ignore_blocktype); | 5461 Blocktype_new (struct expose_ignore_blocktype); |
5462 #endif /* not NEW_GC */ | |
5430 | 5463 |
5431 hold_ignored_expose_registration = 0; | 5464 hold_ignored_expose_registration = 0; |
5432 } | 5465 } |
5433 | 5466 |
5434 | 5467 |