diff options
| author | YAMAMOTO Mitsuharu | 2007-01-05 08:30:14 +0000 |
|---|---|---|
| committer | YAMAMOTO Mitsuharu | 2007-01-05 08:30:14 +0000 |
| commit | e2d3b7e128b6457965567bb842b84658eb8480f7 (patch) | |
| tree | fe8cbabaad5cea47c48ae5550aebdabfbd1bd72f /src | |
| parent | 0aea47c1ee664c4282ae14fb558ff8278659b12c (diff) | |
| download | emacs-e2d3b7e128b6457965567bb842b84658eb8480f7.tar.gz emacs-e2d3b7e128b6457965567bb842b84658eb8480f7.zip | |
(CG_SET_FILL_COLOR_MAYBE_WITH_CGCOLOR)
(CG_SET_FILL_COLOR_WITH_GC_FOREGROUND)
(CG_SET_FILL_COLOR_WITH_GC_BACKGROUND)
(CG_SET_STROKE_COLOR_MAYBE_WITH_CGCOLOR)
(CG_SET_STROKE_COLOR_WITH_GC_FOREGROUND): New macros.
(mac_cg_color_space_rgb) [USE_CG_DRAWING]: New variable.
(mac_cg_color_black) [USE_CG_DRAWING
&& MAC_OS_X_VERSION_MAX_ALLOWED >= 1030]: New variable.
(init_cg_color) [USE_CG_DRAWING]: New function.
(mac_draw_line, mac_draw_rectangle) [USE_CG_DRAWING]: Use
CG_SET_STROKE_COLOR_WITH_GC_FOREGROUND instead of CG_SET_STROKE_COLOR.
(mac_erase_rectangle, mac_clear_window, mac_draw_cg_image)
(mac_fill_rectangle, mac_draw_image_string_cg) [USE_CG_DRAWING]:
Use CG_SET_FILL_COLOR_WITH_GC_FOREGROUND or
CG_SET_FILL_COLOR_WITH_GC_BACKGROUND instead of CG_SET_FILL_COLOR.
(mac_draw_string_common) [MAC_OSX && USE_ATSUI]: Likewise.
(XCreateGC, XFreeGC, XSetForeground, XSetBackground) [USE_CG_DRAWING
&& MAC_OS_X_VERSION_MAX_ALLOWED >= 1030]: Use gc->cg_fore_color and/or
gc->cg_back_color.
(install_drag_handler, remove_drag_handler): Make extern.
(install_menu_target_item_handler): Add extern.
(install_window_handler): Call install_menu_target_item_handler.
[MAC_OS8] (main): Use MAC_EMACS_CREATOR_CODE instead of 'EMAx'.
(mac_initialize) [USE_CG_DRAWING]: Call init_cg_color.
Diffstat (limited to 'src')
| -rw-r--r-- | src/macterm.c | 170 |
1 files changed, 154 insertions, 16 deletions
diff --git a/src/macterm.c b/src/macterm.c index 08b4c147c05..41bb8129ecd 100644 --- a/src/macterm.c +++ b/src/macterm.c | |||
| @@ -270,16 +270,63 @@ static void XSetFont P_ ((Display *, GC, XFontStruct *)); | |||
| 270 | #define GC_BACK_COLOR(gc) (&(gc)->back_color) | 270 | #define GC_BACK_COLOR(gc) (&(gc)->back_color) |
| 271 | #define GC_FONT(gc) ((gc)->xgcv.font) | 271 | #define GC_FONT(gc) ((gc)->xgcv.font) |
| 272 | #define FRAME_NORMAL_GC(f) ((f)->output_data.mac->normal_gc) | 272 | #define FRAME_NORMAL_GC(f) ((f)->output_data.mac->normal_gc) |
| 273 | #define CG_SET_FILL_COLOR(context, color) \ | 273 | |
| 274 | #define CG_SET_FILL_COLOR(context, color) \ | ||
| 274 | CGContextSetRGBFillColor (context, \ | 275 | CGContextSetRGBFillColor (context, \ |
| 275 | RED_FROM_ULONG (color) / 255.0f, \ | 276 | RED_FROM_ULONG (color) / 255.0f, \ |
| 276 | GREEN_FROM_ULONG (color) / 255.0f, \ | 277 | GREEN_FROM_ULONG (color) / 255.0f, \ |
| 277 | BLUE_FROM_ULONG (color) / 255.0f, 1.0f) | 278 | BLUE_FROM_ULONG (color) / 255.0f, 1.0f) |
| 278 | #define CG_SET_STROKE_COLOR(context, color) \ | 279 | #if USE_CG_DRAWING && MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 |
| 280 | #if MAC_OS_X_VERSION_MIN_REQUIRED == 1020 | ||
| 281 | #define CG_SET_FILL_COLOR_MAYBE_WITH_CGCOLOR(context, color, cg_color) \ | ||
| 282 | do { \ | ||
| 283 | if (CGColorGetTypeID != NULL) \ | ||
| 284 | CGContextSetFillColorWithColor (context, cg_color); \ | ||
| 285 | else \ | ||
| 286 | CG_SET_FILL_COLOR (context, color); \ | ||
| 287 | } while (0) | ||
| 288 | #else | ||
| 289 | #define CG_SET_FILL_COLOR_MAYBE_WITH_CGCOLOR(context, color, cg_color) \ | ||
| 290 | CGContextSetFillColorWithColor (context, cg_color) | ||
| 291 | #endif | ||
| 292 | #else | ||
| 293 | #define CG_SET_FILL_COLOR_MAYBE_WITH_CGCOLOR(context, color, cg_color) \ | ||
| 294 | CG_SET_FILL_COLOR (context, color) | ||
| 295 | #endif | ||
| 296 | #define CG_SET_FILL_COLOR_WITH_GC_FOREGROUND(context, gc) \ | ||
| 297 | CG_SET_FILL_COLOR_MAYBE_WITH_CGCOLOR (context, (gc)->xgcv.foreground, \ | ||
| 298 | (gc)->cg_fore_color) | ||
| 299 | #define CG_SET_FILL_COLOR_WITH_GC_BACKGROUND(context, gc) \ | ||
| 300 | CG_SET_FILL_COLOR_MAYBE_WITH_CGCOLOR (context, (gc)->xgcv.background, \ | ||
| 301 | (gc)->cg_back_color) | ||
| 302 | |||
| 303 | |||
| 304 | #define CG_SET_STROKE_COLOR(context, color) \ | ||
| 279 | CGContextSetRGBStrokeColor (context, \ | 305 | CGContextSetRGBStrokeColor (context, \ |
| 280 | RED_FROM_ULONG (color) / 255.0f, \ | 306 | RED_FROM_ULONG (color) / 255.0f, \ |
| 281 | GREEN_FROM_ULONG (color) / 255.0f, \ | 307 | GREEN_FROM_ULONG (color) / 255.0f, \ |
| 282 | BLUE_FROM_ULONG (color) / 255.0f, 1.0f) | 308 | BLUE_FROM_ULONG (color) / 255.0f, 1.0f) |
| 309 | #if USE_CG_DRAWING && MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 | ||
| 310 | #if MAC_OS_X_VERSION_MIN_REQUIRED == 1020 | ||
| 311 | #define CG_SET_STROKE_COLOR_MAYBE_WITH_CGCOLOR(context, color, cg_color) \ | ||
| 312 | do { \ | ||
| 313 | if (CGColorGetTypeID != NULL) \ | ||
| 314 | CGContextSetStrokeColorWithColor (context, cg_color); \ | ||
| 315 | else \ | ||
| 316 | CG_SET_STROKE_COLOR (context, color); \ | ||
| 317 | } while (0) | ||
| 318 | #else | ||
| 319 | #define CG_SET_STROKE_COLOR_MAYBE_WITH_CGCOLOR(context, color, cg_color) \ | ||
| 320 | CGContextSetStrokeColorWithColor (context, cg_color) | ||
| 321 | #endif | ||
| 322 | #else | ||
| 323 | #define CG_SET_STROKE_COLOR_MAYBE_WITH_CGCOLOR(context, color, cg_color) \ | ||
| 324 | CG_SET_STROKE_COLOR (context, color) | ||
| 325 | #endif | ||
| 326 | #define CG_SET_STROKE_COLOR_WITH_GC_FOREGROUND(context, gc) \ | ||
| 327 | CG_SET_STROKE_COLOR_MAYBE_WITH_CGCOLOR (context, (gc)->xgcv.foreground, \ | ||
| 328 | (gc)->cg_fore_color) | ||
| 329 | |||
| 283 | #if USE_CG_DRAWING | 330 | #if USE_CG_DRAWING |
| 284 | #define FRAME_CG_CONTEXT(f) ((f)->output_data.mac->cg_context) | 331 | #define FRAME_CG_CONTEXT(f) ((f)->output_data.mac->cg_context) |
| 285 | 332 | ||
| @@ -288,6 +335,29 @@ static void XSetFont P_ ((Display *, GC, XFontStruct *)); | |||
| 288 | static int max_fringe_bmp = 0; | 335 | static int max_fringe_bmp = 0; |
| 289 | static CGImageRef *fringe_bmp = 0; | 336 | static CGImageRef *fringe_bmp = 0; |
| 290 | 337 | ||
| 338 | static CGColorSpaceRef mac_cg_color_space_rgb; | ||
| 339 | #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 | ||
| 340 | static CGColorRef mac_cg_color_black; | ||
| 341 | #endif | ||
| 342 | |||
| 343 | static void | ||
| 344 | init_cg_color () | ||
| 345 | { | ||
| 346 | mac_cg_color_space_rgb = CGColorSpaceCreateDeviceRGB (); | ||
| 347 | #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 | ||
| 348 | #if MAC_OS_X_VERSION_MIN_REQUIRED == 1020 | ||
| 349 | /* Don't check the availability of CGColorCreate; this symbol is | ||
| 350 | defined even in Mac OS X 10.1. */ | ||
| 351 | if (CGColorGetTypeID != NULL) | ||
| 352 | #endif | ||
| 353 | { | ||
| 354 | float rgba[] = {0.0f, 0.0f, 0.0f, 1.0f}; | ||
| 355 | |||
| 356 | mac_cg_color_black = CGColorCreate (mac_cg_color_space_rgb, rgba); | ||
| 357 | } | ||
| 358 | #endif | ||
| 359 | } | ||
| 360 | |||
| 291 | static CGContextRef | 361 | static CGContextRef |
| 292 | mac_begin_cg_clip (f, gc) | 362 | mac_begin_cg_clip (f, gc) |
| 293 | struct frame *f; | 363 | struct frame *f; |
| @@ -401,7 +471,7 @@ mac_draw_line (f, gc, x1, y1, x2, y2) | |||
| 401 | gy1 += 0.5f, gy2 += 0.5f; | 471 | gy1 += 0.5f, gy2 += 0.5f; |
| 402 | 472 | ||
| 403 | context = mac_begin_cg_clip (f, gc); | 473 | context = mac_begin_cg_clip (f, gc); |
| 404 | CG_SET_STROKE_COLOR (context, gc->xgcv.foreground); | 474 | CG_SET_STROKE_COLOR_WITH_GC_FOREGROUND (context, gc); |
| 405 | CGContextBeginPath (context); | 475 | CGContextBeginPath (context); |
| 406 | CGContextMoveToPoint (context, gx1, gy1); | 476 | CGContextMoveToPoint (context, gx1, gy1); |
| 407 | CGContextAddLineToPoint (context, gx2, gy2); | 477 | CGContextAddLineToPoint (context, gx2, gy2); |
| @@ -485,7 +555,7 @@ mac_erase_rectangle (f, gc, x, y, width, height) | |||
| 485 | CGContextRef context; | 555 | CGContextRef context; |
| 486 | 556 | ||
| 487 | context = mac_begin_cg_clip (f, gc); | 557 | context = mac_begin_cg_clip (f, gc); |
| 488 | CG_SET_FILL_COLOR (context, gc->xgcv.background); | 558 | CG_SET_FILL_COLOR_WITH_GC_BACKGROUND (context, gc); |
| 489 | CGContextFillRect (context, CGRectMake (x, y, width, height)); | 559 | CGContextFillRect (context, CGRectMake (x, y, width, height)); |
| 490 | mac_end_cg_clip (f); | 560 | mac_end_cg_clip (f); |
| 491 | #else | 561 | #else |
| @@ -527,7 +597,7 @@ mac_clear_window (f) | |||
| 527 | GC gc = FRAME_NORMAL_GC (f); | 597 | GC gc = FRAME_NORMAL_GC (f); |
| 528 | 598 | ||
| 529 | context = mac_begin_cg_clip (f, NULL); | 599 | context = mac_begin_cg_clip (f, NULL); |
| 530 | CG_SET_FILL_COLOR (context, gc->xgcv.background); | 600 | CG_SET_FILL_COLOR_WITH_GC_BACKGROUND (context, gc); |
| 531 | CGContextFillRect (context, CGRectMake (0, 0, FRAME_PIXEL_WIDTH (f), | 601 | CGContextFillRect (context, CGRectMake (0, 0, FRAME_PIXEL_WIDTH (f), |
| 532 | FRAME_PIXEL_HEIGHT (f))); | 602 | FRAME_PIXEL_HEIGHT (f))); |
| 533 | mac_end_cg_clip (f); | 603 | mac_end_cg_clip (f); |
| @@ -570,14 +640,14 @@ mac_draw_cg_image (image, f, gc, src_x, src_y, width, height, | |||
| 570 | context = mac_begin_cg_clip (f, gc); | 640 | context = mac_begin_cg_clip (f, gc); |
| 571 | if (!overlay_p) | 641 | if (!overlay_p) |
| 572 | { | 642 | { |
| 573 | CG_SET_FILL_COLOR (context, gc->xgcv.background); | 643 | CG_SET_FILL_COLOR_WITH_GC_BACKGROUND (context, gc); |
| 574 | CGContextFillRect (context, dest_rect); | 644 | CGContextFillRect (context, dest_rect); |
| 575 | } | 645 | } |
| 576 | CGContextClipToRect (context, dest_rect); | 646 | CGContextClipToRect (context, dest_rect); |
| 577 | CGContextScaleCTM (context, 1, -1); | 647 | CGContextScaleCTM (context, 1, -1); |
| 578 | CGContextTranslateCTM (context, 0, -port_height); | 648 | CGContextTranslateCTM (context, 0, -port_height); |
| 579 | if (CGImageIsMask (image)) | 649 | if (CGImageIsMask (image)) |
| 580 | CG_SET_FILL_COLOR (context, gc->xgcv.foreground); | 650 | CG_SET_FILL_COLOR_WITH_GC_FOREGROUND (context, gc); |
| 581 | CGContextDrawImage (context, | 651 | CGContextDrawImage (context, |
| 582 | CGRectMake (dest_x - src_x, | 652 | CGRectMake (dest_x - src_x, |
| 583 | port_height - (dest_y - src_y | 653 | port_height - (dest_y - src_y |
| @@ -764,7 +834,7 @@ mac_fill_rectangle (f, gc, x, y, width, height) | |||
| 764 | CGContextRef context; | 834 | CGContextRef context; |
| 765 | 835 | ||
| 766 | context = mac_begin_cg_clip (f, gc); | 836 | context = mac_begin_cg_clip (f, gc); |
| 767 | CG_SET_FILL_COLOR (context, gc->xgcv.foreground); | 837 | CG_SET_FILL_COLOR_WITH_GC_FOREGROUND (context, gc); |
| 768 | CGContextFillRect (context, CGRectMake (x, y, width, height)); | 838 | CGContextFillRect (context, CGRectMake (x, y, width, height)); |
| 769 | mac_end_cg_clip (f); | 839 | mac_end_cg_clip (f); |
| 770 | #else | 840 | #else |
| @@ -795,7 +865,7 @@ mac_draw_rectangle (f, gc, x, y, width, height) | |||
| 795 | CGContextRef context; | 865 | CGContextRef context; |
| 796 | 866 | ||
| 797 | context = mac_begin_cg_clip (f, gc); | 867 | context = mac_begin_cg_clip (f, gc); |
| 798 | CG_SET_STROKE_COLOR (context, gc->xgcv.foreground); | 868 | CG_SET_STROKE_COLOR_WITH_GC_FOREGROUND (context, gc); |
| 799 | CGContextStrokeRect (context, | 869 | CGContextStrokeRect (context, |
| 800 | CGRectMake (x + 0.5f, y + 0.5f, width, height)); | 870 | CGRectMake (x + 0.5f, y + 0.5f, width, height)); |
| 801 | mac_end_cg_clip (f); | 871 | mac_end_cg_clip (f); |
| @@ -982,7 +1052,7 @@ mac_draw_string_common (f, gc, x, y, buf, nchars, bg_width, | |||
| 982 | #endif | 1052 | #endif |
| 983 | if (bg_width) | 1053 | if (bg_width) |
| 984 | { | 1054 | { |
| 985 | CG_SET_FILL_COLOR (context, gc->xgcv.background); | 1055 | CG_SET_FILL_COLOR_WITH_GC_BACKGROUND (context, gc); |
| 986 | CGContextFillRect | 1056 | CGContextFillRect |
| 987 | (context, | 1057 | (context, |
| 988 | CGRectMake (x, y - FONT_BASE (GC_FONT (gc)), | 1058 | CGRectMake (x, y - FONT_BASE (GC_FONT (gc)), |
| @@ -993,7 +1063,7 @@ mac_draw_string_common (f, gc, x, y, buf, nchars, bg_width, | |||
| 993 | #if !USE_CG_DRAWING | 1063 | #if !USE_CG_DRAWING |
| 994 | } | 1064 | } |
| 995 | #endif | 1065 | #endif |
| 996 | CG_SET_FILL_COLOR (context, gc->xgcv.foreground); | 1066 | CG_SET_FILL_COLOR_WITH_GC_FOREGROUND (context, gc); |
| 997 | err = ATSUSetLayoutControls (text_layout, | 1067 | err = ATSUSetLayoutControls (text_layout, |
| 998 | sizeof (tags) / sizeof (tags[0]), | 1068 | sizeof (tags) / sizeof (tags[0]), |
| 999 | tags, sizes, values); | 1069 | tags, sizes, values); |
| @@ -1344,7 +1414,7 @@ mac_draw_image_string_cg (f, gc, x, y, buf, nchars, bg_width, overstrike_p) | |||
| 1344 | #endif | 1414 | #endif |
| 1345 | if (bg_width) | 1415 | if (bg_width) |
| 1346 | { | 1416 | { |
| 1347 | CG_SET_FILL_COLOR (context, gc->xgcv.background); | 1417 | CG_SET_FILL_COLOR_WITH_GC_BACKGROUND (context, gc); |
| 1348 | CGContextFillRect | 1418 | CGContextFillRect |
| 1349 | (context, | 1419 | (context, |
| 1350 | CGRectMake (gx, y - FONT_BASE (GC_FONT (gc)), | 1420 | CGRectMake (gx, y - FONT_BASE (GC_FONT (gc)), |
| @@ -1355,7 +1425,7 @@ mac_draw_image_string_cg (f, gc, x, y, buf, nchars, bg_width, overstrike_p) | |||
| 1355 | #if !USE_CG_DRAWING | 1425 | #if !USE_CG_DRAWING |
| 1356 | } | 1426 | } |
| 1357 | #endif | 1427 | #endif |
| 1358 | CG_SET_FILL_COLOR (context, gc->xgcv.foreground); | 1428 | CG_SET_FILL_COLOR_WITH_GC_FOREGROUND (context, gc); |
| 1359 | CGContextSetFont (context, GC_FONT (gc)->cg_font); | 1429 | CGContextSetFont (context, GC_FONT (gc)->cg_font); |
| 1360 | CGContextSetFontSize (context, GC_FONT (gc)->mac_fontsize); | 1430 | CGContextSetFontSize (context, GC_FONT (gc)->mac_fontsize); |
| 1361 | if (GC_FONT (gc)->mac_fontsize <= cg_text_anti_aliasing_threshold) | 1431 | if (GC_FONT (gc)->mac_fontsize <= cg_text_anti_aliasing_threshold) |
| @@ -1567,6 +1637,16 @@ XCreateGC (display, window, mask, xgcv) | |||
| 1567 | GC gc = xmalloc (sizeof (*gc)); | 1637 | GC gc = xmalloc (sizeof (*gc)); |
| 1568 | 1638 | ||
| 1569 | bzero (gc, sizeof (*gc)); | 1639 | bzero (gc, sizeof (*gc)); |
| 1640 | #if USE_CG_DRAWING && MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 | ||
| 1641 | #if MAC_OS_X_VERSION_MIN_REQUIRED == 1020 | ||
| 1642 | if (CGColorGetTypeID != NULL) | ||
| 1643 | #endif | ||
| 1644 | { | ||
| 1645 | gc->cg_fore_color = gc->cg_back_color = mac_cg_color_black; | ||
| 1646 | CGColorRetain (gc->cg_fore_color); | ||
| 1647 | CGColorRetain (gc->cg_back_color); | ||
| 1648 | } | ||
| 1649 | #endif | ||
| 1570 | XChangeGC (display, gc, mask, xgcv); | 1650 | XChangeGC (display, gc, mask, xgcv); |
| 1571 | 1651 | ||
| 1572 | return gc; | 1652 | return gc; |
| @@ -1582,6 +1662,10 @@ XFreeGC (display, gc) | |||
| 1582 | { | 1662 | { |
| 1583 | if (gc->clip_region) | 1663 | if (gc->clip_region) |
| 1584 | DisposeRgn (gc->clip_region); | 1664 | DisposeRgn (gc->clip_region); |
| 1665 | #if USE_CG_DRAWING && MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 | ||
| 1666 | CGColorRelease (gc->cg_fore_color); | ||
| 1667 | CGColorRelease (gc->cg_back_color); | ||
| 1668 | #endif | ||
| 1585 | xfree (gc); | 1669 | xfree (gc); |
| 1586 | } | 1670 | } |
| 1587 | 1671 | ||
| @@ -1618,6 +1702,29 @@ XSetForeground (display, gc, color) | |||
| 1618 | gc->fore_color.red = RED16_FROM_ULONG (color); | 1702 | gc->fore_color.red = RED16_FROM_ULONG (color); |
| 1619 | gc->fore_color.green = GREEN16_FROM_ULONG (color); | 1703 | gc->fore_color.green = GREEN16_FROM_ULONG (color); |
| 1620 | gc->fore_color.blue = BLUE16_FROM_ULONG (color); | 1704 | gc->fore_color.blue = BLUE16_FROM_ULONG (color); |
| 1705 | #if USE_CG_DRAWING && MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 | ||
| 1706 | #if MAC_OS_X_VERSION_MIN_REQUIRED == 1020 | ||
| 1707 | if (CGColorGetTypeID != NULL) | ||
| 1708 | #endif | ||
| 1709 | { | ||
| 1710 | CGColorRelease (gc->cg_fore_color); | ||
| 1711 | if (color == 0) | ||
| 1712 | { | ||
| 1713 | gc->cg_fore_color = mac_cg_color_black; | ||
| 1714 | CGColorRetain (gc->cg_fore_color); | ||
| 1715 | } | ||
| 1716 | else | ||
| 1717 | { | ||
| 1718 | float rgba[4]; | ||
| 1719 | |||
| 1720 | rgba[0] = gc->fore_color.red / 65535.0f; | ||
| 1721 | rgba[1] = gc->fore_color.green / 65535.0f; | ||
| 1722 | rgba[2] = gc->fore_color.blue / 65535.0f; | ||
| 1723 | rgba[3] = 1.0f; | ||
| 1724 | gc->cg_fore_color = CGColorCreate (mac_cg_color_space_rgb, rgba); | ||
| 1725 | } | ||
| 1726 | } | ||
| 1727 | #endif | ||
| 1621 | } | 1728 | } |
| 1622 | } | 1729 | } |
| 1623 | 1730 | ||
| @@ -1636,6 +1743,29 @@ XSetBackground (display, gc, color) | |||
| 1636 | gc->back_color.red = RED16_FROM_ULONG (color); | 1743 | gc->back_color.red = RED16_FROM_ULONG (color); |
| 1637 | gc->back_color.green = GREEN16_FROM_ULONG (color); | 1744 | gc->back_color.green = GREEN16_FROM_ULONG (color); |
| 1638 | gc->back_color.blue = BLUE16_FROM_ULONG (color); | 1745 | gc->back_color.blue = BLUE16_FROM_ULONG (color); |
| 1746 | #if USE_CG_DRAWING && MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 | ||
| 1747 | #if MAC_OS_X_VERSION_MIN_REQUIRED == 1020 | ||
| 1748 | if (CGColorGetTypeID != NULL) | ||
| 1749 | #endif | ||
| 1750 | { | ||
| 1751 | CGColorRelease (gc->cg_back_color); | ||
| 1752 | if (color == 0) | ||
| 1753 | { | ||
| 1754 | gc->cg_back_color = mac_cg_color_black; | ||
| 1755 | CGColorRetain (gc->cg_back_color); | ||
| 1756 | } | ||
| 1757 | else | ||
| 1758 | { | ||
| 1759 | float rgba[4]; | ||
| 1760 | |||
| 1761 | rgba[0] = gc->back_color.red / 65535.0f; | ||
| 1762 | rgba[1] = gc->back_color.green / 65535.0f; | ||
| 1763 | rgba[2] = gc->back_color.blue / 65535.0f; | ||
| 1764 | rgba[3] = 1.0f; | ||
| 1765 | gc->cg_back_color = CGColorCreate (mac_cg_color_space_rgb, rgba); | ||
| 1766 | } | ||
| 1767 | } | ||
| 1768 | #endif | ||
| 1639 | } | 1769 | } |
| 1640 | } | 1770 | } |
| 1641 | 1771 | ||
| @@ -8738,14 +8868,18 @@ extern void mac_find_apple_event_spec P_ ((AEEventClass, AEEventID, | |||
| 8738 | extern OSErr init_coercion_handler P_ ((void)); | 8868 | extern OSErr init_coercion_handler P_ ((void)); |
| 8739 | 8869 | ||
| 8740 | /* Drag and Drop */ | 8870 | /* Drag and Drop */ |
| 8741 | OSErr install_drag_handler P_ ((WindowRef)); | 8871 | extern OSErr install_drag_handler P_ ((WindowRef)); |
| 8742 | void remove_drag_handler P_ ((WindowRef)); | 8872 | extern void remove_drag_handler P_ ((WindowRef)); |
| 8873 | |||
| 8874 | /* Showing help echo string during menu tracking */ | ||
| 8875 | extern OSStatus install_menu_target_item_handler P_ ((WindowPtr)); | ||
| 8743 | 8876 | ||
| 8744 | #if USE_CARBON_EVENTS | 8877 | #if USE_CARBON_EVENTS |
| 8745 | #ifdef MAC_OSX | 8878 | #ifdef MAC_OSX |
| 8746 | extern void init_service_handler (); | 8879 | extern void init_service_handler (); |
| 8747 | static Lisp_Object Qservice, Qpaste, Qperform; | 8880 | static Lisp_Object Qservice, Qpaste, Qperform; |
| 8748 | #endif | 8881 | #endif |
| 8882 | |||
| 8749 | /* Window Event Handler */ | 8883 | /* Window Event Handler */ |
| 8750 | static pascal OSStatus mac_handle_window_event (EventHandlerCallRef, | 8884 | static pascal OSStatus mac_handle_window_event (EventHandlerCallRef, |
| 8751 | EventRef, void *); | 8885 | EventRef, void *); |
| @@ -10168,6 +10302,8 @@ install_window_handler (window) | |||
| 10168 | #endif | 10302 | #endif |
| 10169 | if (err == noErr) | 10303 | if (err == noErr) |
| 10170 | err = install_drag_handler (window); | 10304 | err = install_drag_handler (window); |
| 10305 | if (err == noErr) | ||
| 10306 | err = install_menu_target_item_handler (window); | ||
| 10171 | 10307 | ||
| 10172 | return err; | 10308 | return err; |
| 10173 | } | 10309 | } |
| @@ -10215,7 +10351,7 @@ main (void) | |||
| 10215 | 10351 | ||
| 10216 | #if __MWERKS__ | 10352 | #if __MWERKS__ |
| 10217 | /* set creator and type for files created by MSL */ | 10353 | /* set creator and type for files created by MSL */ |
| 10218 | _fcreator = 'EMAx'; | 10354 | _fcreator = MAC_EMACS_CREATOR_CODE; |
| 10219 | _ftype = 'TEXT'; | 10355 | _ftype = 'TEXT'; |
| 10220 | #endif | 10356 | #endif |
| 10221 | 10357 | ||
| @@ -11691,6 +11827,8 @@ mac_initialize () | |||
| 11691 | #endif | 11827 | #endif |
| 11692 | 11828 | ||
| 11693 | #if USE_CG_DRAWING | 11829 | #if USE_CG_DRAWING |
| 11830 | init_cg_color (); | ||
| 11831 | |||
| 11694 | mac_init_fringe (); | 11832 | mac_init_fringe (); |
| 11695 | #endif | 11833 | #endif |
| 11696 | 11834 | ||