aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorYAMAMOTO Mitsuharu2008-04-19 01:25:06 +0000
committerYAMAMOTO Mitsuharu2008-04-19 01:25:06 +0000
commit834263b66b4c0c45c7af133391fb905ff41fdf0a (patch)
tree5018aa0687fae2f6c568b122d0e3bb8d4d0072b3 /src
parent15364c8fb7286984e2b18e927f8957a63107129e (diff)
downloademacs-834263b66b4c0c45c7af133391fb905ff41fdf0a.tar.gz
emacs-834263b66b4c0c45c7af133391fb905ff41fdf0a.zip
(mac_draw_image_string_atsui) [MAC_OSX]: Use CGFloat
instead of float. (mac_draw_image_string_cg) [USE_CG_TEXT_DRAWING]: Likewise. (init_cg_color, mac_draw_line, mac_draw_cg_image, XSetForeground) (XSetBackground) [USE_CG_DRAWING]: Likewise. (mac_draw_image_string_atsui) [MAC_OSX]: Use mac_rect_make instead of CGRectMake. (mac_draw_image_string_cg) [USE_CG_TEXT_DRAWING]: Likewise. (mac_erase_rectangle, mac_draw_cg_image, mac_fill_rectangle) (mac_set_clip_rectangles) [USE_CG_DRAWING]: Likewise. (XCreatePixmap, XCreatePixmapFromBitmapData): Use Window instead of WindowRef in argument type. (XCreatePixmap) [!MAC_OS8]: Don't call SetPortWindowPort. (mac_invert_rectangle): Use CGContextSetBlendMode if available. (mac_set_clip_rectangles, mac_reset_clip_rectangles): Take argument F instead of DISPLAY. All uses changed. (mac_handle_size_change): Don't call SET_FRAME_GARBAGED. (x_calc_absolute_position): Simplify so as not to use FRAME_PIXEL_WIDTH/FRAME_PIXEL_HEIGHT. (Vmac_ts_script_language_on_focus, saved_ts_script_language_on_focus) [USE_MAC_TSM]: Make variables static. (mac_store_event_ref_as_apple_event) [TARGET_API_MAC_CARBON]: Don't use create_apple_event_from_event_ref. Use mac_event_parameters_to_lisp.
Diffstat (limited to 'src')
-rw-r--r--src/macterm.c167
1 files changed, 94 insertions, 73 deletions
diff --git a/src/macterm.c b/src/macterm.c
index a043e5a4860..2a8142938a9 100644
--- a/src/macterm.c
+++ b/src/macterm.c
@@ -332,7 +332,7 @@ init_cg_color ()
332 if (CGColorGetTypeID != NULL) 332 if (CGColorGetTypeID != NULL)
333#endif 333#endif
334 { 334 {
335 float rgba[] = {0.0f, 0.0f, 0.0f, 1.0f}; 335 CGFloat rgba[] = {0.0f, 0.0f, 0.0f, 1.0f};
336 336
337 mac_cg_color_black = CGColorCreate (mac_cg_color_space_rgb, rgba); 337 mac_cg_color_black = CGColorCreate (mac_cg_color_space_rgb, rgba);
338 } 338 }
@@ -352,7 +352,7 @@ mac_draw_line (f, gc, x1, y1, x2, y2)
352{ 352{
353#if USE_CG_DRAWING 353#if USE_CG_DRAWING
354 CGContextRef context; 354 CGContextRef context;
355 float gx1 = x1, gy1 = y1, gx2 = x2, gy2 = y2; 355 CGFloat gx1 = x1, gy1 = y1, gx2 = x2, gy2 = y2;
356 356
357 if (y1 != y2) 357 if (y1 != y2)
358 gx1 += 0.5f, gx2 += 0.5f; 358 gx1 += 0.5f, gx2 += 0.5f;
@@ -445,7 +445,7 @@ mac_erase_rectangle (f, gc, x, y, width, height)
445 445
446 context = mac_begin_cg_clip (f, gc); 446 context = mac_begin_cg_clip (f, gc);
447 CG_SET_FILL_COLOR_WITH_GC_BACKGROUND (context, gc); 447 CG_SET_FILL_COLOR_WITH_GC_BACKGROUND (context, gc);
448 CGContextFillRect (context, CGRectMake (x, y, width, height)); 448 CGContextFillRect (context, mac_rect_make (f, x, y, width, height));
449 mac_end_cg_clip (f); 449 mac_end_cg_clip (f);
450 } 450 }
451#else 451#else
@@ -523,8 +523,8 @@ mac_draw_cg_image (image, f, gc, src_x, src_y, width, height,
523 int dest_x, dest_y, overlay_p; 523 int dest_x, dest_y, overlay_p;
524{ 524{
525 CGContextRef context; 525 CGContextRef context;
526 float port_height = FRAME_PIXEL_HEIGHT (f); 526 CGFloat port_height = FRAME_PIXEL_HEIGHT (f);
527 CGRect dest_rect = CGRectMake (dest_x, dest_y, width, height); 527 CGRect dest_rect = mac_rect_make (f, dest_x, dest_y, width, height);
528 528
529 context = mac_begin_cg_clip (f, gc); 529 context = mac_begin_cg_clip (f, gc);
530 if (!overlay_p) 530 if (!overlay_p)
@@ -538,11 +538,11 @@ mac_draw_cg_image (image, f, gc, src_x, src_y, width, height,
538 if (CGImageIsMask (image)) 538 if (CGImageIsMask (image))
539 CG_SET_FILL_COLOR_WITH_GC_FOREGROUND (context, gc); 539 CG_SET_FILL_COLOR_WITH_GC_FOREGROUND (context, gc);
540 CGContextDrawImage (context, 540 CGContextDrawImage (context,
541 CGRectMake (dest_x - src_x, 541 mac_rect_make (f, dest_x - src_x,
542 port_height - (dest_y - src_y 542 port_height - (dest_y - src_y
543 + CGImageGetHeight (image)), 543 + CGImageGetHeight (image)),
544 CGImageGetWidth (image), 544 CGImageGetWidth (image),
545 CGImageGetHeight (image)), 545 CGImageGetHeight (image)),
546 image); 546 image);
547 mac_end_cg_clip (f); 547 mac_end_cg_clip (f);
548} 548}
@@ -635,7 +635,7 @@ mac_free_bitmap (bitmap)
635Pixmap 635Pixmap
636XCreatePixmap (display, w, width, height, depth) 636XCreatePixmap (display, w, width, height, depth)
637 Display *display; 637 Display *display;
638 WindowRef w; 638 Window w;
639 unsigned int width, height; 639 unsigned int width, height;
640 unsigned int depth; 640 unsigned int depth;
641{ 641{
@@ -643,8 +643,9 @@ XCreatePixmap (display, w, width, height, depth)
643 Rect r; 643 Rect r;
644 QDErr err; 644 QDErr err;
645 645
646#ifdef MAC_OS8
646 SetPortWindowPort (w); 647 SetPortWindowPort (w);
647 648#endif
648 SetRect (&r, 0, 0, width, height); 649 SetRect (&r, 0, 0, width, height);
649#if !defined (WORDS_BIG_ENDIAN) && USE_CG_DRAWING 650#if !defined (WORDS_BIG_ENDIAN) && USE_CG_DRAWING
650 if (depth == 1) 651 if (depth == 1)
@@ -664,7 +665,7 @@ XCreatePixmap (display, w, width, height, depth)
664Pixmap 665Pixmap
665XCreatePixmapFromBitmapData (display, w, data, width, height, fg, bg, depth) 666XCreatePixmapFromBitmapData (display, w, data, width, height, fg, bg, depth)
666 Display *display; 667 Display *display;
667 WindowRef w; 668 Window w;
668 char *data; 669 char *data;
669 unsigned int width, height; 670 unsigned int width, height;
670 unsigned long fg, bg; 671 unsigned long fg, bg;
@@ -729,7 +730,7 @@ mac_fill_rectangle (f, gc, x, y, width, height)
729 730
730 context = mac_begin_cg_clip (f, gc); 731 context = mac_begin_cg_clip (f, gc);
731 CG_SET_FILL_COLOR_WITH_GC_FOREGROUND (context, gc); 732 CG_SET_FILL_COLOR_WITH_GC_FOREGROUND (context, gc);
732 CGContextFillRect (context, CGRectMake (x, y, width, height)); 733 CGContextFillRect (context, mac_rect_make (f, x, y, width, height));
733 mac_end_cg_clip (f); 734 mac_end_cg_clip (f);
734#else 735#else
735 Rect r; 736 Rect r;
@@ -778,12 +779,33 @@ mac_invert_rectangle (f, x, y, width, height)
778 int x, y; 779 int x, y;
779 unsigned int width, height; 780 unsigned int width, height;
780{ 781{
781 Rect r; 782#if USE_CG_DRAWING && MAC_OS_X_VERSION_MAX_ALLOWED >= 1040
783#if MAC_OS_X_VERSION_MIN_REQUIRED < 1040 && MAC_OS_X_VERSION_MIN_REQUIRED >= 1020
784 if (CGContextSetBlendMode != NULL)
785#endif
786 {
787 CGContextRef context;
782 788
783 mac_begin_clip (f, NULL); 789 context = mac_begin_cg_clip (f, NULL);
784 SetRect (&r, x, y, x + width, y + height); 790 CGContextSetRGBFillColor (context, 1.0f, 1.0f, 1.0f, 1.0f);
785 InvertRect (&r); 791 CGContextSetBlendMode (context, kCGBlendModeDifference);
786 mac_end_clip (f, NULL); 792 CGContextFillRect (context, mac_rect_make (f, x, y, width, height));
793 mac_end_cg_clip (f);
794 }
795#if MAC_OS_X_VERSION_MIN_REQUIRED < 1040 && MAC_OS_X_VERSION_MIN_REQUIRED >= 1020
796 else /* CGContextSetBlendMode == NULL */
797#endif
798#endif /* USE_CG_DRAWING && MAC_OS_X_VERSION_MAX_ALLOWED >= 1040 */
799#if !USE_CG_DRAWING || MAC_OS_X_VERSION_MAX_ALLOWED < 1040 || (MAC_OS_X_VERSION_MIN_REQUIRED < 1040 && MAC_OS_X_VERSION_MIN_REQUIRED >= 1020)
800 {
801 Rect r;
802
803 mac_begin_clip (f, NULL);
804 SetRect (&r, x, y, x + width, y + height);
805 InvertRect (&r);
806 mac_end_clip (f, NULL);
807 }
808#endif
787} 809}
788 810
789 811
@@ -905,7 +927,7 @@ mac_draw_image_string_atsui (f, gc, x, y, buf, nchars, bg_width,
905 else 927 else
906 { 928 {
907 static CGContextRef context; 929 static CGContextRef context;
908 float port_height = FRAME_PIXEL_HEIGHT (f); 930 CGFloat port_height = FRAME_PIXEL_HEIGHT (f);
909 static const ATSUAttributeTag tags[] = {kATSUCGContextTag}; 931 static const ATSUAttributeTag tags[] = {kATSUCGContextTag};
910 static const ByteCount sizes[] = {sizeof (CGContextRef)}; 932 static const ByteCount sizes[] = {sizeof (CGContextRef)};
911 static const ATSUAttributeValuePtr values[] = {&context}; 933 static const ATSUAttributeValuePtr values[] = {&context};
@@ -929,9 +951,10 @@ mac_draw_image_string_atsui (f, gc, x, y, buf, nchars, bg_width,
929 { 951 {
930 CG_SET_FILL_COLOR_WITH_GC_BACKGROUND (context, gc); 952 CG_SET_FILL_COLOR_WITH_GC_BACKGROUND (context, gc);
931 CGContextFillRect (context, 953 CGContextFillRect (context,
932 CGRectMake (x, y - FONT_BASE (GC_FONT (gc)), 954 mac_rect_make (f,
933 bg_width, 955 x, y - FONT_BASE (GC_FONT (gc)),
934 FONT_HEIGHT (GC_FONT (gc)))); 956 bg_width,
957 FONT_HEIGHT (GC_FONT (gc))));
935 } 958 }
936 CGContextScaleCTM (context, 1, -1); 959 CGContextScaleCTM (context, 1, -1);
937 CGContextTranslateCTM (context, 0, -port_height); 960 CGContextTranslateCTM (context, 0, -port_height);
@@ -1275,7 +1298,7 @@ mac_draw_image_string_cg (f, gc, x, y, buf, nchars, bg_width, overstrike_p)
1275 XChar2b *buf; 1298 XChar2b *buf;
1276 int nchars, bg_width, overstrike_p; 1299 int nchars, bg_width, overstrike_p;
1277{ 1300{
1278 float port_height, gx, gy; 1301 CGFloat port_height, gx, gy;
1279 int i; 1302 int i;
1280 CGContextRef context; 1303 CGContextRef context;
1281 CGGlyph *glyphs; 1304 CGGlyph *glyphs;
@@ -1317,8 +1340,8 @@ mac_draw_image_string_cg (f, gc, x, y, buf, nchars, bg_width, overstrike_p)
1317 CG_SET_FILL_COLOR_WITH_GC_BACKGROUND (context, gc); 1340 CG_SET_FILL_COLOR_WITH_GC_BACKGROUND (context, gc);
1318 CGContextFillRect 1341 CGContextFillRect
1319 (context, 1342 (context,
1320 CGRectMake (gx, y - FONT_BASE (GC_FONT (gc)), 1343 mac_rect_make (f, gx, y - FONT_BASE (GC_FONT (gc)),
1321 bg_width, FONT_HEIGHT (GC_FONT (gc)))); 1344 bg_width, FONT_HEIGHT (GC_FONT (gc))));
1322 } 1345 }
1323 CGContextScaleCTM (context, 1, -1); 1346 CGContextScaleCTM (context, 1, -1);
1324 CGContextTranslateCTM (context, 0, -port_height); 1347 CGContextTranslateCTM (context, 0, -port_height);
@@ -1613,7 +1636,7 @@ XSetForeground (display, gc, color)
1613 } 1636 }
1614 else 1637 else
1615 { 1638 {
1616 float rgba[4]; 1639 CGFloat rgba[4];
1617 1640
1618 rgba[0] = gc->fore_color.red / 65535.0f; 1641 rgba[0] = gc->fore_color.red / 65535.0f;
1619 rgba[1] = gc->fore_color.green / 65535.0f; 1642 rgba[1] = gc->fore_color.green / 65535.0f;
@@ -1654,7 +1677,7 @@ XSetBackground (display, gc, color)
1654 } 1677 }
1655 else 1678 else
1656 { 1679 {
1657 float rgba[4]; 1680 CGFloat rgba[4];
1658 1681
1659 rgba[0] = gc->back_color.red / 65535.0f; 1682 rgba[0] = gc->back_color.red / 65535.0f;
1660 rgba[1] = gc->back_color.green / 65535.0f; 1683 rgba[1] = gc->back_color.green / 65535.0f;
@@ -1683,8 +1706,8 @@ XSetFont (display, gc, font)
1683/* Mac replacement for XSetClipRectangles. */ 1706/* Mac replacement for XSetClipRectangles. */
1684 1707
1685static void 1708static void
1686mac_set_clip_rectangles (display, gc, rectangles, n) 1709mac_set_clip_rectangles (f, gc, rectangles, n)
1687 Display *display; 1710 struct frame *f;
1688 GC gc; 1711 GC gc;
1689 Rect *rectangles; 1712 Rect *rectangles;
1690 int n; 1713 int n;
@@ -1716,9 +1739,9 @@ mac_set_clip_rectangles (display, gc, rectangles, n)
1716 { 1739 {
1717 Rect *rect = rectangles + i; 1740 Rect *rect = rectangles + i;
1718 1741
1719 gc->clip_rects[i] = CGRectMake (rect->left, rect->top, 1742 gc->clip_rects[i] = mac_rect_make (f, rect->left, rect->top,
1720 rect->right - rect->left, 1743 rect->right - rect->left,
1721 rect->bottom - rect->top); 1744 rect->bottom - rect->top);
1722 } 1745 }
1723#endif 1746#endif
1724} 1747}
@@ -1727,8 +1750,8 @@ mac_set_clip_rectangles (display, gc, rectangles, n)
1727/* Mac replacement for XSetClipMask. */ 1750/* Mac replacement for XSetClipMask. */
1728 1751
1729static INLINE void 1752static INLINE void
1730mac_reset_clip_rectangles (display, gc) 1753mac_reset_clip_rectangles (f, gc)
1731 Display *display; 1754 struct frame *f;
1732 GC gc; 1755 GC gc;
1733{ 1756{
1734 gc->n_clip_rects = 0; 1757 gc->n_clip_rects = 0;
@@ -2136,7 +2159,7 @@ x_draw_fringe_bitmap (w, row, p)
2136 XSetForeground (display, face->gc, gcv.foreground); 2159 XSetForeground (display, face->gc, gcv.foreground);
2137 } 2160 }
2138 2161
2139 mac_reset_clip_rectangles (display, face->gc); 2162 mac_reset_clip_rectangles (f, face->gc);
2140} 2163}
2141 2164
2142#if USE_CG_DRAWING 2165#if USE_CG_DRAWING
@@ -2650,7 +2673,7 @@ x_set_glyph_string_clipping (s)
2650 int n; 2673 int n;
2651 2674
2652 n = get_glyph_string_clip_rects (s, rects, MAX_CLIP_RECTS); 2675 n = get_glyph_string_clip_rects (s, rects, MAX_CLIP_RECTS);
2653 mac_set_clip_rectangles (s->display, s->gc, rects, n); 2676 mac_set_clip_rectangles (s->f, s->gc, rects, n);
2654} 2677}
2655 2678
2656 2679
@@ -3239,7 +3262,7 @@ x_draw_relief_rect (f, left_x, top_y, right_x, bottom_y, width,
3239 gc = f->output_data.mac->white_relief.gc; 3262 gc = f->output_data.mac->white_relief.gc;
3240 else 3263 else
3241 gc = f->output_data.mac->black_relief.gc; 3264 gc = f->output_data.mac->black_relief.gc;
3242 mac_set_clip_rectangles (dpy, gc, clip_rect, 1); 3265 mac_set_clip_rectangles (f, gc, clip_rect, 1);
3243 3266
3244 /* Top. */ 3267 /* Top. */
3245 if (top_p) 3268 if (top_p)
@@ -3254,12 +3277,12 @@ x_draw_relief_rect (f, left_x, top_y, right_x, bottom_y, width,
3254 mac_draw_line (f, gc, 3277 mac_draw_line (f, gc,
3255 left_x + i, top_y + i, left_x + i, bottom_y - i + 1); 3278 left_x + i, top_y + i, left_x + i, bottom_y - i + 1);
3256 3279
3257 mac_reset_clip_rectangles (dpy, gc); 3280 mac_reset_clip_rectangles (f, gc);
3258 if (raised_p) 3281 if (raised_p)
3259 gc = f->output_data.mac->black_relief.gc; 3282 gc = f->output_data.mac->black_relief.gc;
3260 else 3283 else
3261 gc = f->output_data.mac->white_relief.gc; 3284 gc = f->output_data.mac->white_relief.gc;
3262 mac_set_clip_rectangles (dpy, gc, clip_rect, 1); 3285 mac_set_clip_rectangles (f, gc, clip_rect, 1);
3263 3286
3264 /* Bottom. */ 3287 /* Bottom. */
3265 if (bot_p) 3288 if (bot_p)
@@ -3274,7 +3297,7 @@ x_draw_relief_rect (f, left_x, top_y, right_x, bottom_y, width,
3274 mac_draw_line (f, gc, 3297 mac_draw_line (f, gc,
3275 right_x - i, top_y + i + 1, right_x - i, bottom_y - i); 3298 right_x - i, top_y + i + 1, right_x - i, bottom_y - i);
3276 3299
3277 mac_reset_clip_rectangles (dpy, gc); 3300 mac_reset_clip_rectangles (f, gc);
3278} 3301}
3279 3302
3280 3303
@@ -3296,7 +3319,7 @@ x_draw_box_rect (s, left_x, top_y, right_x, bottom_y, width,
3296 3319
3297 XGetGCValues (s->display, s->gc, GCForeground, &xgcv); 3320 XGetGCValues (s->display, s->gc, GCForeground, &xgcv);
3298 XSetForeground (s->display, s->gc, s->face->box_color); 3321 XSetForeground (s->display, s->gc, s->face->box_color);
3299 mac_set_clip_rectangles (s->display, s->gc, clip_rect, 1); 3322 mac_set_clip_rectangles (s->f, s->gc, clip_rect, 1);
3300 3323
3301 /* Top. */ 3324 /* Top. */
3302 mac_fill_rectangle (s->f, s->gc, left_x, top_y, 3325 mac_fill_rectangle (s->f, s->gc, left_x, top_y,
@@ -3317,7 +3340,7 @@ x_draw_box_rect (s, left_x, top_y, right_x, bottom_y, width,
3317 top_y, width, bottom_y - top_y + 1); 3340 top_y, width, bottom_y - top_y + 1);
3318 3341
3319 XSetForeground (s->display, s->gc, xgcv.foreground); 3342 XSetForeground (s->display, s->gc, xgcv.foreground);
3320 mac_reset_clip_rectangles (s->display, s->gc); 3343 mac_reset_clip_rectangles (s->f, s->gc);
3321} 3344}
3322 3345
3323 3346
@@ -3626,7 +3649,7 @@ x_draw_stretch_glyph_string (s)
3626 gc = s->face->gc; 3649 gc = s->face->gc;
3627 3650
3628 get_glyph_string_clip_rect (s, &r); 3651 get_glyph_string_clip_rect (s, &r);
3629 mac_set_clip_rectangles (s->display, gc, &r, 1); 3652 mac_set_clip_rectangles (s->f, gc, &r, 1);
3630 3653
3631#if 0 /* MAC_TODO: stipple */ 3654#if 0 /* MAC_TODO: stipple */
3632 if (s->face->stipple) 3655 if (s->face->stipple)
@@ -3826,7 +3849,7 @@ x_draw_glyph_string (s)
3826 } 3849 }
3827 3850
3828 /* Reset clipping. */ 3851 /* Reset clipping. */
3829 mac_reset_clip_rectangles (s->display, s->gc); 3852 mac_reset_clip_rectangles (s->f, s->gc);
3830} 3853}
3831 3854
3832/* Shift display to make room for inserted glyphs. */ 3855/* Shift display to make room for inserted glyphs. */
@@ -5008,7 +5031,7 @@ x_clip_to_row (w, row, area, gc)
5008 clip_rect.right = clip_rect.left + window_width; 5031 clip_rect.right = clip_rect.left + window_width;
5009 clip_rect.bottom = clip_rect.top + row->visible_height; 5032 clip_rect.bottom = clip_rect.top + row->visible_height;
5010 5033
5011 mac_set_clip_rectangles (FRAME_MAC_DISPLAY (f), gc, &clip_rect, 1); 5034 mac_set_clip_rectangles (f, gc, &clip_rect, 1);
5012} 5035}
5013 5036
5014 5037
@@ -5050,7 +5073,7 @@ x_draw_hollow_cursor (w, row)
5050 /* Set clipping, draw the rectangle, and reset clipping again. */ 5073 /* Set clipping, draw the rectangle, and reset clipping again. */
5051 x_clip_to_row (w, row, TEXT_AREA, gc); 5074 x_clip_to_row (w, row, TEXT_AREA, gc);
5052 mac_draw_rectangle (f, gc, x, y, wd, h - 1); 5075 mac_draw_rectangle (f, gc, x, y, wd, h - 1);
5053 mac_reset_clip_rectangles (dpy, gc); 5076 mac_reset_clip_rectangles (f, gc);
5054} 5077}
5055 5078
5056 5079
@@ -5134,7 +5157,7 @@ x_draw_bar_cursor (w, row, width, kind)
5134 cursor_glyph->pixel_width, 5157 cursor_glyph->pixel_width,
5135 width); 5158 width);
5136 5159
5137 mac_reset_clip_rectangles (dpy, gc); 5160 mac_reset_clip_rectangles (f, gc);
5138 } 5161 }
5139} 5162}
5140 5163
@@ -5428,7 +5451,6 @@ mac_handle_size_change (f, pixelwidth, pixelheight)
5428 change_frame_size (f, rows, cols, 0, 1, 0); 5451 change_frame_size (f, rows, cols, 0, 1, 0);
5429 FRAME_PIXEL_WIDTH (f) = pixelwidth; 5452 FRAME_PIXEL_WIDTH (f) = pixelwidth;
5430 FRAME_PIXEL_HEIGHT (f) = pixelheight; 5453 FRAME_PIXEL_HEIGHT (f) = pixelheight;
5431 SET_FRAME_GARBAGED (f);
5432 5454
5433 /* If cursor was outside the new size, mark it as off. */ 5455 /* If cursor was outside the new size, mark it as off. */
5434 mark_window_cursors_off (XWINDOW (f->root_window)); 5456 mark_window_cursors_off (XWINDOW (f->root_window));
@@ -5454,7 +5476,6 @@ void
5454x_calc_absolute_position (f) 5476x_calc_absolute_position (f)
5455 struct frame *f; 5477 struct frame *f;
5456{ 5478{
5457 int width_diff = 0, height_diff = 0;
5458 int flags = f->size_hint_flags; 5479 int flags = f->size_hint_flags;
5459 Rect inner, outer; 5480 Rect inner, outer;
5460 5481
@@ -5469,22 +5490,15 @@ x_calc_absolute_position (f)
5469 mac_get_window_bounds (f, &inner, &outer); 5490 mac_get_window_bounds (f, &inner, &outer);
5470 UNBLOCK_INPUT; 5491 UNBLOCK_INPUT;
5471 5492
5472 width_diff = (outer.right - outer.left) - (inner.right - inner.left);
5473 height_diff = (outer.bottom - outer.top) - (inner.bottom - inner.top);
5474
5475 /* Treat negative positions as relative to the leftmost bottommost 5493 /* Treat negative positions as relative to the leftmost bottommost
5476 position that fits on the screen. */ 5494 position that fits on the screen. */
5477 if (flags & XNegative) 5495 if (flags & XNegative)
5478 f->left_pos = (FRAME_MAC_DISPLAY_INFO (f)->width 5496 f->left_pos += (FRAME_MAC_DISPLAY_INFO (f)->width
5479 - width_diff 5497 - (outer.right - outer.left));
5480 - FRAME_PIXEL_WIDTH (f)
5481 + f->left_pos);
5482 5498
5483 if (flags & YNegative) 5499 if (flags & YNegative)
5484 f->top_pos = (FRAME_MAC_DISPLAY_INFO (f)->height 5500 f->top_pos += (FRAME_MAC_DISPLAY_INFO (f)->height
5485 - height_diff 5501 - (outer.bottom - outer.top));
5486 - FRAME_PIXEL_HEIGHT (f)
5487 + f->top_pos);
5488 5502
5489 /* The left_pos and top_pos 5503 /* The left_pos and top_pos
5490 are now relative to the top and left screen edges, 5504 are now relative to the top and left screen edges,
@@ -8141,8 +8155,8 @@ Lisp_Object Qtoolbar_switch_mode;
8141Lisp_Object Qtext_input; 8155Lisp_Object Qtext_input;
8142Lisp_Object Qupdate_active_input_area, Qunicode_for_key_event; 8156Lisp_Object Qupdate_active_input_area, Qunicode_for_key_event;
8143Lisp_Object Vmac_ts_active_input_overlay; 8157Lisp_Object Vmac_ts_active_input_overlay;
8144Lisp_Object Vmac_ts_script_language_on_focus; 8158static Lisp_Object Vmac_ts_script_language_on_focus;
8145Lisp_Object saved_ts_script_language_on_focus; 8159static Lisp_Object saved_ts_script_language_on_focus;
8146static ScriptLanguageRecord saved_ts_language; 8160static ScriptLanguageRecord saved_ts_language;
8147static Component saved_ts_component; 8161static Component saved_ts_component;
8148#endif 8162#endif
@@ -8673,16 +8687,23 @@ mac_store_event_ref_as_apple_event (class, id, class_key, id_key,
8673 err = XINT (binding); 8687 err = XINT (binding);
8674 else 8688 else
8675 { 8689 {
8676 AppleEvent apple_event; 8690 struct input_event buf;
8677 err = create_apple_event_from_event_ref (event, num_params, 8691
8678 names, types, 8692 EVENT_INIT (buf);
8679 &apple_event); 8693
8680 if (err == noErr) 8694 buf.kind = MAC_APPLE_EVENT;
8681 { 8695 buf.x = class_key;
8682 mac_store_apple_event (class_key, id_key, &apple_event); 8696 buf.y = id_key;
8683 AEDisposeDesc (&apple_event); 8697 XSETFRAME (buf.frame_or_window,
8684 mac_wakeup_from_rne (); 8698 mac_focus_frame (&one_mac_display_info));
8685 } 8699 /* Now that Lisp object allocations are protected by
8700 BLOCK_INPUT, it is safe to use them during
8701 read_socket_hook. */
8702 buf.arg = Fcons (build_string ("aevt"),
8703 mac_event_parameters_to_lisp (event, num_params,
8704 names, types));
8705 kbd_buffer_store_event (&buf);
8706 mac_wakeup_from_rne ();
8686 } 8707 }
8687 } 8708 }
8688 8709