diff src/macterm.c @ 59575:011a0c55c1f2

* macfns.c (x_set_foreground_color, x_set_background_color): Sync with xfns.c. (mac_window, x_create_tip_frame): Use XSetWindowBackground. * macterm.c (XSetBackground, XSetWindowBackground): New functions. * macterm.h (XSetBackground, XSetWindowBackground): Add externs.
author Steven Tamm <steventamm@mac.com>
date Sun, 16 Jan 2005 00:10:18 +0000
parents b0b469611a56
children a4a748516aa7
line wrap: on
line diff
--- a/src/macterm.c	Sat Jan 15 23:09:32 2005 +0000
+++ b/src/macterm.c	Sun Jan 16 00:10:18 2005 +0000
@@ -1091,6 +1091,62 @@
 }
 
 
+/* Mac replacement for XSetBackground.  */
+
+void
+XSetBackground (display, gc, color)
+     Display *display;
+     GC gc;
+     unsigned long color;
+{
+  gc->background = color;
+}
+
+
+/* Mac replacement for XSetWindowBackground.  */
+
+void
+XSetWindowBackground (display, w, color)
+     Display *display;
+     WindowPtr w;
+     unsigned long color;
+{
+#if !TARGET_API_MAC_CARBON
+  AuxWinHandle aw_handle;
+  CTabHandle ctab_handle;
+  ColorSpecPtr ct_table;
+  short ct_size;
+#endif
+  RGBColor bg_color;
+
+  bg_color.red = RED16_FROM_ULONG (color);
+  bg_color.green = GREEN16_FROM_ULONG (color);
+  bg_color.blue = BLUE16_FROM_ULONG (color);
+
+#if TARGET_API_MAC_CARBON
+  SetWindowContentColor (w, &bg_color);
+#else
+  if (GetAuxWin (w, &aw_handle))
+    {
+      ctab_handle = (*aw_handle)->awCTable;
+      HandToHand ((Handle *) &ctab_handle);
+      ct_table = (*ctab_handle)->ctTable;
+      ct_size = (*ctab_handle)->ctSize;
+      while (ct_size > -1)
+	{
+	  if (ct_table->value == 0)
+	    {
+	      ct_table->rgb = bg_color;
+	      CTabChanged (ctab_handle);
+	      SetWinColor (w, (WCTabHandle) ctab_handle);
+	    }
+	  ct_size--;
+	}
+    }
+#endif
+}
+
+
 /* Mac replacement for XSetFont.  */
 
 static void