Mercurial > hg > xemacs-beta
comparison src/glyphs-gtk.c @ 714:02339d4ebed4
[xemacs-hg @ 2001-12-23 20:28:19 by wmperry]
2001-12-22 William M. Perry <wmperry@gnu.org>
* glyphs-gtk.c (gtk_xpm_instantiate): Don't bother doing the
xpm-color-symbols checks, they are impossible to implement with
GTK's XPM implementation. :(
2001-12-13 William M. Perry <wmperry@gnu.org>
* select-gtk.c (gtk_own_selection): Update to follow the new
method signature. Ignore owned_p as it appears to only be used
for motif hacks.
* redisplay-gtk.c (gtk_output_string): Fixed some warnings about
signed/unsigned comparison.
(gtk_output_gdk_pixmap): Remove clipping code as per change by
andy@xemacs.org to the X11 code.
(gtk_output_pixmap): Make this follow the output_pixmap method
conventions and expose it.
(gtk_output_horizontal_line): Renamed from output_hline, and
expose it in our method structure.
(gtk_ring_bell): Don't ring the bell if volume <= 0
* toolbar-gtk.c (gtk_output_toolbar_button):
(gtk_output_frame_toolbars):
(gtk_redraw_exposed_toolbars):
(gtk_redraw_frame_toolbars): These are now just aliases for the
common_XXX() routines in toolbar-common.c
* toolbar-common.c: New common toolbar implementation. This file
uses only the redisplay_XXX() functions and device methods to draw
the toolbar, and so should be portable across all windowing
systems (other than tty, and even then I imagine text-based stuff
would work if you had a way to select it).
author | wmperry |
---|---|
date | Sun, 23 Dec 2001 20:28:22 +0000 |
parents | 1df69dc58840 |
children | 2e5e2ccbeed2 |
comparison
equal
deleted
inserted
replaced
713:c2c346111c9a | 714:02339d4ebed4 |
---|---|
1 /* X-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 Ben Wing |
6 Copyright (C) 1995 Sun Microsystems | 6 Copyright (C) 1995 Sun Microsystems |
1081 | 1081 |
1082 #ifdef HAVE_XPM | 1082 #ifdef HAVE_XPM |
1083 /********************************************************************** | 1083 /********************************************************************** |
1084 * XPM * | 1084 * XPM * |
1085 **********************************************************************/ | 1085 **********************************************************************/ |
1086 | |
1086 static void | 1087 static void |
1087 write_lisp_string_to_temp_file (Lisp_Object string, char *filename_out) | 1088 write_lisp_string_to_temp_file (Lisp_Object string, char *filename_out) |
1088 { | 1089 { |
1089 Lisp_Object instream, outstream; | 1090 Lisp_Object instream, outstream; |
1090 Lstream *istr, *ostr; | 1091 Lstream *istr, *ostr; |
1180 | 1181 |
1181 if (fubar) | 1182 if (fubar) |
1182 report_file_error ("Writing temp file", build_string (filename_out)); | 1183 report_file_error ("Writing temp file", build_string (filename_out)); |
1183 } | 1184 } |
1184 | 1185 |
1185 struct color_symbol | 1186 static void |
1186 { | 1187 gtk_xpm_instantiate (Lisp_Object image_instance, |
1187 char* name; | 1188 Lisp_Object instantiator, |
1188 GdkColor color; | |
1189 }; | |
1190 | |
1191 static struct color_symbol* | |
1192 extract_xpm_color_names (Lisp_Object device, | |
1193 Lisp_Object domain, | |
1194 Lisp_Object color_symbol_alist, | |
1195 int* nsymbols) | |
1196 { | |
1197 /* This function can GC */ | |
1198 Lisp_Object rest; | |
1199 Lisp_Object results = Qnil; | |
1200 int i, j; | |
1201 struct color_symbol *colortbl; | |
1202 struct gcpro gcpro1, gcpro2; | |
1203 | |
1204 GCPRO2 (results, device); | |
1205 | |
1206 /* We built up results to be (("name" . #<color>) ...) so that if an | |
1207 error happens we don't lose any malloc()ed data, or more importantly, | |
1208 leave any pixels allocated in the server. */ | |
1209 i = 0; | |
1210 LIST_LOOP (rest, color_symbol_alist) | |
1211 { | |
1212 Lisp_Object cons = XCAR (rest); | |
1213 Lisp_Object name = XCAR (cons); | |
1214 Lisp_Object value = XCDR (cons); | |
1215 if (NILP (value)) | |
1216 continue; | |
1217 if (STRINGP (value)) | |
1218 value = | |
1219 Fmake_color_instance | |
1220 (value, device, encode_error_behavior_flag (ERROR_ME_NOT)); | |
1221 else | |
1222 { | |
1223 assert (COLOR_SPECIFIERP (value)); | |
1224 value = Fspecifier_instance (value, domain, Qnil, Qnil); | |
1225 } | |
1226 | |
1227 if (NILP (value)) | |
1228 continue; | |
1229 results = noseeum_cons (noseeum_cons (name, value), results); | |
1230 i++; | |
1231 } | |
1232 UNGCPRO; /* no more evaluation */ | |
1233 | |
1234 *nsymbols=i; | |
1235 if (i == 0) return 0; | |
1236 | |
1237 colortbl = xnew_array_and_zero (struct color_symbol, i); | |
1238 | |
1239 for (j=0; j<i; j++) | |
1240 { | |
1241 Lisp_Object cons = XCAR (results); | |
1242 colortbl[j].color = | |
1243 * COLOR_INSTANCE_GTK_COLOR (XCOLOR_INSTANCE (XCDR (cons))); | |
1244 | |
1245 colortbl[j].name = (char *) XSTRING_DATA (XCAR (cons)); | |
1246 free_cons (XCONS (cons)); | |
1247 cons = results; | |
1248 results = XCDR (results); | |
1249 free_cons (XCONS (cons)); | |
1250 } | |
1251 return colortbl; | |
1252 } | |
1253 | |
1254 static void | |
1255 gtk_xpm_instantiate (Lisp_Object image_instance, Lisp_Object instantiator, | |
1256 Lisp_Object pointer_fg, Lisp_Object pointer_bg, | 1189 Lisp_Object pointer_fg, Lisp_Object pointer_bg, |
1257 int dest_mask, Lisp_Object domain) | 1190 int dest_mask, Lisp_Object domain) |
1258 { | 1191 { |
1259 /* This function can GC */ | 1192 /* This function can GC */ |
1260 char temp_file_name[1024]; | 1193 char temp_file_name[1024]; |
1265 int depth; | 1198 int depth; |
1266 GdkVisual *visual; | 1199 GdkVisual *visual; |
1267 GdkPixmap *pixmap; | 1200 GdkPixmap *pixmap; |
1268 GdkPixmap *mask = 0; | 1201 GdkPixmap *mask = 0; |
1269 GdkWindow *window = 0; | 1202 GdkWindow *window = 0; |
1270 int nsymbols = 0, i = 0; | 1203 int i = 0; |
1271 struct color_symbol *color_symbols = NULL; | |
1272 GdkColor *transparent_color = NULL; | |
1273 Lisp_Object color_symbol_alist = find_keyword_in_vector (instantiator, | 1204 Lisp_Object color_symbol_alist = find_keyword_in_vector (instantiator, |
1274 Q_color_symbols); | 1205 Q_color_symbols); |
1275 enum image_instance_type type; | 1206 enum image_instance_type type; |
1276 int force_mono; | 1207 int force_mono; |
1277 unsigned int w, h; | 1208 unsigned int w, h; |
1298 | 1229 |
1299 gtk_initialize_pixmap_image_instance (ii, 1, type); | 1230 gtk_initialize_pixmap_image_instance (ii, 1, type); |
1300 | 1231 |
1301 assert (!NILP (data)); | 1232 assert (!NILP (data)); |
1302 | 1233 |
1303 /* Need to get the transparent color here */ | |
1304 color_symbols = extract_xpm_color_names (device, domain, color_symbol_alist, &nsymbols); | |
1305 for (i = 0; i < nsymbols; i++) | |
1306 { | |
1307 if (!strcasecmp ("BgColor", color_symbols[i].name) || | |
1308 !strcasecmp ("None", color_symbols[i].name)) | |
1309 { | |
1310 transparent_color = &color_symbols[i].color; | |
1311 } | |
1312 } | |
1313 | |
1314 write_lisp_string_to_temp_file (data, temp_file_name); | 1234 write_lisp_string_to_temp_file (data, temp_file_name); |
1315 pixmap = gdk_pixmap_create_from_xpm (window, &mask, transparent_color, temp_file_name); | 1235 pixmap = gdk_pixmap_create_from_xpm (window, &mask, NULL, temp_file_name); |
1316 unlink (temp_file_name); | 1236 unlink (temp_file_name); |
1317 | |
1318 if (color_symbols) xfree (color_symbols); | |
1319 | 1237 |
1320 if (!pixmap) | 1238 if (!pixmap) |
1321 { | 1239 { |
1322 signal_image_error ("Error reading pixmap", data); | 1240 signal_image_error ("Error reading pixmap", data); |
1323 } | 1241 } |
1381 | 1299 |
1382 default: | 1300 default: |
1383 abort (); | 1301 abort (); |
1384 } | 1302 } |
1385 } | 1303 } |
1304 | |
1386 #endif /* HAVE_XPM */ | 1305 #endif /* HAVE_XPM */ |
1387 | 1306 |
1388 | 1307 |
1389 #ifdef HAVE_XFACE | 1308 #ifdef HAVE_XFACE |
1390 | 1309 |