Mercurial > emacs
changeset 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 | 9ce057395159 |
children | bf1c907c5570 |
files | src/ChangeLog src/macfns.c src/macterm.c src/macterm.h |
diffstat | 4 files changed, 106 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog Sat Jan 15 23:09:32 2005 +0000 +++ b/src/ChangeLog Sun Jan 16 00:10:18 2005 +0000 @@ -1,3 +1,11 @@ +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.
--- a/src/macfns.c Sat Jan 15 23:09:32 2005 +0000 +++ b/src/macfns.c Sun Jan 16 00:10:18 2005 +0000 @@ -1385,6 +1385,7 @@ 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 @@ 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 @@ 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 @@ /* 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 @@ #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;
--- 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
--- a/src/macterm.h Sat Jan 15 23:09:32 2005 +0000 +++ b/src/macterm.h Sun Jan 16 00:10:18 2005 +0000 @@ -602,6 +602,8 @@ 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 *));