# HG changeset patch # User wmperry # Date 1012657374 0 # Node ID 2e5e2ccbeed2416ac4f2d1ae5ba0eca3de4ef06a # Parent 5039859429c5ec9561cdfcf738aa1d0f7d215eb6 [xemacs-hg @ 2002-02-02 13:42:53 by wmperry] Fix XPM transparency in GTK, mostly. diff -r 5039859429c5 -r 2e5e2ccbeed2 src/ChangeLog --- a/src/ChangeLog Sat Feb 02 13:39:59 2002 +0000 +++ b/src/ChangeLog Sat Feb 02 13:42:54 2002 +0000 @@ -1,3 +1,10 @@ +2002-02-02 William M. Perry + + * glyphs-gtk.c (extract_xpm_color_names): Resurrect the xpm color + symbols stuff because the GTK XPM libraries do very weird things + if you don't specify the transparency at all. Reverting the patch + of 12/22/01. + 2002-01-26 Stephen J. Turnbull * ChangeLog (2001-09-19 Ben Wing): Entry dosed with Dramamine. diff -r 5039859429c5 -r 2e5e2ccbeed2 src/glyphs-gtk.c --- a/src/glyphs-gtk.c Sat Feb 02 13:39:59 2002 +0000 +++ b/src/glyphs-gtk.c Sat Feb 02 13:42:54 2002 +0000 @@ -1083,7 +1083,6 @@ /********************************************************************** * XPM * **********************************************************************/ - static void write_lisp_string_to_temp_file (Lisp_Object string, char *filename_out) { @@ -1183,9 +1182,77 @@ report_file_error ("Writing temp file", build_string (filename_out)); } +struct color_symbol +{ + char* name; + GdkColor color; +}; + +static struct color_symbol* +extract_xpm_color_names (Lisp_Object device, + Lisp_Object domain, + Lisp_Object color_symbol_alist, + int* nsymbols) +{ + /* This function can GC */ + Lisp_Object rest; + Lisp_Object results = Qnil; + int i, j; + struct color_symbol *colortbl; + struct gcpro gcpro1, gcpro2; + + GCPRO2 (results, device); + + /* We built up results to be (("name" . #) ...) so that if an + error happens we don't lose any malloc()ed data, or more importantly, + leave any pixels allocated in the server. */ + i = 0; + LIST_LOOP (rest, color_symbol_alist) + { + Lisp_Object cons = XCAR (rest); + Lisp_Object name = XCAR (cons); + Lisp_Object value = XCDR (cons); + if (NILP (value)) + continue; + if (STRINGP (value)) + value = + Fmake_color_instance + (value, device, encode_error_behavior_flag (ERROR_ME_NOT)); + else + { + assert (COLOR_SPECIFIERP (value)); + value = Fspecifier_instance (value, domain, Qnil, Qnil); + } + + if (NILP (value)) + continue; + results = noseeum_cons (noseeum_cons (name, value), results); + i++; + } + UNGCPRO; /* no more evaluation */ + + *nsymbols=i; + if (i == 0) return 0; + + colortbl = xnew_array_and_zero (struct color_symbol, i); + + for (j=0; j