Commit 9cdd4884 authored by Steven Tamm's avatar Steven Tamm
Browse files

* 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.
parent 5092b644
2005-01-15 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
* 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.
2005-01-14 Kim F. Storm <storm@cua.dk>
 
* keyboard.c (Fposn_at_x_y): Add optional arg WHOLE.
......
......@@ -1385,6 +1385,7 @@ x_set_foreground_color (f, arg, oldval)
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));
......@@ -1393,10 +1394,28 @@ x_set_foreground_color (f, arg, oldval)
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
......@@ -1404,11 +1423,24 @@ x_set_background_color (f, arg, oldval)
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))
......@@ -2297,6 +2329,10 @@ mac_window (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
......@@ -3856,6 +3892,8 @@ x_create_tip_frame (dpyinfo, parms, text)
#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;
......
......@@ -1091,6 +1091,62 @@ XSetForeground (display, gc, color)
}
/* 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
......
......@@ -602,6 +602,8 @@ extern Pixmap XCreatePixmapFromBitmapData P_ ((Display *, WindowPtr, char *,
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 *));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment