struct frame *f;
Lisp_Object arg, oldval;
{
+ struct mac_output *mac = f->output_data.mac;
unsigned long fg, old_fg;
fg = x_decode_color (f, arg, BLACK_PIX_DEFAULT (f));
if (FRAME_MAC_WINDOW (f) != 0)
{
+ Display *dpy = FRAME_MAC_DISPLAY (f);
+
+ BLOCK_INPUT;
+ XSetForeground (dpy, mac->normal_gc, fg);
+ XSetBackground (dpy, mac->reverse_gc, fg);
+
+ if (mac->cursor_pixel == old_fg)
+ {
+ unload_color (f, mac->cursor_pixel);
+ mac->cursor_pixel = fg;
+ XSetBackground (dpy, mac->cursor_gc, mac->cursor_pixel);
+ }
+
+ UNBLOCK_INPUT;
+
update_face_from_frame_parameter (f, Qforeground_color, arg);
+
if (FRAME_VISIBLE_P (f))
redraw_frame (f);
}
+
+ unload_color (f, old_fg);
}
void
struct frame *f;
Lisp_Object arg, oldval;
{
- FRAME_BACKGROUND_PIXEL (f)
- = x_decode_color (f, arg, WHITE_PIX_DEFAULT (f));
+ struct mac_output *mac = f->output_data.mac;
+ unsigned long bg;
+
+ bg = x_decode_color (f, arg, WHITE_PIX_DEFAULT (f));
+ unload_color (f, FRAME_BACKGROUND_PIXEL (f));
+ FRAME_BACKGROUND_PIXEL (f) = bg;
if (FRAME_MAC_WINDOW (f) != 0)
{
+ Display *dpy = FRAME_MAC_DISPLAY (f);
+
+ BLOCK_INPUT;
+ XSetBackground (dpy, mac->normal_gc, bg);
+ XSetForeground (dpy, mac->reverse_gc, bg);
+ XSetWindowBackground (dpy, FRAME_MAC_WINDOW (f), bg);
+ XSetForeground (dpy, mac->cursor_gc, bg);
+
+ UNBLOCK_INPUT;
update_face_from_frame_parameter (f, Qbackground_color, arg);
if (FRAME_VISIBLE_P (f))
/* so that update events can find this mac_output struct */
f->output_data.mac->mFP = f; /* point back to emacs frame */
+ if (FRAME_MAC_WINDOW (f))
+ XSetWindowBackground (FRAME_MAC_DISPLAY(f), FRAME_MAC_WINDOW (f),
+ FRAME_BACKGROUND_PIXEL (f));
+
validate_x_resource_name ();
/* x_set_name normally ignores requests to set the name if the
#endif
{
FRAME_MAC_WINDOW (f) = tip_window;
+ XSetWindowBackground (FRAME_MAC_DISPLAY(f), tip_window,
+ FRAME_BACKGROUND_PIXEL (f));
SetWRefCon (tip_window, (long) f->output_data.mac);
/* so that update events can find this mac_output struct */
f->output_data.mac->mFP = f;
}
+/* 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
unsigned int));
extern void XFreePixmap P_ ((Display *, Pixmap));
extern void XSetForeground P_ ((Display *, GC, unsigned long));
+extern void XSetBackground P_ ((Display *, GC, unsigned long));
+extern void XSetWindowBackground P_ ((Display *, WindowPtr, unsigned long));
extern void mac_draw_line_to_pixmap P_ ((Display *, Pixmap, GC, int, int,
int, int));
extern void mac_unload_font P_ ((struct mac_display_info *, XFontStruct *));