Mercurial > emacs
comparison src/macfns.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 | a1edc5959dcf |
children | bf1c907c5570 |
comparison
equal
deleted
inserted
replaced
59574:9ce057395159 | 59575:011a0c55c1f2 |
---|---|
1383 void | 1383 void |
1384 x_set_foreground_color (f, arg, oldval) | 1384 x_set_foreground_color (f, arg, oldval) |
1385 struct frame *f; | 1385 struct frame *f; |
1386 Lisp_Object arg, oldval; | 1386 Lisp_Object arg, oldval; |
1387 { | 1387 { |
1388 struct mac_output *mac = f->output_data.mac; | |
1388 unsigned long fg, old_fg; | 1389 unsigned long fg, old_fg; |
1389 | 1390 |
1390 fg = x_decode_color (f, arg, BLACK_PIX_DEFAULT (f)); | 1391 fg = x_decode_color (f, arg, BLACK_PIX_DEFAULT (f)); |
1391 old_fg = FRAME_FOREGROUND_PIXEL (f); | 1392 old_fg = FRAME_FOREGROUND_PIXEL (f); |
1392 FRAME_FOREGROUND_PIXEL (f) = fg; | 1393 FRAME_FOREGROUND_PIXEL (f) = fg; |
1393 | 1394 |
1394 if (FRAME_MAC_WINDOW (f) != 0) | 1395 if (FRAME_MAC_WINDOW (f) != 0) |
1395 { | 1396 { |
1397 Display *dpy = FRAME_MAC_DISPLAY (f); | |
1398 | |
1399 BLOCK_INPUT; | |
1400 XSetForeground (dpy, mac->normal_gc, fg); | |
1401 XSetBackground (dpy, mac->reverse_gc, fg); | |
1402 | |
1403 if (mac->cursor_pixel == old_fg) | |
1404 { | |
1405 unload_color (f, mac->cursor_pixel); | |
1406 mac->cursor_pixel = fg; | |
1407 XSetBackground (dpy, mac->cursor_gc, mac->cursor_pixel); | |
1408 } | |
1409 | |
1410 UNBLOCK_INPUT; | |
1411 | |
1396 update_face_from_frame_parameter (f, Qforeground_color, arg); | 1412 update_face_from_frame_parameter (f, Qforeground_color, arg); |
1413 | |
1397 if (FRAME_VISIBLE_P (f)) | 1414 if (FRAME_VISIBLE_P (f)) |
1398 redraw_frame (f); | 1415 redraw_frame (f); |
1399 } | 1416 } |
1417 | |
1418 unload_color (f, old_fg); | |
1400 } | 1419 } |
1401 | 1420 |
1402 void | 1421 void |
1403 x_set_background_color (f, arg, oldval) | 1422 x_set_background_color (f, arg, oldval) |
1404 struct frame *f; | 1423 struct frame *f; |
1405 Lisp_Object arg, oldval; | 1424 Lisp_Object arg, oldval; |
1406 { | 1425 { |
1407 FRAME_BACKGROUND_PIXEL (f) | 1426 struct mac_output *mac = f->output_data.mac; |
1408 = x_decode_color (f, arg, WHITE_PIX_DEFAULT (f)); | 1427 unsigned long bg; |
1428 | |
1429 bg = x_decode_color (f, arg, WHITE_PIX_DEFAULT (f)); | |
1430 unload_color (f, FRAME_BACKGROUND_PIXEL (f)); | |
1431 FRAME_BACKGROUND_PIXEL (f) = bg; | |
1409 | 1432 |
1410 if (FRAME_MAC_WINDOW (f) != 0) | 1433 if (FRAME_MAC_WINDOW (f) != 0) |
1411 { | 1434 { |
1435 Display *dpy = FRAME_MAC_DISPLAY (f); | |
1436 | |
1437 BLOCK_INPUT; | |
1438 XSetBackground (dpy, mac->normal_gc, bg); | |
1439 XSetForeground (dpy, mac->reverse_gc, bg); | |
1440 XSetWindowBackground (dpy, FRAME_MAC_WINDOW (f), bg); | |
1441 XSetForeground (dpy, mac->cursor_gc, bg); | |
1442 | |
1443 UNBLOCK_INPUT; | |
1412 update_face_from_frame_parameter (f, Qbackground_color, arg); | 1444 update_face_from_frame_parameter (f, Qbackground_color, arg); |
1413 | 1445 |
1414 if (FRAME_VISIBLE_P (f)) | 1446 if (FRAME_VISIBLE_P (f)) |
1415 redraw_frame (f); | 1447 redraw_frame (f); |
1416 } | 1448 } |
2295 (WindowPtr) -1, 1, (long) f->output_data.mac); | 2327 (WindowPtr) -1, 1, (long) f->output_data.mac); |
2296 #endif | 2328 #endif |
2297 /* so that update events can find this mac_output struct */ | 2329 /* so that update events can find this mac_output struct */ |
2298 f->output_data.mac->mFP = f; /* point back to emacs frame */ | 2330 f->output_data.mac->mFP = f; /* point back to emacs frame */ |
2299 | 2331 |
2332 if (FRAME_MAC_WINDOW (f)) | |
2333 XSetWindowBackground (FRAME_MAC_DISPLAY(f), FRAME_MAC_WINDOW (f), | |
2334 FRAME_BACKGROUND_PIXEL (f)); | |
2335 | |
2300 validate_x_resource_name (); | 2336 validate_x_resource_name (); |
2301 | 2337 |
2302 /* x_set_name normally ignores requests to set the name if the | 2338 /* x_set_name normally ignores requests to set the name if the |
2303 requested name is the same as the current name. This is the one | 2339 requested name is the same as the current name. This is the one |
2304 place where that assumption isn't correct; f->name is set, but | 2340 place where that assumption isn't correct; f->name is set, but |
3854 if (tip_window = NewCWindow (NULL, &r, "\p", false, plainDBox, | 3890 if (tip_window = NewCWindow (NULL, &r, "\p", false, plainDBox, |
3855 NULL, false, 0L)) | 3891 NULL, false, 0L)) |
3856 #endif | 3892 #endif |
3857 { | 3893 { |
3858 FRAME_MAC_WINDOW (f) = tip_window; | 3894 FRAME_MAC_WINDOW (f) = tip_window; |
3895 XSetWindowBackground (FRAME_MAC_DISPLAY(f), tip_window, | |
3896 FRAME_BACKGROUND_PIXEL (f)); | |
3859 SetWRefCon (tip_window, (long) f->output_data.mac); | 3897 SetWRefCon (tip_window, (long) f->output_data.mac); |
3860 /* so that update events can find this mac_output struct */ | 3898 /* so that update events can find this mac_output struct */ |
3861 f->output_data.mac->mFP = f; | 3899 f->output_data.mac->mFP = f; |
3862 } | 3900 } |
3863 UNBLOCK_INPUT; | 3901 UNBLOCK_INPUT; |