diff options
| author | Steven Tamm | 2004-11-30 05:57:27 +0000 |
|---|---|---|
| committer | Steven Tamm | 2004-11-30 05:57:27 +0000 |
| commit | fc7a70ccdaaf3dcd7f027c46fb5a6e0e9458fe91 (patch) | |
| tree | e80b40dc0ebbb644b95ef52bc6b7d3f6ce4f8482 /src | |
| parent | cdcf58d8eb7602b03aa7530bb533984ee976ac8f (diff) | |
| download | emacs-fc7a70ccdaaf3dcd7f027c46fb5a6e0e9458fe91.tar.gz emacs-fc7a70ccdaaf3dcd7f027c46fb5a6e0e9458fe91.zip | |
* keyboard.c: Don't undef SIGIO
* s/darwin.h (NO_SOCK_SIGIO): Define NO_SOCK_SIGIO on carbon
* Makefile.in (mac.o): Depend on blockinput.h and atimer.h.
(macfns.o): Don't depend on ccl.h.
* macfns.c (mac_frame_parm_handlers): Set handlers for
Qleft_fringe and Qright_fringe.
* macterm.c (mac_fill_rectangle_to_pixmap)
(mac_draw_rectangle_to_pixmap, mac_copy_area_to_pixmap)
(mac_copy_area_with_mask_to_pixmap, x_draw_image_foreground_1):
Put in #if 0.
(mac_scroll_area) [TARGET_API_MAC_CARBON]: Use ScrollWindowRect.
(x_flush) [TARGET_API_MAC_CARBON]: Don't traverse frames.
(XFlush) [TARGET_API_MAC_CARBON]: Define to an empty replacement.
(x_draw_glyph_string_background, x_draw_glyph_string_foreground)
[!MAC_OS8]: Added ifdef'd out code for os8. Don't use
XDrawImageString. Always draw background and foreground separately.
(x_draw_image_foreground): Use clipping instead of computing the
intersection rectangle.
(x_draw_image_glyph_string): Don't draw an image with mask to a
pixmap.
(x_redisplay_interface): Set flush_display_optional member to 0.
(XTread_socket): Correctly reset the TEConverter
object.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 26 | ||||
| -rw-r--r-- | src/Makefile.in | 4 | ||||
| -rw-r--r-- | src/keyboard.c | 2 | ||||
| -rw-r--r-- | src/macfns.c | 4 | ||||
| -rw-r--r-- | src/macterm.c | 218 | ||||
| -rw-r--r-- | src/s/darwin.h | 7 |
6 files changed, 163 insertions, 98 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index d7184689033..a743cc64049 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,29 @@ | |||
| 1 | 2004-11-30 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> | ||
| 2 | |||
| 3 | * keyboard.c: Don't undef SIGIO | ||
| 4 | * s/darwin.h (NO_SOCK_SIGIO): Define NO_SOCK_SIGIO on carbon | ||
| 5 | * Makefile.in (mac.o): Depend on blockinput.h and atimer.h. | ||
| 6 | (macfns.o): Don't depend on ccl.h. | ||
| 7 | * macfns.c (mac_frame_parm_handlers): Set handlers for | ||
| 8 | Qleft_fringe and Qright_fringe. | ||
| 9 | * macterm.c (mac_fill_rectangle_to_pixmap) | ||
| 10 | (mac_draw_rectangle_to_pixmap, mac_copy_area_to_pixmap) | ||
| 11 | (mac_copy_area_with_mask_to_pixmap, x_draw_image_foreground_1): | ||
| 12 | Put in #if 0. | ||
| 13 | (mac_scroll_area) [TARGET_API_MAC_CARBON]: Use ScrollWindowRect. | ||
| 14 | (x_flush) [TARGET_API_MAC_CARBON]: Don't traverse frames. | ||
| 15 | (XFlush) [TARGET_API_MAC_CARBON]: Define to an empty replacement. | ||
| 16 | (x_draw_glyph_string_background, x_draw_glyph_string_foreground) | ||
| 17 | [!MAC_OS8]: Added ifdef'd out code for os8. Don't use | ||
| 18 | XDrawImageString. Always draw background and foreground separately. | ||
| 19 | (x_draw_image_foreground): Use clipping instead of computing the | ||
| 20 | intersection rectangle. | ||
| 21 | (x_draw_image_glyph_string): Don't draw an image with mask to a | ||
| 22 | pixmap. | ||
| 23 | (x_redisplay_interface): Set flush_display_optional member to 0. | ||
| 24 | (XTread_socket): Correctly reset the TEConverter | ||
| 25 | object. | ||
| 26 | |||
| 1 | 2004-11-30 Kim F. Storm <storm@cua.dk> | 27 | 2004-11-30 Kim F. Storm <storm@cua.dk> |
| 2 | 28 | ||
| 3 | * lisp.h: New defines to enable buffer overrun checking. | 29 | * lisp.h: New defines to enable buffer overrun checking. |
diff --git a/src/Makefile.in b/src/Makefile.in index 3fd63fe5251..aed58290413 100644 --- a/src/Makefile.in +++ b/src/Makefile.in | |||
| @@ -1226,10 +1226,10 @@ abbrev.o buffer.o callint.o cmds.o dispnew.o editfns.o fileio.o frame.o \ | |||
| 1226 | fontset.o indent.o insdel.o keyboard.o macros.o minibuf.o msdos.o process.o \ | 1226 | fontset.o indent.o insdel.o keyboard.o macros.o minibuf.o msdos.o process.o \ |
| 1227 | scroll.o sysdep.o term.o widget.o window.o xdisp.o xfaces.o xfns.o xmenu.o \ | 1227 | scroll.o sysdep.o term.o widget.o window.o xdisp.o xfaces.o xfns.o xmenu.o \ |
| 1228 | xterm.o xselect.o sound.o: macgui.h | 1228 | xterm.o xselect.o sound.o: macgui.h |
| 1229 | mac.o: mac.c process.h sysselect.h systime.h $(config_h) | 1229 | mac.o: mac.c process.h sysselect.h blockinput.h atimer.h systime.h $(config_h) |
| 1230 | macfns.o: macfns.c charset.h macterm.h macgui.h frame.h window.h buffer.h \ | 1230 | macfns.o: macfns.c charset.h macterm.h macgui.h frame.h window.h buffer.h \ |
| 1231 | dispextern.h macgui.h fontset.h $(INTERVAL_SRC) keyboard.h blockinput.h \ | 1231 | dispextern.h macgui.h fontset.h $(INTERVAL_SRC) keyboard.h blockinput.h \ |
| 1232 | atimer.h systime.h epaths.h termhooks.h coding.h ccl.h systime.h $(config_h) | 1232 | atimer.h systime.h epaths.h termhooks.h coding.h systime.h $(config_h) |
| 1233 | macmenu.o: macmenu.c termhooks.h frame.h window.h dispextern.h macgui.h \ | 1233 | macmenu.o: macmenu.c termhooks.h frame.h window.h dispextern.h macgui.h \ |
| 1234 | keyboard.h blockinput.h atimer.h systime.h buffer.h macterm.h $(config_h) | 1234 | keyboard.h blockinput.h atimer.h systime.h buffer.h macterm.h $(config_h) |
| 1235 | macterm.o: blockinput.h atimer.h systime.h syssignal.h macterm.h macgui.h \ | 1235 | macterm.o: blockinput.h atimer.h systime.h syssignal.h macterm.h macgui.h \ |
diff --git a/src/keyboard.c b/src/keyboard.c index d96879a453f..4a5eb493b58 100644 --- a/src/keyboard.c +++ b/src/keyboard.c | |||
| @@ -607,7 +607,7 @@ int flow_control; | |||
| 607 | 607 | ||
| 608 | /* We are unable to use interrupts if FIONREAD is not available, | 608 | /* We are unable to use interrupts if FIONREAD is not available, |
| 609 | so flush SIGIO so we won't try. */ | 609 | so flush SIGIO so we won't try. */ |
| 610 | #if !defined (FIONREAD) || defined(HAVE_CARBON) | 610 | #if !defined (FIONREAD) |
| 611 | #ifdef SIGIO | 611 | #ifdef SIGIO |
| 612 | #undef SIGIO | 612 | #undef SIGIO |
| 613 | #endif | 613 | #endif |
diff --git a/src/macfns.c b/src/macfns.c index 401c7011fea..9220bdd2798 100644 --- a/src/macfns.c +++ b/src/macfns.c | |||
| @@ -4415,8 +4415,8 @@ frame_parm_handler mac_frame_parm_handlers[] = | |||
| 4415 | 0, /* MAC_TODO: x_set_scroll_bar_background, */ | 4415 | 0, /* MAC_TODO: x_set_scroll_bar_background, */ |
| 4416 | x_set_screen_gamma, | 4416 | x_set_screen_gamma, |
| 4417 | x_set_line_spacing, | 4417 | x_set_line_spacing, |
| 4418 | 0, /* MAC_TODO: x_set_fringe_width, */ | 4418 | x_set_fringe_width, |
| 4419 | 0, /* MAC_TODO: x_set_fringe_width, */ | 4419 | x_set_fringe_width, |
| 4420 | 0, /* x_set_wait_for_wm, */ | 4420 | 0, /* x_set_wait_for_wm, */ |
| 4421 | 0, /* MAC_TODO: x_set_fullscreen, */ | 4421 | 0, /* MAC_TODO: x_set_fullscreen, */ |
| 4422 | }; | 4422 | }; |
diff --git a/src/macterm.c b/src/macterm.c index f4f9235c846..4e3b0ae1b65 100644 --- a/src/macterm.c +++ b/src/macterm.c | |||
| @@ -567,7 +567,7 @@ XCreatePixmap (display, w, width, height, depth) | |||
| 567 | Display *display; /* not used */ | 567 | Display *display; /* not used */ |
| 568 | WindowPtr w; | 568 | WindowPtr w; |
| 569 | unsigned int width, height; | 569 | unsigned int width, height; |
| 570 | unsigned int depth; /* not used */ | 570 | unsigned int depth; |
| 571 | { | 571 | { |
| 572 | Pixmap pixmap; | 572 | Pixmap pixmap; |
| 573 | Rect r; | 573 | Rect r; |
| @@ -643,6 +643,7 @@ XFillRectangle (display, w, gc, x, y, width, height) | |||
| 643 | } | 643 | } |
| 644 | 644 | ||
| 645 | 645 | ||
| 646 | #if 0 /* TODO: figure out if we need to do this on Mac. */ | ||
| 646 | static void | 647 | static void |
| 647 | mac_fill_rectangle_to_pixmap (display, p, gc, x, y, width, height) | 648 | mac_fill_rectangle_to_pixmap (display, p, gc, x, y, width, height) |
| 648 | Display *display; | 649 | Display *display; |
| @@ -666,6 +667,7 @@ mac_fill_rectangle_to_pixmap (display, p, gc, x, y, width, height) | |||
| 666 | 667 | ||
| 667 | SetGWorld (old_port, old_gdh); | 668 | SetGWorld (old_port, old_gdh); |
| 668 | } | 669 | } |
| 670 | #endif | ||
| 669 | 671 | ||
| 670 | 672 | ||
| 671 | /* Mac replacement for XDrawRectangle: dest is a window. */ | 673 | /* Mac replacement for XDrawRectangle: dest is a window. */ |
| @@ -689,6 +691,7 @@ mac_draw_rectangle (display, w, gc, x, y, width, height) | |||
| 689 | } | 691 | } |
| 690 | 692 | ||
| 691 | 693 | ||
| 694 | #if 0 /* TODO: figure out if we need to do this on Mac. */ | ||
| 692 | /* Mac replacement for XDrawRectangle: dest is a Pixmap. */ | 695 | /* Mac replacement for XDrawRectangle: dest is a Pixmap. */ |
| 693 | 696 | ||
| 694 | static void | 697 | static void |
| @@ -714,6 +717,7 @@ mac_draw_rectangle_to_pixmap (display, p, gc, x, y, width, height) | |||
| 714 | 717 | ||
| 715 | SetGWorld (old_port, old_gdh); | 718 | SetGWorld (old_port, old_gdh); |
| 716 | } | 719 | } |
| 720 | #endif | ||
| 717 | 721 | ||
| 718 | 722 | ||
| 719 | static void | 723 | static void |
| @@ -908,24 +912,13 @@ mac_scroll_area (display, w, gc, src_x, src_y, width, height, dest_x, dest_y) | |||
| 908 | int dest_x, dest_y; | 912 | int dest_x, dest_y; |
| 909 | { | 913 | { |
| 910 | #if TARGET_API_MAC_CARBON | 914 | #if TARGET_API_MAC_CARBON |
| 911 | Rect gw_r, src_r, dest_r; | 915 | Rect src_r; |
| 916 | RgnHandle dummy = NewRgn (); /* For avoiding update events. */ | ||
| 912 | 917 | ||
| 913 | SetRect (&src_r, src_x, src_y, src_x + width, src_y + height); | 918 | SetRect (&src_r, src_x, src_y, src_x + width, src_y + height); |
| 914 | SetRect (&dest_r, dest_x, dest_y, dest_x + width, dest_y + height); | 919 | ScrollWindowRect (w, &src_r, dest_x - src_x, dest_y - src_y, |
| 915 | 920 | kScrollWindowNoOptions, dummy); | |
| 916 | SetPortWindowPort (w); | 921 | DisposeRgn (dummy); |
| 917 | |||
| 918 | ForeColor (blackColor); | ||
| 919 | BackColor (whiteColor); | ||
| 920 | |||
| 921 | LockPortBits (GetWindowPort (w)); | ||
| 922 | { | ||
| 923 | const BitMap *bitmap = GetPortBitMapForCopyBits (GetWindowPort (w)); | ||
| 924 | CopyBits (bitmap, bitmap, &src_r, &dest_r, srcCopy, 0); | ||
| 925 | } | ||
| 926 | UnlockPortBits (GetWindowPort (w)); | ||
| 927 | |||
| 928 | mac_set_colors (gc); | ||
| 929 | #else /* not TARGET_API_MAC_CARBON */ | 922 | #else /* not TARGET_API_MAC_CARBON */ |
| 930 | Rect src_r, dest_r; | 923 | Rect src_r, dest_r; |
| 931 | 924 | ||
| @@ -959,6 +952,7 @@ mac_scroll_area (display, w, gc, src_x, src_y, width, height, dest_x, dest_y) | |||
| 959 | } | 952 | } |
| 960 | 953 | ||
| 961 | 954 | ||
| 955 | #if 0 /* TODO: figure out if we need to do this on Mac. */ | ||
| 962 | /* Mac replacement for XCopyArea: dest must be Pixmap. */ | 956 | /* Mac replacement for XCopyArea: dest must be Pixmap. */ |
| 963 | 957 | ||
| 964 | static void | 958 | static void |
| @@ -1037,6 +1031,7 @@ mac_copy_area_with_mask_to_pixmap (display, src, mask, dest, gc, src_x, src_y, | |||
| 1037 | 1031 | ||
| 1038 | SetGWorld (old_port, old_gdh); | 1032 | SetGWorld (old_port, old_gdh); |
| 1039 | } | 1033 | } |
| 1034 | #endif | ||
| 1040 | 1035 | ||
| 1041 | 1036 | ||
| 1042 | /* Mac replacement for XChangeGC. */ | 1037 | /* Mac replacement for XChangeGC. */ |
| @@ -1131,40 +1126,32 @@ x_sync (f) | |||
| 1131 | } | 1126 | } |
| 1132 | 1127 | ||
| 1133 | 1128 | ||
| 1134 | /* Remove calls to XFlush by defining XFlush to an empty replacement. | ||
| 1135 | Calls to XFlush should be unnecessary because the X output buffer | ||
| 1136 | is flushed automatically as needed by calls to XPending, | ||
| 1137 | XNextEvent, or XWindowEvent according to the XFlush man page. | ||
| 1138 | XTread_socket calls XPending. Removing XFlush improves | ||
| 1139 | performance. */ | ||
| 1140 | |||
| 1141 | #if TARGET_API_MAC_CARBON | ||
| 1142 | #define XFlush(DISPLAY) QDFlushPortBuffer (GetQDGlobalsThePort (), NULL) | ||
| 1143 | #else | ||
| 1144 | #define XFlush(DISPLAY) (void) 0 | ||
| 1145 | #endif | ||
| 1146 | |||
| 1147 | /* Flush display of frame F, or of all frames if F is null. */ | 1129 | /* Flush display of frame F, or of all frames if F is null. */ |
| 1148 | 1130 | ||
| 1149 | void | 1131 | static void |
| 1150 | x_flush (f) | 1132 | x_flush (f) |
| 1151 | struct frame *f; | 1133 | struct frame *f; |
| 1152 | { | 1134 | { |
| 1153 | #if TARGET_API_MAC_CARBON | 1135 | #if TARGET_API_MAC_CARBON |
| 1154 | BLOCK_INPUT; | 1136 | BLOCK_INPUT; |
| 1155 | if (f == NULL) | 1137 | if (f) |
| 1156 | { | 1138 | QDFlushPortBuffer (GetWindowPort (FRAME_MAC_WINDOW (f)), NULL); |
| 1157 | Lisp_Object rest, frame; | 1139 | else |
| 1158 | FOR_EACH_FRAME (rest, frame) | 1140 | QDFlushPortBuffer (GetQDGlobalsThePort (), NULL); |
| 1159 | x_flush (XFRAME (frame)); | ||
| 1160 | } | ||
| 1161 | else if (FRAME_MAC_P (f)) | ||
| 1162 | XFlush (FRAME_MAC_DISPLAY (f)); | ||
| 1163 | UNBLOCK_INPUT; | 1141 | UNBLOCK_INPUT; |
| 1164 | #endif /* TARGET_API_MAC_CARBON */ | 1142 | #endif |
| 1165 | } | 1143 | } |
| 1166 | 1144 | ||
| 1167 | 1145 | ||
| 1146 | /* Remove calls to XFlush by defining XFlush to an empty replacement. | ||
| 1147 | Calls to XFlush should be unnecessary because the X output buffer | ||
| 1148 | is flushed automatically as needed by calls to XPending, | ||
| 1149 | XNextEvent, or XWindowEvent according to the XFlush man page. | ||
| 1150 | XTread_socket calls XPending. Removing XFlush improves | ||
| 1151 | performance. */ | ||
| 1152 | |||
| 1153 | #define XFlush(DISPLAY) (void) 0 | ||
| 1154 | |||
| 1168 | 1155 | ||
| 1169 | /* Return the struct mac_display_info corresponding to DPY. There's | 1156 | /* Return the struct mac_display_info corresponding to DPY. There's |
| 1170 | only one. */ | 1157 | only one. */ |
| @@ -1957,6 +1944,14 @@ x_clear_glyph_string_rect (s, x, y, w, h) | |||
| 1957 | } | 1944 | } |
| 1958 | 1945 | ||
| 1959 | 1946 | ||
| 1947 | /* We prefer not to use XDrawImageString (srcCopy text transfer mode) | ||
| 1948 | on Mac OS X because: | ||
| 1949 | - Screen is double-buffered. (In srcCopy mode, a text is drawn | ||
| 1950 | into an offscreen graphics world first. So performance gain | ||
| 1951 | cannot be expected.) | ||
| 1952 | - It lowers rendering quality. | ||
| 1953 | - Some fonts leave garbage on cursor movement. */ | ||
| 1954 | |||
| 1960 | /* Draw the background of glyph_string S. If S->background_filled_p | 1955 | /* Draw the background of glyph_string S. If S->background_filled_p |
| 1961 | is non-zero don't draw it. FORCE_P non-zero means draw the | 1956 | is non-zero don't draw it. FORCE_P non-zero means draw the |
| 1962 | background even if it wouldn't be drawn normally. This is used | 1957 | background even if it wouldn't be drawn normally. This is used |
| @@ -1988,10 +1983,12 @@ x_draw_glyph_string_background (s, force_p) | |||
| 1988 | } | 1983 | } |
| 1989 | else | 1984 | else |
| 1990 | #endif | 1985 | #endif |
| 1986 | #if 0 /* defined(MAC_OS8)*/ | ||
| 1991 | if (FONT_HEIGHT (s->font) < s->height - 2 * box_line_width | 1987 | if (FONT_HEIGHT (s->font) < s->height - 2 * box_line_width |
| 1992 | || s->font_not_found_p | 1988 | || s->font_not_found_p |
| 1993 | || s->extends_to_end_of_line_p | 1989 | || s->extends_to_end_of_line_p |
| 1994 | || force_p) | 1990 | || force_p) |
| 1991 | #endif | ||
| 1995 | { | 1992 | { |
| 1996 | x_clear_glyph_string_rect (s, s->x, s->y + box_line_width, | 1993 | x_clear_glyph_string_rect (s, s->x, s->y + box_line_width, |
| 1997 | s->background_width, | 1994 | s->background_width, |
| @@ -2044,6 +2041,7 @@ x_draw_glyph_string_foreground (s) | |||
| 2044 | for (i = 0; i < s->nchars; ++i) | 2041 | for (i = 0; i < s->nchars; ++i) |
| 2045 | char1b[i] = s->char2b[i].byte2; | 2042 | char1b[i] = s->char2b[i].byte2; |
| 2046 | 2043 | ||
| 2044 | #if 0 /* defined(MAC_OS8) */ | ||
| 2047 | /* Draw text with XDrawString if background has already been | 2045 | /* Draw text with XDrawString if background has already been |
| 2048 | filled. Otherwise, use XDrawImageString. (Note that | 2046 | filled. Otherwise, use XDrawImageString. (Note that |
| 2049 | XDrawImageString is usually faster than XDrawString.) Always | 2047 | XDrawImageString is usually faster than XDrawString.) Always |
| @@ -2051,6 +2049,7 @@ x_draw_glyph_string_foreground (s) | |||
| 2051 | no chance that characters under a box cursor are invisible. */ | 2049 | no chance that characters under a box cursor are invisible. */ |
| 2052 | if (s->for_overlaps_p | 2050 | if (s->for_overlaps_p |
| 2053 | || (s->background_filled_p && s->hl != DRAW_CURSOR)) | 2051 | || (s->background_filled_p && s->hl != DRAW_CURSOR)) |
| 2052 | #endif | ||
| 2054 | { | 2053 | { |
| 2055 | /* Draw characters with 16-bit or 8-bit functions. */ | 2054 | /* Draw characters with 16-bit or 8-bit functions. */ |
| 2056 | if (s->two_byte_p) | 2055 | if (s->two_byte_p) |
| @@ -2060,6 +2059,7 @@ x_draw_glyph_string_foreground (s) | |||
| 2060 | XDrawString (s->display, s->window, s->gc, x, | 2059 | XDrawString (s->display, s->window, s->gc, x, |
| 2061 | s->ybase - boff, char1b, s->nchars); | 2060 | s->ybase - boff, char1b, s->nchars); |
| 2062 | } | 2061 | } |
| 2062 | #if 0 /* defined(MAC_OS8)*/ | ||
| 2063 | else | 2063 | else |
| 2064 | { | 2064 | { |
| 2065 | if (s->two_byte_p) | 2065 | if (s->two_byte_p) |
| @@ -2069,6 +2069,7 @@ x_draw_glyph_string_foreground (s) | |||
| 2069 | XDrawImageString (s->display, s->window, s->gc, x, | 2069 | XDrawImageString (s->display, s->window, s->gc, x, |
| 2070 | s->ybase - boff, char1b, s->nchars); | 2070 | s->ybase - boff, char1b, s->nchars); |
| 2071 | } | 2071 | } |
| 2072 | #endif | ||
| 2072 | } | 2073 | } |
| 2073 | } | 2074 | } |
| 2074 | 2075 | ||
| @@ -2635,38 +2636,17 @@ x_draw_image_foreground (s) | |||
| 2635 | 2636 | ||
| 2636 | if (s->img->pixmap) | 2637 | if (s->img->pixmap) |
| 2637 | { | 2638 | { |
| 2639 | x_set_glyph_string_clipping (s); | ||
| 2640 | |||
| 2638 | if (s->img->mask) | 2641 | if (s->img->mask) |
| 2639 | { | 2642 | mac_copy_area_with_mask (s->display, s->img->pixmap, s->img->mask, |
| 2640 | Rect nr; | 2643 | s->window, s->gc, s->slice.x, s->slice.y, |
| 2641 | XRectangle clip_rect, image_rect, r; | 2644 | s->slice.width, s->slice.height, x, y); |
| 2642 | |||
| 2643 | get_glyph_string_clip_rect (s, &nr); | ||
| 2644 | CONVERT_TO_XRECT (clip_rect, nr); | ||
| 2645 | image_rect.x = x; | ||
| 2646 | image_rect.y = y; | ||
| 2647 | image_rect.width = s->slice.width; | ||
| 2648 | image_rect.height = s->slice.height; | ||
| 2649 | if (x_intersect_rectangles (&clip_rect, &image_rect, &r)) | ||
| 2650 | mac_copy_area_with_mask (s->display, s->img->pixmap, s->img->mask, | ||
| 2651 | s->window, s->gc, | ||
| 2652 | s->slice.x + r.x - x, s->slice.y + r.y - y, | ||
| 2653 | r.width, r.height, r.x, r.y); | ||
| 2654 | } | ||
| 2655 | else | 2645 | else |
| 2656 | { | 2646 | { |
| 2657 | Rect nr; | 2647 | mac_copy_area (s->display, s->img->pixmap, |
| 2658 | XRectangle clip_rect, image_rect, r; | 2648 | s->window, s->gc, s->slice.x, s->slice.y, |
| 2659 | 2649 | s->slice.width, s->slice.height, x, y); | |
| 2660 | get_glyph_string_clip_rect (s, &nr); | ||
| 2661 | CONVERT_TO_XRECT (clip_rect, nr); | ||
| 2662 | image_rect.x = x; | ||
| 2663 | image_rect.y = y; | ||
| 2664 | image_rect.width = s->slice.width; | ||
| 2665 | image_rect.height = s->slice.height; | ||
| 2666 | if (x_intersect_rectangles (&clip_rect, &image_rect, &r)) | ||
| 2667 | mac_copy_area (s->display, s->img->pixmap, s->window, s->gc, | ||
| 2668 | s->slice.x + r.x - x, s->slice.y + r.y - y, | ||
| 2669 | r.width, r.height, r.x, r.y); | ||
| 2670 | 2650 | ||
| 2671 | /* When the image has a mask, we can expect that at | 2651 | /* When the image has a mask, we can expect that at |
| 2672 | least part of a mouse highlight or a block cursor will | 2652 | least part of a mouse highlight or a block cursor will |
| @@ -2745,6 +2725,7 @@ x_draw_image_relief (s) | |||
| 2745 | } | 2725 | } |
| 2746 | 2726 | ||
| 2747 | 2727 | ||
| 2728 | #if 0 /* TODO: figure out if we need to do this on Mac. */ | ||
| 2748 | /* Draw the foreground of image glyph string S to PIXMAP. */ | 2729 | /* Draw the foreground of image glyph string S to PIXMAP. */ |
| 2749 | 2730 | ||
| 2750 | static void | 2731 | static void |
| @@ -2805,6 +2786,7 @@ x_draw_image_foreground_1 (s, pixmap) | |||
| 2805 | mac_draw_rectangle_to_pixmap (s->display, pixmap, s->gc, x, y, | 2786 | mac_draw_rectangle_to_pixmap (s->display, pixmap, s->gc, x, y, |
| 2806 | s->slice.width - 1, s->slice.height - 1); | 2787 | s->slice.width - 1, s->slice.height - 1); |
| 2807 | } | 2788 | } |
| 2789 | #endif | ||
| 2808 | 2790 | ||
| 2809 | 2791 | ||
| 2810 | /* Draw part of the background of glyph string S. X, Y, W, and H | 2792 | /* Draw part of the background of glyph string S. X, Y, W, and H |
| @@ -2876,6 +2858,7 @@ x_draw_image_glyph_string (s) | |||
| 2876 | if (s->slice.y == 0) | 2858 | if (s->slice.y == 0) |
| 2877 | y += box_line_vwidth; | 2859 | y += box_line_vwidth; |
| 2878 | 2860 | ||
| 2861 | #if 0 /* TODO: figure out if we need to do this on Mac. */ | ||
| 2879 | if (s->img->mask) | 2862 | if (s->img->mask) |
| 2880 | { | 2863 | { |
| 2881 | /* Create a pixmap as large as the glyph string. Fill it | 2864 | /* Create a pixmap as large as the glyph string. Fill it |
| @@ -2912,12 +2895,14 @@ x_draw_image_glyph_string (s) | |||
| 2912 | } | 2895 | } |
| 2913 | } | 2896 | } |
| 2914 | else | 2897 | else |
| 2898 | #endif | ||
| 2915 | x_draw_glyph_string_bg_rect (s, x, y, s->background_width, height); | 2899 | x_draw_glyph_string_bg_rect (s, x, y, s->background_width, height); |
| 2916 | 2900 | ||
| 2917 | s->background_filled_p = 1; | 2901 | s->background_filled_p = 1; |
| 2918 | } | 2902 | } |
| 2919 | 2903 | ||
| 2920 | /* Draw the foreground. */ | 2904 | /* Draw the foreground. */ |
| 2905 | #if 0 /* TODO: figure out if we need to do this on Mac. */ | ||
| 2921 | if (pixmap != 0) | 2906 | if (pixmap != 0) |
| 2922 | { | 2907 | { |
| 2923 | x_draw_image_foreground_1 (s, pixmap); | 2908 | x_draw_image_foreground_1 (s, pixmap); |
| @@ -2928,6 +2913,7 @@ x_draw_image_glyph_string (s) | |||
| 2928 | XFreePixmap (s->display, pixmap); | 2913 | XFreePixmap (s->display, pixmap); |
| 2929 | } | 2914 | } |
| 2930 | else | 2915 | else |
| 2916 | #endif | ||
| 2931 | x_draw_image_foreground (s); | 2917 | x_draw_image_foreground (s); |
| 2932 | 2918 | ||
| 2933 | /* If we must draw a relief around the image, do it. */ | 2919 | /* If we must draw a relief around the image, do it. */ |
| @@ -5899,7 +5885,14 @@ mac_font_match (char *mf, char *xf) | |||
| 5899 | static Lisp_Object Qbig5, Qcn_gb, Qsjis, Qeuc_kr; | 5885 | static Lisp_Object Qbig5, Qcn_gb, Qsjis, Qeuc_kr; |
| 5900 | 5886 | ||
| 5901 | static void | 5887 | static void |
| 5902 | decode_mac_font_name (char *name, int size, short scriptcode) | 5888 | decode_mac_font_name (name, size, scriptcode) |
| 5889 | char *name; | ||
| 5890 | int size; | ||
| 5891 | #if TARGET_API_MAC_CARBON | ||
| 5892 | int scriptcode; | ||
| 5893 | #else | ||
| 5894 | short scriptcode; | ||
| 5895 | #endif | ||
| 5903 | { | 5896 | { |
| 5904 | Lisp_Object coding_system; | 5897 | Lisp_Object coding_system; |
| 5905 | struct coding_system coding; | 5898 | struct coding_system coding; |
| @@ -5937,7 +5930,15 @@ decode_mac_font_name (char *name, int size, short scriptcode) | |||
| 5937 | 5930 | ||
| 5938 | 5931 | ||
| 5939 | static char * | 5932 | static char * |
| 5940 | mac_to_x_fontname (char *name, int size, Style style, short scriptcode) | 5933 | mac_to_x_fontname (name, size, style, scriptcode, encoding_base) |
| 5934 | char *name; | ||
| 5935 | int size; | ||
| 5936 | Style style; | ||
| 5937 | #if TARGET_API_MAC_CARBON | ||
| 5938 | int scriptcode; | ||
| 5939 | #else | ||
| 5940 | short scriptcode; | ||
| 5941 | #endif | ||
| 5941 | { | 5942 | { |
| 5942 | char foundry[32], family[32], cs[32]; | 5943 | char foundry[32], family[32], cs[32]; |
| 5943 | char xf[256], *result, *p; | 5944 | char xf[256], *result, *p; |
| @@ -5949,13 +5950,13 @@ mac_to_x_fontname (char *name, int size, Style style, short scriptcode) | |||
| 5949 | 5950 | ||
| 5950 | switch (scriptcode) | 5951 | switch (scriptcode) |
| 5951 | { | 5952 | { |
| 5952 | case smTradChinese: | 5953 | case smTradChinese: /* == kTextEncodingMacChineseTrad */ |
| 5953 | strcpy(cs, "big5-0"); | 5954 | strcpy(cs, "big5-0"); |
| 5954 | break; | 5955 | break; |
| 5955 | case smSimpChinese: | 5956 | case smSimpChinese: /* == kTextEncodingMacChineseSimp */ |
| 5956 | strcpy(cs, "gb2312.1980-0"); | 5957 | strcpy(cs, "gb2312.1980-0"); |
| 5957 | break; | 5958 | break; |
| 5958 | case smJapanese: | 5959 | case smJapanese: /* == kTextEncodingMacJapanese */ |
| 5959 | strcpy(cs, "jisx0208.1983-sjis"); | 5960 | strcpy(cs, "jisx0208.1983-sjis"); |
| 5960 | break; | 5961 | break; |
| 5961 | case -smJapanese: | 5962 | case -smJapanese: |
| @@ -5967,12 +5968,24 @@ mac_to_x_fontname (char *name, int size, Style style, short scriptcode) | |||
| 5967 | font is being built. */ | 5968 | font is being built. */ |
| 5968 | strcpy(cs, "jisx0201.1976-0"); | 5969 | strcpy(cs, "jisx0201.1976-0"); |
| 5969 | break; | 5970 | break; |
| 5970 | case smKorean: | 5971 | case smKorean: /* == kTextEncodingMacKorean */ |
| 5971 | strcpy(cs, "ksc5601.1989-0"); | 5972 | strcpy(cs, "ksc5601.1989-0"); |
| 5972 | break; | 5973 | break; |
| 5974 | #if TARGET_API_MAC_CARBON | ||
| 5975 | case kTextEncodingMacCyrillic: | ||
| 5976 | strcpy(cs, "mac-cyrillic"); | ||
| 5977 | break; | ||
| 5978 | case kTextEncodingMacCentralEurRoman: | ||
| 5979 | strcpy(cs, "mac-centraleuropean"); | ||
| 5980 | break; | ||
| 5981 | case kTextEncodingMacSymbol: | ||
| 5982 | case kTextEncodingMacDingbats: | ||
| 5983 | strcpy(cs, "adobe-fontspecific"); | ||
| 5984 | break; | ||
| 5985 | #endif | ||
| 5973 | default: | 5986 | default: |
| 5974 | strcpy(cs, "mac-roman"); | 5987 | strcpy(cs, "mac-roman"); |
| 5975 | break; | 5988 | break; |
| 5976 | } | 5989 | } |
| 5977 | } | 5990 | } |
| 5978 | 5991 | ||
| @@ -6019,7 +6032,10 @@ x_font_name_to_mac_font_name (char *xf, char *mf) | |||
| 6019 | coding_system = Qsjis; | 6032 | coding_system = Qsjis; |
| 6020 | else if (strcmp (cs, "ksc5601.1989-0") == 0) | 6033 | else if (strcmp (cs, "ksc5601.1989-0") == 0) |
| 6021 | coding_system = Qeuc_kr; | 6034 | coding_system = Qeuc_kr; |
| 6022 | else if (strcmp (cs, "mac-roman") == 0) | 6035 | else if (strcmp (cs, "mac-roman") == 0 |
| 6036 | || strcmp (cs, "mac-cyrillic") == 0 | ||
| 6037 | || strcmp (cs, "mac-centraleuropean") == 0 | ||
| 6038 | || strcmp (cs, "adobe-fontspecific") == 0) | ||
| 6023 | strcpy (mf, family); | 6039 | strcpy (mf, family); |
| 6024 | else | 6040 | else |
| 6025 | sprintf (mf, "%s-%s-%s", foundry, family, cs); | 6041 | sprintf (mf, "%s-%s-%s", foundry, family, cs); |
| @@ -6091,7 +6107,8 @@ init_font_name_table () | |||
| 6091 | FMFont font; | 6107 | FMFont font; |
| 6092 | FMFontStyle style; | 6108 | FMFontStyle style; |
| 6093 | FMFontSize size; | 6109 | FMFontSize size; |
| 6094 | SInt16 sc; | 6110 | TextEncoding encoding; |
| 6111 | TextEncodingBase sc; | ||
| 6095 | 6112 | ||
| 6096 | if (FMGetFontFamilyName (ff, name) != noErr) | 6113 | if (FMGetFontFamilyName (ff, name) != noErr) |
| 6097 | break; | 6114 | break; |
| @@ -6099,9 +6116,11 @@ init_font_name_table () | |||
| 6099 | if (*name == '.') | 6116 | if (*name == '.') |
| 6100 | continue; | 6117 | continue; |
| 6101 | 6118 | ||
| 6102 | sc = FontToScript (ff); | 6119 | if (FMGetFontFamilyTextEncoding (ff, &encoding) != noErr) |
| 6120 | break; | ||
| 6121 | sc = GetTextEncodingBase (encoding); | ||
| 6103 | decode_mac_font_name (name, sizeof (name), sc); | 6122 | decode_mac_font_name (name, sizeof (name), sc); |
| 6104 | 6123 | ||
| 6105 | /* Point the instance iterator at the current font family. */ | 6124 | /* Point the instance iterator at the current font family. */ |
| 6106 | if (FMResetFontFamilyInstanceIterator (ff, &ffii) != noErr) | 6125 | if (FMResetFontFamilyInstanceIterator (ff, &ffii) != noErr) |
| 6107 | break; | 6126 | break; |
| @@ -8619,17 +8638,30 @@ XTread_socket (sd, expected, hold_quit) | |||
| 8619 | { | 8638 | { |
| 8620 | unsigned char ch = inev.code; | 8639 | unsigned char ch = inev.code; |
| 8621 | ByteCount actual_input_length, actual_output_length; | 8640 | ByteCount actual_input_length, actual_output_length; |
| 8622 | unsigned char outch; | 8641 | unsigned char outbuf[32]; |
| 8623 | 8642 | ||
| 8624 | convert_status = TECConvertText (converter, &ch, 1, | 8643 | convert_status = TECConvertText (converter, &ch, 1, |
| 8625 | &actual_input_length, | 8644 | &actual_input_length, |
| 8626 | &outch, 1, | 8645 | outbuf, 1, |
| 8627 | &actual_output_length); | 8646 | &actual_output_length); |
| 8628 | if (convert_status == noErr | 8647 | if (convert_status == noErr |
| 8629 | && actual_input_length == 1 | 8648 | && actual_input_length == 1 |
| 8630 | && actual_output_length == 1) | 8649 | && actual_output_length == 1) |
| 8631 | inev.code = outch; | 8650 | inev.code = *outbuf; |
| 8632 | } | 8651 | |
| 8652 | /* Reset internal states of the converter object. | ||
| 8653 | If it fails, create another one. */ | ||
| 8654 | convert_status = TECFlushText (converter, outbuf, | ||
| 8655 | sizeof (outbuf), | ||
| 8656 | &actual_output_length); | ||
| 8657 | if (convert_status != noErr) | ||
| 8658 | { | ||
| 8659 | TECDisposeConverter (converter); | ||
| 8660 | TECCreateConverter (&converter, | ||
| 8661 | kTextEncodingMacRoman, | ||
| 8662 | mac_keyboard_text_encoding); | ||
| 8663 | } | ||
| 8664 | } | ||
| 8633 | } | 8665 | } |
| 8634 | 8666 | ||
| 8635 | #if USE_CARBON_EVENTS | 8667 | #if USE_CARBON_EVENTS |
| @@ -9148,7 +9180,7 @@ static struct redisplay_interface x_redisplay_interface = | |||
| 9148 | x_update_window_end, | 9180 | x_update_window_end, |
| 9149 | x_cursor_to, | 9181 | x_cursor_to, |
| 9150 | x_flush, | 9182 | x_flush, |
| 9151 | x_flush, | 9183 | 0, /* flush_display_optional */ |
| 9152 | x_clear_window_mouse_face, | 9184 | x_clear_window_mouse_face, |
| 9153 | x_get_glyph_overhangs, | 9185 | x_get_glyph_overhangs, |
| 9154 | x_fix_overlapping_area, | 9186 | x_fix_overlapping_area, |
diff --git a/src/s/darwin.h b/src/s/darwin.h index dd49426d7c3..9f78405a43c 100644 --- a/src/s/darwin.h +++ b/src/s/darwin.h | |||
| @@ -217,6 +217,13 @@ Boston, MA 02111-1307, USA. */ | |||
| 217 | /* Define HAVE_SOCKETS if system supports 4.2-compatible sockets. */ | 217 | /* Define HAVE_SOCKETS if system supports 4.2-compatible sockets. */ |
| 218 | #define HAVE_SOCKETS | 218 | #define HAVE_SOCKETS |
| 219 | 219 | ||
| 220 | /* In Carbon, asynchronous I/O (using SIGIO) can't be used for window | ||
| 221 | events because they don't come from sockets, even though it works | ||
| 222 | fine on tty's. */ | ||
| 223 | #ifdef HAVE_CARBON | ||
| 224 | #define NO_SOCK_SIGIO | ||
| 225 | #endif | ||
| 226 | |||
| 220 | /* Extra initialization calls in main for Mac OS X system type. */ | 227 | /* Extra initialization calls in main for Mac OS X system type. */ |
| 221 | #ifdef HAVE_CARBON | 228 | #ifdef HAVE_CARBON |
| 222 | #define SYMS_SYSTEM syms_of_mac() | 229 | #define SYMS_SYSTEM syms_of_mac() |