diff 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
line wrap: on
line diff
--- a/src/glyphs-gtk.c	Sun Dec 23 01:11:00 2001 +0000
+++ b/src/glyphs-gtk.c	Sun Dec 23 20:28:22 2001 +0000
@@ -1,4 +1,4 @@
-/* X-specific Lisp objects.
+/* GTK-specific Lisp objects.
    Copyright (C) 1993, 1994 Free Software Foundation, Inc.
    Copyright (C) 1995 Board of Trustees, University of Illinois.
    Copyright (C) 1995 Tinker Systems
@@ -1083,6 +1083,7 @@
 /**********************************************************************
  *                             XPM                                    *
  **********************************************************************/
+
 static void
 write_lisp_string_to_temp_file (Lisp_Object string, char *filename_out)
 {
@@ -1182,77 +1183,9 @@
     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" . #<color>) ...) 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<i; j++)
-    {
-      Lisp_Object cons = XCAR (results);
-      colortbl[j].color = 
-	* COLOR_INSTANCE_GTK_COLOR (XCOLOR_INSTANCE (XCDR (cons)));
-
-      colortbl[j].name = (char *) XSTRING_DATA (XCAR (cons));
-      free_cons (XCONS (cons));
-      cons = results;
-      results = XCDR (results);
-      free_cons (XCONS (cons));
-    }
-  return colortbl;
-}
-
 static void
-gtk_xpm_instantiate (Lisp_Object image_instance, Lisp_Object instantiator,
+gtk_xpm_instantiate (Lisp_Object image_instance,
+		     Lisp_Object instantiator,
 		     Lisp_Object pointer_fg, Lisp_Object pointer_bg,
 		     int dest_mask, Lisp_Object domain)
 {
@@ -1267,9 +1200,7 @@
   GdkPixmap *pixmap;
   GdkPixmap *mask = 0;
   GdkWindow *window = 0;
-  int nsymbols = 0, i = 0;
-  struct color_symbol *color_symbols = NULL;
-  GdkColor *transparent_color = NULL;
+  int i = 0;
   Lisp_Object color_symbol_alist = find_keyword_in_vector (instantiator,
 							   Q_color_symbols);
   enum image_instance_type type;
@@ -1300,23 +1231,10 @@
 
   assert (!NILP (data));
 
-  /* Need to get the transparent color here */
-  color_symbols = extract_xpm_color_names (device, domain, color_symbol_alist, &nsymbols);
-  for (i = 0; i < nsymbols; i++)
-    {
-      if (!strcasecmp ("BgColor", color_symbols[i].name) ||
-	  !strcasecmp ("None", color_symbols[i].name))
-	{
-	  transparent_color = &color_symbols[i].color;
-	}
-    }
-
   write_lisp_string_to_temp_file (data, temp_file_name);
-  pixmap = gdk_pixmap_create_from_xpm (window, &mask, transparent_color, temp_file_name);
+  pixmap = gdk_pixmap_create_from_xpm (window, &mask, NULL, temp_file_name);
   unlink (temp_file_name);
 
-  if (color_symbols) xfree (color_symbols);
-
   if (!pixmap)
   {
     signal_image_error ("Error reading pixmap", data);
@@ -1383,6 +1301,7 @@
       abort ();
     }
 }
+
 #endif /* HAVE_XPM */