Mercurial > hg > xemacs-beta
comparison src/glyphs-gtk.c @ 771:943eaba38521
[xemacs-hg @ 2002-03-13 08:51:24 by ben]
The big ben-mule-21-5 check-in!
Various files were added and deleted. See CHANGES-ben-mule.
There are still some test suite failures. No crashes, though.
Many of the failures have to do with problems in the test suite itself
rather than in the actual code. I'll be addressing these in the next
day or so -- none of the test suite failures are at all critical.
Meanwhile I'll be trying to address the biggest issues -- i.e. build
or run failures, which will almost certainly happen on various platforms.
All comments should be sent to ben@xemacs.org -- use a Cc: if necessary
when sending to mailing lists. There will be pre- and post- tags,
something like
pre-ben-mule-21-5-merge-in, and
post-ben-mule-21-5-merge-in.
author | ben |
---|---|
date | Wed, 13 Mar 2002 08:54:06 +0000 |
parents | 2e5e2ccbeed2 |
children | 2923009caf47 |
comparison
equal
deleted
inserted
replaced
770:336a418893b5 | 771:943eaba38521 |
---|---|
1 /* GTK-specific Lisp objects. | 1 /* GTK-specific Lisp objects. |
2 Copyright (C) 1993, 1994 Free Software Foundation, Inc. | 2 Copyright (C) 1993, 1994 Free Software Foundation, Inc. |
3 Copyright (C) 1995 Board of Trustees, University of Illinois. | 3 Copyright (C) 1995 Board of Trustees, University of Illinois. |
4 Copyright (C) 1995 Tinker Systems | 4 Copyright (C) 1995 Tinker Systems |
5 Copyright (C) 1995, 1996 Ben Wing | 5 Copyright (C) 1995, 1996, 2001 Ben Wing |
6 Copyright (C) 1995 Sun Microsystems | 6 Copyright (C) 1995 Sun Microsystems |
7 | 7 |
8 This file is part of XEmacs. | 8 This file is part of XEmacs. |
9 | 9 |
10 XEmacs is free software; you can redistribute it and/or modify it | 10 XEmacs is free software; you can redistribute it and/or modify it |
68 | 68 |
69 #include "sysfile.h" | 69 #include "sysfile.h" |
70 | 70 |
71 #include <setjmp.h> | 71 #include <setjmp.h> |
72 | 72 |
73 #ifdef FILE_CODING | |
74 #include "file-coding.h" | 73 #include "file-coding.h" |
75 #endif | |
76 | 74 |
77 #if INTBITS == 32 | 75 #if INTBITS == 32 |
78 # define FOUR_BYTE_TYPE unsigned int | 76 # define FOUR_BYTE_TYPE unsigned int |
79 #elif LONGBITS == 32 | 77 #elif LONGBITS == 32 |
80 # define FOUR_BYTE_TYPE unsigned long | 78 # define FOUR_BYTE_TYPE unsigned long |
156 Lisp_Object Qgtk_resource; | 154 Lisp_Object Qgtk_resource; |
157 #ifdef HAVE_WIDGETS | 155 #ifdef HAVE_WIDGETS |
158 Lisp_Object Qgtk_widget_instantiate_internal, Qgtk_widget_property_internal; | 156 Lisp_Object Qgtk_widget_instantiate_internal, Qgtk_widget_property_internal; |
159 Lisp_Object Qgtk_widget_redisplay_internal, Qgtk_widget_set_style; | 157 Lisp_Object Qgtk_widget_redisplay_internal, Qgtk_widget_set_style; |
160 #endif | 158 #endif |
161 | |
162 #define CONST const | |
163 | 159 |
164 | 160 |
165 /************************************************************************/ | 161 /************************************************************************/ |
166 /* image instance methods */ | 162 /* image instance methods */ |
167 /************************************************************************/ | 163 /************************************************************************/ |
884 corresponding X object. */ | 880 corresponding X object. */ |
885 | 881 |
886 static GdkPixmap * | 882 static GdkPixmap * |
887 pixmap_from_xbm_inline (Lisp_Object device, int width, int height, | 883 pixmap_from_xbm_inline (Lisp_Object device, int width, int height, |
888 /* Note that data is in ext-format! */ | 884 /* Note that data is in ext-format! */ |
889 CONST Extbyte *bits) | 885 const Extbyte *bits) |
890 { | 886 { |
891 return (gdk_bitmap_create_from_data (GET_GTK_WIDGET_WINDOW (DEVICE_GTK_APP_SHELL (XDEVICE (device))), | 887 return (gdk_bitmap_create_from_data (GET_GTK_WIDGET_WINDOW (DEVICE_GTK_APP_SHELL (XDEVICE (device))), |
892 (char *) bits, width, height)); | 888 (char *) bits, width, height)); |
893 } | 889 } |
894 | 890 |
897 | 893 |
898 static void | 894 static void |
899 init_image_instance_from_xbm_inline (struct Lisp_Image_Instance *ii, | 895 init_image_instance_from_xbm_inline (struct Lisp_Image_Instance *ii, |
900 int width, int height, | 896 int width, int height, |
901 /* Note that data is in ext-format! */ | 897 /* Note that data is in ext-format! */ |
902 CONST char *bits, | 898 const char *bits, |
903 Lisp_Object instantiator, | 899 Lisp_Object instantiator, |
904 Lisp_Object pointer_fg, | 900 Lisp_Object pointer_fg, |
905 Lisp_Object pointer_bg, | 901 Lisp_Object pointer_bg, |
906 int dest_mask, | 902 int dest_mask, |
907 GdkPixmap *mask, | 903 GdkPixmap *mask, |
1029 static void | 1025 static void |
1030 xbm_instantiate_1 (Lisp_Object image_instance, Lisp_Object instantiator, | 1026 xbm_instantiate_1 (Lisp_Object image_instance, Lisp_Object instantiator, |
1031 Lisp_Object pointer_fg, Lisp_Object pointer_bg, | 1027 Lisp_Object pointer_fg, Lisp_Object pointer_bg, |
1032 int dest_mask, int width, int height, | 1028 int dest_mask, int width, int height, |
1033 /* Note that data is in ext-format! */ | 1029 /* Note that data is in ext-format! */ |
1034 CONST char *bits) | 1030 const char *bits) |
1035 { | 1031 { |
1036 Lisp_Object mask_data = find_keyword_in_vector (instantiator, Q_mask_data); | 1032 Lisp_Object mask_data = find_keyword_in_vector (instantiator, Q_mask_data); |
1037 Lisp_Object mask_file = find_keyword_in_vector (instantiator, Q_mask_file); | 1033 Lisp_Object mask_file = find_keyword_in_vector (instantiator, Q_mask_file); |
1038 struct Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance); | 1034 struct Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance); |
1039 GdkPixmap *mask = 0; | 1035 GdkPixmap *mask = 0; |
1040 CONST char *gcc_may_you_rot_in_hell; | 1036 const char *gcc_may_you_rot_in_hell; |
1041 | 1037 |
1042 if (!NILP (mask_data)) | 1038 if (!NILP (mask_data)) |
1043 { | 1039 { |
1044 TO_EXTERNAL_FORMAT (LISP_STRING, XCAR (XCDR (XCDR (mask_data))), | 1040 TO_EXTERNAL_FORMAT (LISP_STRING, XCAR (XCDR (XCDR (mask_data))), |
1045 C_STRING_ALLOCA, gcc_may_you_rot_in_hell, | 1041 C_STRING_ALLOCA, gcc_may_you_rot_in_hell, |
1046 Qfile_name); | 1042 Qfile_name); |
1047 mask = | 1043 mask = |
1048 pixmap_from_xbm_inline (IMAGE_INSTANCE_DEVICE (ii), | 1044 pixmap_from_xbm_inline (IMAGE_INSTANCE_DEVICE (ii), |
1049 XINT (XCAR (mask_data)), | 1045 XINT (XCAR (mask_data)), |
1050 XINT (XCAR (XCDR (mask_data))), | 1046 XINT (XCAR (XCDR (mask_data))), |
1051 (CONST unsigned char *) | 1047 (const unsigned char *) |
1052 gcc_may_you_rot_in_hell); | 1048 gcc_may_you_rot_in_hell); |
1053 } | 1049 } |
1054 | 1050 |
1055 init_image_instance_from_xbm_inline (ii, width, height, bits, | 1051 init_image_instance_from_xbm_inline (ii, width, height, bits, |
1056 instantiator, pointer_fg, pointer_bg, | 1052 instantiator, pointer_fg, pointer_bg, |
1063 gtk_xbm_instantiate (Lisp_Object image_instance, Lisp_Object instantiator, | 1059 gtk_xbm_instantiate (Lisp_Object image_instance, Lisp_Object instantiator, |
1064 Lisp_Object pointer_fg, Lisp_Object pointer_bg, | 1060 Lisp_Object pointer_fg, Lisp_Object pointer_bg, |
1065 int dest_mask, Lisp_Object domain) | 1061 int dest_mask, Lisp_Object domain) |
1066 { | 1062 { |
1067 Lisp_Object data = find_keyword_in_vector (instantiator, Q_data); | 1063 Lisp_Object data = find_keyword_in_vector (instantiator, Q_data); |
1068 CONST char *gcc_go_home; | 1064 const char *gcc_go_home; |
1069 | 1065 |
1070 assert (!NILP (data)); | 1066 assert (!NILP (data)); |
1071 | 1067 |
1072 TO_EXTERNAL_FORMAT (LISP_STRING, XCAR (XCDR (XCDR (data))), | 1068 TO_EXTERNAL_FORMAT (LISP_STRING, XCAR (XCDR (XCDR (data))), |
1073 C_STRING_ALLOCA, gcc_go_home, | 1069 C_STRING_ALLOCA, gcc_go_home, |
1081 | 1077 |
1082 #ifdef HAVE_XPM | 1078 #ifdef HAVE_XPM |
1083 /********************************************************************** | 1079 /********************************************************************** |
1084 * XPM * | 1080 * XPM * |
1085 **********************************************************************/ | 1081 **********************************************************************/ |
1086 static void | 1082 static Lisp_Object |
1087 write_lisp_string_to_temp_file (Lisp_Object string, char *filename_out) | 1083 write_lisp_string_to_temp_file (Lisp_Object string) |
1088 { | 1084 { |
1089 Lisp_Object instream, outstream; | 1085 Lisp_Object instream, outstream; |
1090 Lstream *istr, *ostr; | 1086 Lstream *istr, *ostr; |
1091 char tempbuf[1024]; /* some random amount */ | 1087 Char_Binary tempbuf[1024]; /* some random amount */ |
1092 int fubar = 0; | 1088 int fubar = 0; |
1093 FILE *tmpfil; | 1089 FILE *tmpfil; |
1094 static Extbyte_dynarr *conversion_out_dynarr; | 1090 static Extbyte_dynarr *conversion_out_dynarr; |
1095 Bytecount bstart, bend; | 1091 Bytecount bstart, bend; |
1096 struct gcpro gcpro1, gcpro2; | 1092 Lisp_Object tempfile; |
1097 #ifdef FILE_CODING | 1093 struct gcpro gcpro1, gcpro2, grpro3; |
1098 Lisp_Object conv_out_stream; | 1094 Lisp_Object conv_out_stream; |
1099 Lstream *costr; | 1095 Lstream *costr; |
1100 struct gcpro gcpro3; | 1096 struct gcpro gcpro4; |
1101 #endif | |
1102 | 1097 |
1103 /* This function can GC */ | 1098 /* This function can GC */ |
1104 if (!conversion_out_dynarr) | 1099 if (!conversion_out_dynarr) |
1105 conversion_out_dynarr = Dynarr_new (Extbyte); | 1100 conversion_out_dynarr = Dynarr_new (Extbyte); |
1106 else | 1101 else |
1107 Dynarr_reset (conversion_out_dynarr); | 1102 Dynarr_reset (conversion_out_dynarr); |
1108 | 1103 |
1109 /* Create the temporary file ... */ | 1104 /* Create the temporary file ... */ |
1110 sprintf (filename_out, "/tmp/emacs%d.XXXXXX", (int) getpid ()); | 1105 tempfile = Fmake_temp_name (build_string ("/tmp/emacs")); |
1111 mktemp (filename_out); | 1106 tmpfil = qxe_fopen (XSTRING_DATA (tempfile), "w"); |
1112 tmpfil = fopen (filename_out, "w"); | |
1113 if (!tmpfil) | 1107 if (!tmpfil) |
1114 { | 1108 { |
1115 if (tmpfil) | 1109 if (tmpfil) |
1116 { | 1110 { |
1117 int old_errno = errno; | 1111 int old_errno = errno; |
1118 fclose (tmpfil); | 1112 retry_fclose (tmpfil); |
1119 unlink (filename_out); | 1113 qxe_unlink (XSTRING_DATA (tempfile)); |
1120 errno = old_errno; | 1114 errno = old_errno; |
1121 } | 1115 } |
1122 report_file_error ("Creating temp file", build_string (filename_out)); | 1116 report_file_error ("Creating temp file", tempfile); |
1123 } | 1117 } |
1124 | 1118 |
1125 CHECK_STRING (string); | 1119 CHECK_STRING (string); |
1126 get_string_range_byte (string, Qnil, Qnil, &bstart, &bend, | 1120 get_string_range_byte (string, Qnil, Qnil, &bstart, &bend, |
1127 GB_HISTORICAL_STRING_BEHAVIOR); | 1121 GB_HISTORICAL_STRING_BEHAVIOR); |
1128 instream = make_lisp_string_input_stream (string, bstart, bend); | 1122 instream = make_lisp_string_input_stream (string, bstart, bend); |
1129 istr = XLSTREAM (instream); | 1123 istr = XLSTREAM (instream); |
1130 /* setup the out stream */ | 1124 /* setup the out stream */ |
1131 outstream = make_dynarr_output_stream((unsigned_char_dynarr *)conversion_out_dynarr); | 1125 outstream = |
1126 make_dynarr_output_stream ((unsigned_char_dynarr *) conversion_out_dynarr); | |
1132 ostr = XLSTREAM (outstream); | 1127 ostr = XLSTREAM (outstream); |
1133 #ifdef FILE_CODING | |
1134 /* setup the conversion stream */ | 1128 /* setup the conversion stream */ |
1135 conv_out_stream = make_encoding_output_stream (ostr, Fget_coding_system(Qbinary)); | 1129 conv_out_stream = |
1130 make_coding_output_stream (ostr, Qbinary, CODING_ENCODE); | |
1136 costr = XLSTREAM (conv_out_stream); | 1131 costr = XLSTREAM (conv_out_stream); |
1137 GCPRO3 (instream, outstream, conv_out_stream); | 1132 GCPRO4 (tempfile, instream, outstream, conv_out_stream); |
1138 #else | |
1139 GCPRO2 (instream, outstream); | |
1140 #endif | |
1141 | 1133 |
1142 /* Get the data while doing the conversion */ | 1134 /* Get the data while doing the conversion */ |
1143 while (1) | 1135 while (1) |
1144 { | 1136 { |
1145 int size_in_bytes = Lstream_read (istr, tempbuf, sizeof (tempbuf)); | 1137 int size_in_bytes = Lstream_read (istr, tempbuf, sizeof (tempbuf)); |
1146 if (!size_in_bytes) | 1138 if (!size_in_bytes) |
1147 break; | 1139 break; |
1148 /* It does seem the flushes are necessary... */ | 1140 /* It does seem the flushes are necessary... */ |
1149 #ifdef FILE_CODING | |
1150 Lstream_write (costr, tempbuf, size_in_bytes); | 1141 Lstream_write (costr, tempbuf, size_in_bytes); |
1151 Lstream_flush (costr); | 1142 Lstream_flush (costr); |
1152 #else | |
1153 Lstream_write (ostr, tempbuf, size_in_bytes); | |
1154 #endif | |
1155 Lstream_flush (ostr); | 1143 Lstream_flush (ostr); |
1156 if (fwrite ((unsigned char *)Dynarr_atp(conversion_out_dynarr, 0), | 1144 if (retry_fwrite ((unsigned char *)Dynarr_atp(conversion_out_dynarr, 0), |
1157 Dynarr_length(conversion_out_dynarr), 1, tmpfil) != 1) | 1145 Dynarr_length(conversion_out_dynarr), 1, tmpfil) != 1) |
1158 { | 1146 { |
1159 fubar = 1; | 1147 fubar = 1; |
1160 break; | 1148 break; |
1161 } | 1149 } |
1162 /* reset the dynarr */ | 1150 /* reset the dynarr */ |
1163 Lstream_rewind(ostr); | 1151 Lstream_rewind(ostr); |
1164 } | 1152 } |
1165 | 1153 |
1166 if (fclose (tmpfil) != 0) | 1154 if (retry_fclose (tmpfil) != 0) |
1167 fubar = 1; | 1155 fubar = 1; |
1168 Lstream_close (istr); | 1156 Lstream_close (istr); |
1169 #ifdef FILE_CODING | |
1170 Lstream_close (costr); | 1157 Lstream_close (costr); |
1171 #endif | |
1172 Lstream_close (ostr); | 1158 Lstream_close (ostr); |
1173 | 1159 |
1174 UNGCPRO; | |
1175 Lstream_delete (istr); | 1160 Lstream_delete (istr); |
1176 Lstream_delete (ostr); | 1161 Lstream_delete (ostr); |
1177 #ifdef FILE_CODING | |
1178 Lstream_delete (costr); | 1162 Lstream_delete (costr); |
1179 #endif | |
1180 | 1163 |
1181 if (fubar) | 1164 if (fubar) |
1182 report_file_error ("Writing temp file", build_string (filename_out)); | 1165 report_file_error ("Writing temp file", tempfile); |
1166 | |
1167 UNGCPRO; | |
1168 return tempfile; | |
1183 } | 1169 } |
1184 | 1170 |
1185 struct color_symbol | 1171 struct color_symbol |
1186 { | 1172 { |
1187 char* name; | 1173 char* name; |
1255 gtk_xpm_instantiate (Lisp_Object image_instance, Lisp_Object instantiator, | 1241 gtk_xpm_instantiate (Lisp_Object image_instance, Lisp_Object instantiator, |
1256 Lisp_Object pointer_fg, Lisp_Object pointer_bg, | 1242 Lisp_Object pointer_fg, Lisp_Object pointer_bg, |
1257 int dest_mask, Lisp_Object domain) | 1243 int dest_mask, Lisp_Object domain) |
1258 { | 1244 { |
1259 /* This function can GC */ | 1245 /* This function can GC */ |
1260 char temp_file_name[1024]; | |
1261 struct Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance); | 1246 struct Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance); |
1262 Lisp_Object device = IMAGE_INSTANCE_DEVICE (ii); | 1247 Lisp_Object device = IMAGE_INSTANCE_DEVICE (ii); |
1263 Lisp_Object data = find_keyword_in_vector (instantiator, Q_data); | 1248 Lisp_Object data = find_keyword_in_vector (instantiator, Q_data); |
1264 GdkColormap *cmap; | 1249 GdkColormap *cmap; |
1265 int depth; | 1250 int depth; |
1273 Lisp_Object color_symbol_alist = find_keyword_in_vector (instantiator, | 1258 Lisp_Object color_symbol_alist = find_keyword_in_vector (instantiator, |
1274 Q_color_symbols); | 1259 Q_color_symbols); |
1275 enum image_instance_type type; | 1260 enum image_instance_type type; |
1276 int force_mono; | 1261 int force_mono; |
1277 unsigned int w, h; | 1262 unsigned int w, h; |
1263 Lisp_Object tempfile = Qnil; | |
1264 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; | |
1278 | 1265 |
1279 if (!DEVICE_GTK_P (XDEVICE (device))) | 1266 if (!DEVICE_GTK_P (XDEVICE (device))) |
1280 gui_error ("Not a Gtk device", device); | 1267 gui_error ("Not a Gtk device", device); |
1281 | 1268 |
1282 if (dest_mask & IMAGE_COLOR_PIXMAP_MASK) | 1269 if (dest_mask & IMAGE_COLOR_PIXMAP_MASK) |
1289 incompatible_image_types (instantiator, dest_mask, | 1276 incompatible_image_types (instantiator, dest_mask, |
1290 IMAGE_MONO_PIXMAP_MASK | IMAGE_COLOR_PIXMAP_MASK | 1277 IMAGE_MONO_PIXMAP_MASK | IMAGE_COLOR_PIXMAP_MASK |
1291 | IMAGE_POINTER_MASK); | 1278 | IMAGE_POINTER_MASK); |
1292 force_mono = (type != IMAGE_COLOR_PIXMAP); | 1279 force_mono = (type != IMAGE_COLOR_PIXMAP); |
1293 | 1280 |
1281 GCPRO4 (device, data, color_symbol_alist, tempfile); | |
1282 | |
1294 window = GET_GTK_WIDGET_WINDOW (DEVICE_GTK_APP_SHELL (XDEVICE (device))); | 1283 window = GET_GTK_WIDGET_WINDOW (DEVICE_GTK_APP_SHELL (XDEVICE (device))); |
1295 cmap = DEVICE_GTK_COLORMAP (XDEVICE (device)); | 1284 cmap = DEVICE_GTK_COLORMAP (XDEVICE (device)); |
1296 depth = DEVICE_GTK_DEPTH (XDEVICE (device)); | 1285 depth = DEVICE_GTK_DEPTH (XDEVICE (device)); |
1297 visual = DEVICE_GTK_VISUAL (XDEVICE (device)); | 1286 visual = DEVICE_GTK_VISUAL (XDEVICE (device)); |
1298 | 1287 |
1299 gtk_initialize_pixmap_image_instance (ii, 1, type); | 1288 gtk_initialize_pixmap_image_instance (ii, 1, type); |
1300 | 1289 |
1301 assert (!NILP (data)); | 1290 assert (!NILP (data)); |
1302 | 1291 |
1303 /* Need to get the transparent color here */ | 1292 /* Need to get the transparent color here */ |
1304 color_symbols = extract_xpm_color_names (device, domain, color_symbol_alist, &nsymbols); | 1293 color_symbols = extract_xpm_color_names (device, domain, color_symbol_alist, |
1294 &nsymbols); | |
1305 for (i = 0; i < nsymbols; i++) | 1295 for (i = 0; i < nsymbols; i++) |
1306 { | 1296 { |
1307 if (!strcasecmp ("BgColor", color_symbols[i].name) || | 1297 if (!qxestrcasecmp ("BgColor", color_symbols[i].name) || |
1308 !strcasecmp ("None", color_symbols[i].name)) | 1298 !qxestrcasecmp ("None", color_symbols[i].name)) |
1309 { | 1299 { |
1310 transparent_color = &color_symbols[i].color; | 1300 transparent_color = &color_symbols[i].color; |
1311 } | 1301 } |
1312 } | 1302 } |
1313 | 1303 |
1314 write_lisp_string_to_temp_file (data, temp_file_name); | 1304 tempfile = write_lisp_string_to_temp_file (data); |
1315 pixmap = gdk_pixmap_create_from_xpm (window, &mask, transparent_color, temp_file_name); | 1305 { |
1316 unlink (temp_file_name); | 1306 Extbyte *tempfileout; |
1307 | |
1308 LISP_STRING_TO_EXTERNAL (tempfile, tempfileout, Qfile_name); | |
1309 pixmap = gdk_pixmap_create_from_xpm (window, &mask, transparent_color, | |
1310 tempfileout); | |
1311 } | |
1312 qxe_unlink (XSTRING_DATA (tempfile)); | |
1317 | 1313 |
1318 if (color_symbols) xfree (color_symbols); | 1314 if (color_symbols) xfree (color_symbols); |
1319 | 1315 |
1320 if (!pixmap) | 1316 if (!pixmap) |
1321 { | |
1322 signal_image_error ("Error reading pixmap", data); | 1317 signal_image_error ("Error reading pixmap", data); |
1323 } | |
1324 | 1318 |
1325 gdk_window_get_geometry (pixmap, NULL, NULL, &w, &h, &depth); | 1319 gdk_window_get_geometry (pixmap, NULL, NULL, &w, &h, &depth); |
1326 | 1320 |
1327 IMAGE_INSTANCE_GTK_PIXMAP (ii) = pixmap; | 1321 IMAGE_INSTANCE_GTK_PIXMAP (ii) = pixmap; |
1328 IMAGE_INSTANCE_GTK_MASK (ii) = mask; | 1322 IMAGE_INSTANCE_GTK_MASK (ii) = mask; |
1338 { | 1332 { |
1339 case IMAGE_MONO_PIXMAP: | 1333 case IMAGE_MONO_PIXMAP: |
1340 break; | 1334 break; |
1341 | 1335 |
1342 case IMAGE_COLOR_PIXMAP: | 1336 case IMAGE_COLOR_PIXMAP: |
1343 { | 1337 IMAGE_INSTANCE_PIXMAP_DEPTH (ii) = depth; |
1344 IMAGE_INSTANCE_PIXMAP_DEPTH (ii) = depth; | |
1345 } | |
1346 break; | 1338 break; |
1347 | 1339 |
1348 case IMAGE_POINTER: | 1340 case IMAGE_POINTER: |
1349 { | 1341 { |
1350 GdkColor fg, bg; | 1342 GdkColor fg, bg; |
1371 { | 1363 { |
1372 generate_cursor_fg_bg (device, &pointer_fg, &pointer_bg, | 1364 generate_cursor_fg_bg (device, &pointer_fg, &pointer_bg, |
1373 &fg, &bg); | 1365 &fg, &bg); |
1374 IMAGE_INSTANCE_PIXMAP_FG (ii) = pointer_fg; | 1366 IMAGE_INSTANCE_PIXMAP_FG (ii) = pointer_fg; |
1375 IMAGE_INSTANCE_PIXMAP_BG (ii) = pointer_bg; | 1367 IMAGE_INSTANCE_PIXMAP_BG (ii) = pointer_bg; |
1376 IMAGE_INSTANCE_GTK_CURSOR (ii) = gdk_cursor_new_from_pixmap (pixmap, mask, &fg, &bg, xhot, yhot); | 1368 IMAGE_INSTANCE_GTK_CURSOR (ii) = |
1369 gdk_cursor_new_from_pixmap (pixmap, mask, &fg, &bg, xhot, yhot); | |
1377 } | 1370 } |
1378 } | 1371 } |
1379 | 1372 |
1380 break; | 1373 break; |
1381 | 1374 |
1382 default: | 1375 default: |
1383 abort (); | 1376 abort (); |
1384 } | 1377 } |
1378 | |
1379 UNGCPRO; | |
1385 } | 1380 } |
1386 #endif /* HAVE_XPM */ | 1381 #endif /* HAVE_XPM */ |
1387 | 1382 |
1388 | 1383 |
1389 #ifdef HAVE_XFACE | 1384 #ifdef HAVE_XFACE |
1417 int dest_mask, Lisp_Object domain) | 1412 int dest_mask, Lisp_Object domain) |
1418 { | 1413 { |
1419 Lisp_Object data = find_keyword_in_vector (instantiator, Q_data); | 1414 Lisp_Object data = find_keyword_in_vector (instantiator, Q_data); |
1420 int i, stattis; | 1415 int i, stattis; |
1421 char *p, *bits, *bp; | 1416 char *p, *bits, *bp; |
1422 CONST char * volatile emsg = 0; | 1417 const char * volatile emsg = 0; |
1423 CONST char * volatile dstring; | 1418 const char * volatile dstring; |
1424 | 1419 |
1425 assert (!NILP (data)); | 1420 assert (!NILP (data)); |
1426 | 1421 |
1427 LISP_STRING_TO_EXTERNAL (data, dstring, Qbinary); | 1422 LISP_STRING_TO_EXTERNAL (data, dstring, Qbinary); |
1428 | 1423 |
1719 GCPRO3 (data, alist, result); | 1714 GCPRO3 (data, alist, result); |
1720 | 1715 |
1721 alist = tagged_vector_to_alist (instantiator); | 1716 alist = tagged_vector_to_alist (instantiator); |
1722 if (dest_mask & IMAGE_POINTER_MASK) | 1717 if (dest_mask & IMAGE_POINTER_MASK) |
1723 { | 1718 { |
1724 CONST char *name_ext; | 1719 const char *name_ext; |
1725 | 1720 |
1726 TO_EXTERNAL_FORMAT (LISP_STRING, data, | 1721 TO_EXTERNAL_FORMAT (LISP_STRING, data, |
1727 C_STRING_ALLOCA, name_ext, | 1722 C_STRING_ALLOCA, name_ext, |
1728 Qfile_name); | 1723 Qfile_name); |
1729 | 1724 |
1774 Lisp_Object data = find_keyword_in_vector (instantiator, Q_data); | 1769 Lisp_Object data = find_keyword_in_vector (instantiator, Q_data); |
1775 struct Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance); | 1770 struct Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance); |
1776 Lisp_Object device = IMAGE_INSTANCE_DEVICE (ii); | 1771 Lisp_Object device = IMAGE_INSTANCE_DEVICE (ii); |
1777 GdkColor fg, bg; | 1772 GdkColor fg, bg; |
1778 GdkFont *source, *mask; | 1773 GdkFont *source, *mask; |
1779 char source_name[MAXPATHLEN], mask_name[MAXPATHLEN], dummy; | 1774 char source_name[PATH_MAX], mask_name[PATH_MAX], dummy; |
1780 int source_char, mask_char; | 1775 int source_char, mask_char; |
1781 int count; | 1776 int count; |
1782 Lisp_Object foreground, background; | 1777 Lisp_Object foreground, background; |
1783 | 1778 |
1784 if (!DEVICE_GTK_P (XDEVICE (device))) | 1779 if (!DEVICE_GTK_P (XDEVICE (device))) |
1823 else | 1818 else |
1824 { | 1819 { |
1825 mask = gdk_font_load (mask_name); | 1820 mask = gdk_font_load (mask_name); |
1826 if (!mask) | 1821 if (!mask) |
1827 /* continuable */ | 1822 /* continuable */ |
1828 Fsignal (Qgui_error, list3 (build_string ("couldn't load font"), | 1823 Fsignal (Qgui_error, list3 (build_msg_string ("couldn't load font"), |
1829 build_string (mask_name), data)); | 1824 build_string (mask_name), data)); |
1830 } | 1825 } |
1831 if (!mask) | 1826 if (!mask) |
1832 mask_char = 0; | 1827 mask_char = 0; |
1833 | 1828 |
1958 /* This function can GC */ | 1953 /* This function can GC */ |
1959 Lisp_Object data = find_keyword_in_vector (instantiator, Q_data); | 1954 Lisp_Object data = find_keyword_in_vector (instantiator, Q_data); |
1960 struct Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance); | 1955 struct Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance); |
1961 Lisp_Object device = IMAGE_INSTANCE_DEVICE (ii); | 1956 Lisp_Object device = IMAGE_INSTANCE_DEVICE (ii); |
1962 int i; | 1957 int i; |
1963 CONST char *name_ext; | 1958 const char *name_ext; |
1964 Lisp_Object foreground, background; | 1959 Lisp_Object foreground, background; |
1965 | 1960 |
1966 if (!DEVICE_GTK_P (XDEVICE (device))) | 1961 if (!DEVICE_GTK_P (XDEVICE (device))) |
1967 gui_error ("Not a Gtk device", device); | 1962 gui_error ("Not a Gtk device", device); |
1968 | 1963 |