aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKaroly Lorentey2006-05-03 11:56:53 +0000
committerKaroly Lorentey2006-05-03 11:56:53 +0000
commitc044516d384ff70e820686d4e995dcc23ee22e6f (patch)
tree4a9b52cf3e7da73040903b719dfca8113a765884 /src
parentb33c71f58623306001d4d4fe4f7354d8c360edaa (diff)
parent9d6bb9e0af2671a4deca1509f4a2d5655400f67a (diff)
downloademacs-c044516d384ff70e820686d4e995dcc23ee22e6f.tar.gz
emacs-c044516d384ff70e820686d4e995dcc23ee22e6f.zip
Merged from emacs@sv.gnu.org
Patches applied: * emacs@sv.gnu.org/emacs--devo--0--patch-252 Merge from gnus--rel--5.10 * emacs@sv.gnu.org/emacs--devo--0--patch-253 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-254 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-255 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-256 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-257 Merge from gnus--rel--5.10 * emacs@sv.gnu.org/emacs--devo--0--patch-258 Clean up lisp/gnus/ChangeLog a bit * emacs@sv.gnu.org/emacs--devo--0--patch-259 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-260 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-261 lisp/replace.el (occur-engine): Bind `inhibit-field-text-motion' to t * emacs@sv.gnu.org/emacs--devo--0--patch-262 Update from CVS * emacs@sv.gnu.org/gnus--rel--5.10--patch-96 Update from CVS * emacs@sv.gnu.org/gnus--rel--5.10--patch-97 Update from CVS * emacs@sv.gnu.org/gnus--rel--5.10--patch-98 Update from CVS git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-554
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog67
-rw-r--r--src/dispnew.c2
-rw-r--r--src/keymap.c7
-rw-r--r--src/mac.c50
-rw-r--r--src/macfns.c104
-rw-r--r--src/macgui.h38
-rw-r--r--src/macterm.c119
-rw-r--r--src/macterm.h8
-rw-r--r--src/syntax.c7
-rw-r--r--src/unexmacosx.c3
-rw-r--r--src/xdisp.c11
-rw-r--r--src/xmenu.c1
12 files changed, 366 insertions, 51 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index a4d458bee0f..bf52364ee66 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,66 @@
12006-05-02 Andreas Schwab <schwab@suse.de>
2
3 * xmenu.c (restore_menu_items): Return a value.
4
52006-05-01 Martin Rudalics <rudalics@gmx.at>
6
7 * syntax.c (Fforward_comment): Detect generic comment at beginning of
8 buffer when moving backwards.
9
102006-05-01 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
11
12 * dispnew.c (update_window): Don't set changed_p when mode/header
13 line is updated.
14
15 * xdisp.c (prepare_menu_bars) [MAC_OS]: Call mac_update_title_bar.
16 (get_glyph_face_and_encoding, get_char_face_and_encoding):
17 Don't distinguish known faces from others.
18
19 * mac.c (mac_coerce_file_name_ptr): Try typeFSRef if coercion
20 through typeFileURL failed.
21
22 * macfns.c (mac_update_title_bar): New function.
23 [TARGET_API_MAC_CARBON] (mac_update_proxy_icon): New function.
24 (show_hourglass, hide_hourglass) [USE_CG_DRAWING]:
25 Call mac_prepare_for_quickdraw.
26
27 * macgui.h (USE_ATSUI): Set default to 1 if MAC_OSX is defined.
28 (USE_CG_DRAWING): Don't define if compiled on Mac OS X 10.1.
29 (enum pcm_status): New enum.
30 (XCHARSTRUCTROW_CHAR_VALID_P, XCHARSTRUCTROW_SET_CHAR_VALID)
31 (XCharStructRow): Remove. Now validity is represented by
32 non-negativeness of sum of ascent and descent.
33 (struct MacFontStruct): Change type of member `rows'.
34 (struct _XGC) [USE_CG_DRAWING]: Add member `clip_rects'.
35
36 * macterm.c (mac_draw_line, mac_draw_line_to_pixmap):
37 Adjust endpoints of strictly horizontal/vertical lines.
38 (mac_set_clip_rectangles) [USE_CG_DRAWING]: Set clip_rects.
39 (pcm_init, pcm_get_status): New functions.
40 (x_per_char_metric, XLoadQueryFont): Use them instead of
41 XCharStructRow and related macros.
42 (x_draw_relief_rect): Don't adjust arguments of mac_draw_line.
43 (x_free_frame_resources) [TARGET_API_MAC_CARBON]: Free FRAME_FILE_NAME.
44 (XTread_socket) [TARGET_API_MAC_CARBON]: Handle proxy icon drag
45 and window path pop-up menu on title bar.
46 (mac_use_core_graphics) [USE_CG_DRAWING]: Set default to 1.
47
48 * macterm.h (mac_update_title_bar): Add extern.
49 (struct mac_output) [TARGET_API_MAC_CARBON]: New member `file_name'.
50 (FRAME_FILE_NAME): New macro.
51
52 * unexmacosx.c (unexec): Error if trying unexec from dumped executable.
53
542006-04-30 Richard Stallman <rms@gnu.org>
55
56 * keymap.c (Fdefine_key): Improve error message
57 when KEY begins with a non-prefix key.
58
592006-04-30 Martin Rudalics <rudalics@gmx.at>
60
61 * syntax.c (Fforward_comment): Don't forget to break out of the loop
62 when we skipped backward over a generic comment.
63
12006-04-27 Nick Roberts <nickrob@snap.net.nz> 642006-04-27 Nick Roberts <nickrob@snap.net.nz>
2 65
3 * .gdbinit (pp1, pv1): Only print value as expression is now 66 * .gdbinit (pp1, pv1): Only print value as expression is now
@@ -31,7 +94,7 @@
31 * xdisp.c (fill_stretch_glyph_string): Set s->nchars = 1 for code which 94 * xdisp.c (fill_stretch_glyph_string): Set s->nchars = 1 for code which
32 does last_glyph=s->first_glyph+s->nchars-1, e.g. if stretch has relief. 95 does last_glyph=s->first_glyph+s->nchars-1, e.g. if stretch has relief.
33 (produce_stretch_glyph): Assume that face box height and width is 96 (produce_stretch_glyph): Assume that face box height and width is
34 already included in in stretch glyph size so caller doesn't have to 97 already included in stretch glyph size so caller doesn't have to
35 consider the extra space otherwise added (fixes problem in ses.el). 98 consider the extra space otherwise added (fixes problem in ses.el).
36 99
37 * frame.c (x_set_font): Clear f->n_tool_bar_rows and current frame 100 * frame.c (x_set_font): Clear f->n_tool_bar_rows and current frame
@@ -1678,7 +1741,7 @@
1678 1741
1679 * image.c [MAC_OS] (find_image_fsspec): Likewise. 1742 * image.c [MAC_OS] (find_image_fsspec): Likewise.
1680 1743
16812005-12-23 Martin Rudalics <rudalics@gmx.at> (tiny change) 17442005-12-23 Martin Rudalics <rudalics@gmx.at>
1682 1745
1683 * insdel.c (insert, insert_and_inherit, insert_before_markers) 1746 * insdel.c (insert, insert_and_inherit, insert_before_markers)
1684 (insert_before_markers_and_inherit): Make sure FROM is correct 1747 (insert_before_markers_and_inherit): Make sure FROM is correct
diff --git a/src/dispnew.c b/src/dispnew.c
index 8298ee694d6..a3ac89e05d5 100644
--- a/src/dispnew.c
+++ b/src/dispnew.c
@@ -4157,7 +4157,6 @@ update_window (w, force_p)
4157 update_window_line (w, MATRIX_ROW_VPOS (mode_line_row, 4157 update_window_line (w, MATRIX_ROW_VPOS (mode_line_row,
4158 desired_matrix), 4158 desired_matrix),
4159 &mouse_face_overwritten_p); 4159 &mouse_face_overwritten_p);
4160 changed_p = 1;
4161 } 4160 }
4162 4161
4163 /* Find first enabled row. Optimizations in redisplay_internal 4162 /* Find first enabled row. Optimizations in redisplay_internal
@@ -4227,7 +4226,6 @@ update_window (w, force_p)
4227 { 4226 {
4228 header_line_row->y = 0; 4227 header_line_row->y = 0;
4229 update_window_line (w, 0, &mouse_face_overwritten_p); 4228 update_window_line (w, 0, &mouse_face_overwritten_p);
4230 changed_p = 1;
4231 } 4229 }
4232 4230
4233 /* Fix the appearance of overlapping/overlapped rows. */ 4231 /* Fix the appearance of overlapping/overlapped rows. */
diff --git a/src/keymap.c b/src/keymap.c
index 7ff3f471b0f..c609ed6c4e4 100644
--- a/src/keymap.c
+++ b/src/keymap.c
@@ -1186,8 +1186,11 @@ binding KEY to DEF is added at the front of KEYMAP. */)
1186 if (!CONSP (keymap)) 1186 if (!CONSP (keymap))
1187 /* We must use Fkey_description rather than just passing key to 1187 /* We must use Fkey_description rather than just passing key to
1188 error; key might be a vector, not a string. */ 1188 error; key might be a vector, not a string. */
1189 error ("Key sequence %s uses invalid prefix characters", 1189 error ("Key sequence %s starts with non-prefix key %s",
1190 SDATA (Fkey_description (key, Qnil))); 1190 SDATA (Fkey_description (key, Qnil)),
1191 SDATA (Fkey_description (Fsubstring (key, make_number (0),
1192 make_number (idx)),
1193 Qnil)));
1191 } 1194 }
1192} 1195}
1193 1196
diff --git a/src/mac.c b/src/mac.c
index 7172301b6b0..444320322c3 100644
--- a/src/mac.c
+++ b/src/mac.c
@@ -448,6 +448,22 @@ mac_coerce_file_name_ptr (type_code, data_ptr, data_size,
448 } 448 }
449 else 449 else
450 err = memFullErr; 450 err = memFullErr;
451
452 if (err != noErr)
453 {
454 /* Just to be paranoid ... */
455 FSRef fref;
456 char *buf;
457
458 buf = xmalloc (data_size + 1);
459 memcpy (buf, data_ptr, data_size);
460 buf[data_size] = '\0';
461 err = FSPathMakeRef (buf, &fref, NULL);
462 xfree (buf);
463 if (err == noErr)
464 err = AECoercePtr (typeFSRef, &fref, sizeof (FSRef),
465 to_type, result);
466 }
451#else 467#else
452 FSSpec fs; 468 FSSpec fs;
453 char *buf; 469 char *buf;
@@ -510,6 +526,34 @@ mac_coerce_file_name_ptr (type_code, data_ptr, data_size,
510 CFDataGetLength (data), result); 526 CFDataGetLength (data), result);
511 CFRelease (data); 527 CFRelease (data);
512 } 528 }
529
530 if (err != noErr)
531 {
532 /* Coercion from typeAlias to typeFileURL fails on Mac OS X
533 10.2. In such cases, try typeFSRef as a target type. */
534 char file_name[MAXPATHLEN];
535
536 if (type_code == typeFSRef && data_size == sizeof (FSRef))
537 err = FSRefMakePath (data_ptr, file_name, sizeof (file_name));
538 else
539 {
540 AEDesc desc;
541 FSRef fref;
542
543 err = AECoercePtr (type_code, data_ptr, data_size,
544 typeFSRef, &desc);
545 if (err == noErr)
546 {
547 err = AEGetDescData (&desc, &fref, sizeof (FSRef));
548 AEDisposeDesc (&desc);
549 }
550 if (err == noErr)
551 err = FSRefMakePath (&fref, file_name, sizeof (file_name));
552 }
553 if (err == noErr)
554 err = AECreateDesc (TYPE_FILE_NAME, file_name,
555 strlen (file_name), result);
556 }
513#else 557#else
514 char file_name[MAXPATHLEN]; 558 char file_name[MAXPATHLEN];
515 559
@@ -529,11 +573,11 @@ mac_coerce_file_name_ptr (type_code, data_ptr, data_size,
529#else 573#else
530 fs = *(FSSpec *)(*(desc.dataHandle)); 574 fs = *(FSSpec *)(*(desc.dataHandle));
531#endif 575#endif
532 if (err == noErr)
533 err = fsspec_to_posix_pathname (&fs, file_name,
534 sizeof (file_name) - 1);
535 AEDisposeDesc (&desc); 576 AEDisposeDesc (&desc);
536 } 577 }
578 if (err == noErr)
579 err = fsspec_to_posix_pathname (&fs, file_name,
580 sizeof (file_name) - 1);
537 } 581 }
538 if (err == noErr) 582 if (err == noErr)
539 err = AECreateDesc (TYPE_FILE_NAME, file_name, 583 err = AECreateDesc (TYPE_FILE_NAME, file_name,
diff --git a/src/macfns.c b/src/macfns.c
index 3f5151daee9..2a83fef0870 100644
--- a/src/macfns.c
+++ b/src/macfns.c
@@ -1919,6 +1919,100 @@ mac_set_scroll_bar_width (f, arg, oldval)
1919 x_set_scroll_bar_width (f, arg, oldval); 1919 x_set_scroll_bar_width (f, arg, oldval);
1920} 1920}
1921 1921
1922#if TARGET_API_MAC_CARBON
1923static void
1924mac_update_proxy_icon (f)
1925 struct frame *f;
1926{
1927 Lisp_Object file_name =
1928 XBUFFER (XWINDOW (FRAME_SELECTED_WINDOW (f))->buffer)->filename;
1929 Window w = FRAME_MAC_WINDOW (f);
1930
1931 if (FRAME_FILE_NAME (f) == NULL && !STRINGP (file_name))
1932 return;
1933 if (FRAME_FILE_NAME (f) && STRINGP (file_name)
1934 && strcmp (FRAME_FILE_NAME (f), SDATA (file_name)) == 0)
1935 return;
1936
1937 if (FRAME_FILE_NAME (f))
1938 {
1939 xfree (FRAME_FILE_NAME (f));
1940 FRAME_FILE_NAME (f) = NULL;
1941 }
1942
1943 BLOCK_INPUT;
1944
1945 if (STRINGP (file_name))
1946 {
1947 OSStatus err;
1948 AEDesc desc;
1949 Lisp_Object encoded_file_name = ENCODE_FILE (file_name);
1950
1951#ifdef MAC_OS8
1952 SetPortWindowPort (w);
1953#endif
1954 err = AECoercePtr (TYPE_FILE_NAME, SDATA (encoded_file_name),
1955 SBYTES (encoded_file_name), typeAlias, &desc);
1956 if (err == noErr)
1957 {
1958 Size size = AEGetDescDataSize (&desc);
1959 AliasHandle alias = (AliasHandle) NewHandle (size);
1960
1961 if (alias == NULL)
1962 err = memFullErr;
1963 else
1964 {
1965 HLock ((Handle) alias);
1966 err = AEGetDescData (&desc, *alias, size);
1967 HUnlock ((Handle) alias);
1968 if (err == noErr)
1969 err = SetWindowProxyAlias (w, alias);
1970 DisposeHandle ((Handle) alias);
1971 }
1972 AEDisposeDesc (&desc);
1973 }
1974 if (err == noErr)
1975 {
1976 FRAME_FILE_NAME (f) = xmalloc (SBYTES (file_name) + 1);
1977 strcpy (FRAME_FILE_NAME (f), SDATA (file_name));
1978 }
1979 }
1980
1981 if (FRAME_FILE_NAME (f) == NULL)
1982 RemoveWindowProxy (w);
1983
1984 UNBLOCK_INPUT;
1985}
1986#endif
1987
1988void
1989mac_update_title_bar (f, save_match_data)
1990 struct frame *f;
1991 int save_match_data;
1992{
1993#if TARGET_API_MAC_CARBON
1994 struct window *w;
1995 int modified_p;
1996
1997 if (!FRAME_MAC_P (f))
1998 return;
1999
2000 w = XWINDOW (FRAME_SELECTED_WINDOW (f));
2001 modified_p = (BUF_SAVE_MODIFF (XBUFFER (w->buffer))
2002 < BUF_MODIFF (XBUFFER (w->buffer)));
2003 if (windows_or_buffers_changed
2004 /* Minibuffer modification status shown in the close button is
2005 confusing. */
2006 || (!MINI_WINDOW_P (w)
2007 && (modified_p != !NILP (w->last_had_star))))
2008 SetWindowModified (FRAME_MAC_WINDOW (f),
2009 !MINI_WINDOW_P (w) && modified_p);
2010
2011 if (windows_or_buffers_changed)
2012 mac_update_proxy_icon (f);
2013#endif
2014}
2015
1922 2016
1923/* Subroutines of creating a frame. */ 2017/* Subroutines of creating a frame. */
1924 2018
@@ -3470,6 +3564,9 @@ show_hourglass (timer)
3470 if (FRAME_LIVE_P (f) && FRAME_MAC_P (f) 3564 if (FRAME_LIVE_P (f) && FRAME_MAC_P (f)
3471 && FRAME_MAC_WINDOW (f) != tip_window) 3565 && FRAME_MAC_WINDOW (f) != tip_window)
3472 { 3566 {
3567#if USE_CG_DRAWING
3568 mac_prepare_for_quickdraw (f);
3569#endif
3473 if (!f->output_data.mac->hourglass_control) 3570 if (!f->output_data.mac->hourglass_control)
3474 { 3571 {
3475 Window w = FRAME_MAC_WINDOW (f); 3572 Window w = FRAME_MAC_WINDOW (f);
@@ -3514,7 +3611,12 @@ hide_hourglass ()
3514 if (FRAME_MAC_P (f) 3611 if (FRAME_MAC_P (f)
3515 /* Watch out for newly created frames. */ 3612 /* Watch out for newly created frames. */
3516 && f->output_data.mac->hourglass_control) 3613 && f->output_data.mac->hourglass_control)
3517 HideControl (f->output_data.mac->hourglass_control); 3614 {
3615#if USE_CG_DRAWING
3616 mac_prepare_for_quickdraw (f);
3617#endif
3618 HideControl (f->output_data.mac->hourglass_control);
3619 }
3518 } 3620 }
3519 3621
3520 hourglass_shown_p = 0; 3622 hourglass_shown_p = 0;
diff --git a/src/macgui.h b/src/macgui.h
index 7eb6c9942ab..579ae2b7663 100644
--- a/src/macgui.h
+++ b/src/macgui.h
@@ -79,14 +79,26 @@ typedef unsigned long Time;
79#include <Gestalt.h> 79#include <Gestalt.h>
80#endif /* not HAVE_CARBON */ 80#endif /* not HAVE_CARBON */
81 81
82/* Whether to use ATSUI (Apple Type Services for Unicode Imaging) for
83 text drawing. */
84#ifndef USE_ATSUI
85#ifdef MAC_OSX
86#define USE_ATSUI 1
87#endif
88#endif
89
90/* Whether to use low-level Quartz 2D (aka Core Graphics) text drawing
91 in preference to ATSUI for ASCII and Latin-1 characters. */
82#ifndef USE_CG_TEXT_DRAWING 92#ifndef USE_CG_TEXT_DRAWING
83#if USE_ATSUI && MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 93#if USE_ATSUI && MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
84#define USE_CG_TEXT_DRAWING 1 94#define USE_CG_TEXT_DRAWING 1
85#endif 95#endif
86#endif 96#endif
87 97
98/* Whether to use Quartz 2D routines for drawing operations other than
99 texts. */
88#ifndef USE_CG_DRAWING 100#ifndef USE_CG_DRAWING
89#if USE_ATSUI && defined (MAC_OSX) 101#if USE_ATSUI && MAC_OS_X_VERSION_MAX_ALLOWED >= 1020
90#define USE_CG_DRAWING 1 102#define USE_CG_DRAWING 1
91#endif 103#endif
92#endif 104#endif
@@ -105,6 +117,8 @@ typedef GWorldPtr Pixmap;
105 117
106 118
107/* Emulate XCharStruct. */ 119/* Emulate XCharStruct. */
120/* If the sum of ascent and descent is negative, that means some
121 special status specified by enum pcm_status. */
108typedef struct _XCharStruct 122typedef struct _XCharStruct
109{ 123{
110 short lbearing; /* origin to left edge of raster */ 124 short lbearing; /* origin to left edge of raster */
@@ -117,6 +131,12 @@ typedef struct _XCharStruct
117#endif 131#endif
118} XCharStruct; 132} XCharStruct;
119 133
134enum pcm_status
135 {
136 PCM_VALID = 0, /* pcm data is valid */
137 PCM_INVALID = -1, /* pcm data is invalid */
138 };
139
120#define STORE_XCHARSTRUCT(xcs, w, bds) \ 140#define STORE_XCHARSTRUCT(xcs, w, bds) \
121 ((xcs).width = (w), \ 141 ((xcs).width = (w), \
122 (xcs).lbearing = (bds).left, \ 142 (xcs).lbearing = (bds).left, \
@@ -124,18 +144,6 @@ typedef struct _XCharStruct
124 (xcs).ascent = -(bds).top, \ 144 (xcs).ascent = -(bds).top, \
125 (xcs).descent = (bds).bottom) 145 (xcs).descent = (bds).bottom)
126 146
127typedef struct
128{
129 char valid_bits[0x100 / 8];
130 XCharStruct per_char[0x100];
131} XCharStructRow;
132
133#define XCHARSTRUCTROW_CHAR_VALID_P(row, byte2) \
134 ((row)->valid_bits[(byte2) / 8] & (1 << (byte2) % 8))
135
136#define XCHARSTRUCTROW_SET_CHAR_VALID(row, byte2) \
137 ((row)->valid_bits[(byte2) / 8] |= (1 << (byte2) % 8))
138
139struct MacFontStruct { 147struct MacFontStruct {
140 char *full_name; 148 char *full_name;
141 149
@@ -175,7 +183,7 @@ struct MacFontStruct {
175 XCharStruct max_bounds; /* maximum bounds over all existing char */ 183 XCharStruct max_bounds; /* maximum bounds over all existing char */
176 union { 184 union {
177 XCharStruct *per_char; /* first_char to last_char information */ 185 XCharStruct *per_char; /* first_char to last_char information */
178 XCharStructRow **rows; /* first row to last row information */ 186 XCharStruct **rows; /* first row to last row information */
179 } bounds; 187 } bounds;
180 int ascent; /* logical extent above baseline for spacing */ 188 int ascent; /* logical extent above baseline for spacing */
181 int descent; /* logical decent below baseline for spacing */ 189 int descent; /* logical decent below baseline for spacing */
@@ -229,7 +237,7 @@ typedef struct _XGC
229 /* QuickDraw clipping region. Ignored if n_clip_rects == 0. */ 237 /* QuickDraw clipping region. Ignored if n_clip_rects == 0. */
230 RgnHandle clip_region; 238 RgnHandle clip_region;
231 239
232#if defined (MAC_OSX) && USE_ATSUI 240#if defined (MAC_OSX) && (USE_ATSUI || USE_CG_DRAWING)
233 /* Clipping rectangles used in Quartz 2D drawing. The y-coordinate 241 /* Clipping rectangles used in Quartz 2D drawing. The y-coordinate
234 is in QuickDraw's. */ 242 is in QuickDraw's. */
235 CGRect clip_rects[MAX_CLIP_RECTS]; 243 CGRect clip_rects[MAX_CLIP_RECTS];
diff --git a/src/macterm.c b/src/macterm.c
index 6c47e2f932f..45bc533893c 100644
--- a/src/macterm.c
+++ b/src/macterm.c
@@ -389,16 +389,37 @@ mac_draw_line (f, gc, x1, y1, x2, y2)
389{ 389{
390#if USE_CG_DRAWING 390#if USE_CG_DRAWING
391 CGContextRef context; 391 CGContextRef context;
392 float gx1 = x1, gy1 = y1, gx2 = x2, gy2 = y2;
393
394 if (y1 != y2)
395 gx1 += 0.5f, gx2 += 0.5f;
396 if (x1 != x2)
397 gy1 += 0.5f, gy2 += 0.5f;
392 398
393 context = mac_begin_cg_clip (f, gc); 399 context = mac_begin_cg_clip (f, gc);
394 CG_SET_STROKE_COLOR (context, gc->xgcv.foreground); 400 CG_SET_STROKE_COLOR (context, gc->xgcv.foreground);
395 CGContextBeginPath (context); 401 CGContextBeginPath (context);
396 CGContextMoveToPoint (context, x1 + 0.5f, y1 + 0.5f); 402 CGContextMoveToPoint (context, gx1, gy1);
397 CGContextAddLineToPoint (context, x2 + 0.5f, y2 + 0.5f); 403 CGContextAddLineToPoint (context, gx2, gy2);
398 CGContextClosePath (context); 404 CGContextClosePath (context);
399 CGContextStrokePath (context); 405 CGContextStrokePath (context);
400 mac_end_cg_clip (f); 406 mac_end_cg_clip (f);
401#else 407#else
408 if (x1 == x2)
409 {
410 if (y1 > y2)
411 y1--;
412 else if (y2 > y1)
413 y2--;
414 }
415 else if (y1 == y2)
416 {
417 if (x1 > x2)
418 x1--;
419 else
420 x2--;
421 }
422
402 SetPortWindowPort (FRAME_MAC_WINDOW (f)); 423 SetPortWindowPort (FRAME_MAC_WINDOW (f));
403 424
404 RGBForeColor (GC_FORE_COLOR (gc)); 425 RGBForeColor (GC_FORE_COLOR (gc));
@@ -420,6 +441,21 @@ mac_draw_line_to_pixmap (display, p, gc, x1, y1, x2, y2)
420 CGrafPtr old_port; 441 CGrafPtr old_port;
421 GDHandle old_gdh; 442 GDHandle old_gdh;
422 443
444 if (x1 == x2)
445 {
446 if (y1 > y2)
447 y1--;
448 else if (y2 > y1)
449 y2--;
450 }
451 else if (y1 == y2)
452 {
453 if (x1 > x2)
454 x1--;
455 else
456 x2--;
457 }
458
423 GetGWorld (&old_port, &old_gdh); 459 GetGWorld (&old_port, &old_gdh);
424 SetGWorld (p, NULL); 460 SetGWorld (p, NULL);
425 461
@@ -1625,7 +1661,7 @@ mac_set_clip_rectangles (display, gc, rectangles, n)
1625 DisposeRgn (region); 1661 DisposeRgn (region);
1626 } 1662 }
1627 } 1663 }
1628#if defined (MAC_OSX) && USE_ATSUI 1664#if defined (MAC_OSX) && (USE_ATSUI || USE_CG_DRAWING)
1629 for (i = 0; i < n; i++) 1665 for (i = 0; i < n; i++)
1630 { 1666 {
1631 Rect *rect = rectangles + i; 1667 Rect *rect = rectangles + i;
@@ -2136,6 +2172,29 @@ static XCharStruct *x_per_char_metric P_ ((XFontStruct *, XChar2b *));
2136static int mac_encode_char P_ ((int, XChar2b *, struct font_info *, int *)); 2172static int mac_encode_char P_ ((int, XChar2b *, struct font_info *, int *));
2137 2173
2138 2174
2175static void
2176pcm_init (pcm, count)
2177 XCharStruct *pcm;
2178 int count;
2179{
2180 bzero (pcm, sizeof (XCharStruct) * count);
2181 while (--count >= 0)
2182 {
2183 pcm->descent = PCM_INVALID;
2184 pcm++;
2185 }
2186}
2187
2188static enum pcm_status
2189pcm_get_status (pcm)
2190 XCharStruct *pcm;
2191{
2192 int height = pcm->ascent + pcm->descent;
2193
2194 /* Negative height means some special status. */
2195 return height >= 0 ? PCM_VALID : height;
2196}
2197
2139/* Get metrics of character CHAR2B in FONT. Value is null if CHAR2B 2198/* Get metrics of character CHAR2B in FONT. Value is null if CHAR2B
2140 is not contained in the font. */ 2199 is not contained in the font. */
2141 2200
@@ -2152,22 +2211,21 @@ x_per_char_metric (font, char2b)
2152#if USE_ATSUI 2211#if USE_ATSUI
2153 if (font->mac_style) 2212 if (font->mac_style)
2154 { 2213 {
2155 XCharStructRow **row = font->bounds.rows + char2b->byte1; 2214 XCharStruct **row = font->bounds.rows + char2b->byte1;
2156 2215
2157 if (*row == NULL) 2216 if (*row == NULL)
2158 { 2217 {
2159 *row = xmalloc (sizeof (XCharStructRow)); 2218 *row = xmalloc (sizeof (XCharStruct) * 0x100);
2160 bzero (*row, sizeof (XCharStructRow)); 2219 pcm_init (*row, 0x100);
2161 } 2220 }
2162 pcm = (*row)->per_char + char2b->byte2; 2221 pcm = *row + char2b->byte2;
2163 if (!XCHARSTRUCTROW_CHAR_VALID_P (*row, char2b->byte2)) 2222 if (pcm_get_status (pcm) != PCM_VALID)
2164 { 2223 {
2165 BLOCK_INPUT; 2224 BLOCK_INPUT;
2166 mac_query_char_extents (font->mac_style, 2225 mac_query_char_extents (font->mac_style,
2167 (char2b->byte1 << 8) + char2b->byte2, 2226 (char2b->byte1 << 8) + char2b->byte2,
2168 NULL, NULL, pcm, NULL); 2227 NULL, NULL, pcm, NULL);
2169 UNBLOCK_INPUT; 2228 UNBLOCK_INPUT;
2170 XCHARSTRUCTROW_SET_CHAR_VALID (*row, char2b->byte2);
2171 } 2229 }
2172 } 2230 }
2173 else 2231 else
@@ -3122,13 +3180,13 @@ x_draw_relief_rect (f, left_x, top_y, right_x, bottom_y, width,
3122 for (i = 0; i < width; ++i) 3180 for (i = 0; i < width; ++i)
3123 mac_draw_line (f, gc, 3181 mac_draw_line (f, gc,
3124 left_x + i * left_p, top_y + i, 3182 left_x + i * left_p, top_y + i,
3125 right_x - i * right_p, top_y + i); 3183 right_x + 1 - i * right_p, top_y + i);
3126 3184
3127 /* Left. */ 3185 /* Left. */
3128 if (left_p) 3186 if (left_p)
3129 for (i = 0; i < width; ++i) 3187 for (i = 0; i < width; ++i)
3130 mac_draw_line (f, gc, 3188 mac_draw_line (f, gc,
3131 left_x + i, top_y + i, left_x + i, bottom_y - i); 3189 left_x + i, top_y + i, left_x + i, bottom_y - i + 1);
3132 3190
3133 mac_reset_clip_rectangles (dpy, gc); 3191 mac_reset_clip_rectangles (dpy, gc);
3134 if (raised_p) 3192 if (raised_p)
@@ -3142,13 +3200,13 @@ x_draw_relief_rect (f, left_x, top_y, right_x, bottom_y, width,
3142 for (i = 0; i < width; ++i) 3200 for (i = 0; i < width; ++i)
3143 mac_draw_line (f, gc, 3201 mac_draw_line (f, gc,
3144 left_x + i * left_p, bottom_y - i, 3202 left_x + i * left_p, bottom_y - i,
3145 right_x - i * right_p, bottom_y - i); 3203 right_x + 1 - i * right_p, bottom_y - i);
3146 3204
3147 /* Right. */ 3205 /* Right. */
3148 if (right_p) 3206 if (right_p)
3149 for (i = 0; i < width; ++i) 3207 for (i = 0; i < width; ++i)
3150 mac_draw_line (f, gc, 3208 mac_draw_line (f, gc,
3151 right_x - i, top_y + i + 1, right_x - i, bottom_y - i - 1); 3209 right_x - i, top_y + i + 1, right_x - i, bottom_y - i);
3152 3210
3153 mac_reset_clip_rectangles (dpy, gc); 3211 mac_reset_clip_rectangles (dpy, gc);
3154} 3212}
@@ -6300,6 +6358,11 @@ x_free_frame_resources (f)
6300 if (FRAME_SIZE_HINTS (f)) 6358 if (FRAME_SIZE_HINTS (f))
6301 xfree (FRAME_SIZE_HINTS (f)); 6359 xfree (FRAME_SIZE_HINTS (f));
6302 6360
6361#if TARGET_API_MAC_CARBON
6362 if (FRAME_FILE_NAME (f))
6363 xfree (FRAME_FILE_NAME (f));
6364#endif
6365
6303 xfree (f->output_data.mac); 6366 xfree (f->output_data.mac);
6304 f->output_data.mac = NULL; 6367 f->output_data.mac = NULL;
6305 6368
@@ -7746,10 +7809,10 @@ XLoadQueryFont (Display *dpy, char *fontname)
7746 font->min_char_or_byte2 = 0; 7809 font->min_char_or_byte2 = 0;
7747 font->max_char_or_byte2 = 0xff; 7810 font->max_char_or_byte2 = 0xff;
7748 7811
7749 font->bounds.rows = xmalloc (sizeof (XCharStructRow *) * 0x100); 7812 font->bounds.rows = xmalloc (sizeof (XCharStruct *) * 0x100);
7750 bzero (font->bounds.rows, sizeof (XCharStructRow *) * 0x100); 7813 bzero (font->bounds.rows, sizeof (XCharStruct *) * 0x100);
7751 font->bounds.rows[0] = xmalloc (sizeof (XCharStructRow)); 7814 font->bounds.rows[0] = xmalloc (sizeof (XCharStruct) * 0x100);
7752 bzero (font->bounds.rows[0], sizeof (XCharStructRow)); 7815 pcm_init (font->bounds.rows[0], 0x100);
7753 7816
7754#if USE_CG_TEXT_DRAWING 7817#if USE_CG_TEXT_DRAWING
7755 { 7818 {
@@ -7775,7 +7838,7 @@ XLoadQueryFont (Display *dpy, char *fontname)
7775 bzero (font->cg_glyphs, sizeof (CGGlyph) * 0x100); 7838 bzero (font->cg_glyphs, sizeof (CGGlyph) * 0x100);
7776 } 7839 }
7777#endif 7840#endif
7778 space_bounds = font->bounds.rows[0]->per_char + 0x20; 7841 space_bounds = font->bounds.rows[0] + 0x20;
7779 err = mac_query_char_extents (font->mac_style, 0x20, 7842 err = mac_query_char_extents (font->mac_style, 0x20,
7780 &font->ascent, &font->descent, 7843 &font->ascent, &font->descent,
7781 space_bounds, 7844 space_bounds,
@@ -7791,9 +7854,8 @@ XLoadQueryFont (Display *dpy, char *fontname)
7791 mac_unload_font (&one_mac_display_info, font); 7854 mac_unload_font (&one_mac_display_info, font);
7792 return NULL; 7855 return NULL;
7793 } 7856 }
7794 XCHARSTRUCTROW_SET_CHAR_VALID (font->bounds.rows[0], 0x20);
7795 7857
7796 pcm = font->bounds.rows[0]->per_char; 7858 pcm = font->bounds.rows[0];
7797 for (c = 0x21; c <= 0xff; c++) 7859 for (c = 0x21; c <= 0xff; c++)
7798 { 7860 {
7799 if (c == 0xad) 7861 if (c == 0xad)
@@ -7813,7 +7875,6 @@ XLoadQueryFont (Display *dpy, char *fontname)
7813 NULL 7875 NULL
7814#endif 7876#endif
7815 ); 7877 );
7816 XCHARSTRUCTROW_SET_CHAR_VALID (font->bounds.rows[0], c);
7817 7878
7818#if USE_CG_TEXT_DRAWING 7879#if USE_CG_TEXT_DRAWING
7819 if (font->cg_glyphs && font->cg_glyphs[c] == 0) 7880 if (font->cg_glyphs && font->cg_glyphs[c] == 0)
@@ -9997,8 +10058,20 @@ XTread_socket (sd, expected, hold_quit)
9997 } 10058 }
9998 break; 10059 break;
9999 10060
10061#if TARGET_API_MAC_CARBON
10062 case inProxyIcon:
10063 if (TrackWindowProxyDrag (window_ptr, er.where)
10064 != errUserWantsToDragWindow)
10065 break;
10066 /* fall through */
10067#endif
10000 case inDrag: 10068 case inDrag:
10001#if TARGET_API_MAC_CARBON 10069#if TARGET_API_MAC_CARBON
10070 if (IsWindowPathSelectClick (window_ptr, &er))
10071 {
10072 WindowPathSelect (window_ptr, NULL, NULL);
10073 break;
10074 }
10002 DragWindow (window_ptr, er.where, NULL); 10075 DragWindow (window_ptr, er.where, NULL);
10003#else /* not TARGET_API_MAC_CARBON */ 10076#else /* not TARGET_API_MAC_CARBON */
10004 DragWindow (window_ptr, er.where, &qd.screenBits.bounds); 10077 DragWindow (window_ptr, er.where, &qd.screenBits.bounds);
@@ -11050,7 +11123,11 @@ button will be mouse-3. */);
11050 doc: /* *If non-nil, allow anti-aliasing. 11123 doc: /* *If non-nil, allow anti-aliasing.
11051The text will be rendered using Core Graphics text rendering which 11124The text will be rendered using Core Graphics text rendering which
11052may anti-alias the text. */); 11125may anti-alias the text. */);
11126#if USE_CG_DRAWING
11127 mac_use_core_graphics = 1;
11128#else
11053 mac_use_core_graphics = 0; 11129 mac_use_core_graphics = 0;
11130#endif
11054 11131
11055 /* Register an entry for `mac-roman' so that it can be used when 11132 /* Register an entry for `mac-roman' so that it can be used when
11056 creating the terminal frame on Mac OS 9 before loading 11133 creating the terminal frame on Mac OS 9 before loading
diff --git a/src/macterm.h b/src/macterm.h
index db284fe7788..80276b45102 100644
--- a/src/macterm.h
+++ b/src/macterm.h
@@ -335,6 +335,11 @@ struct mac_output {
335 /* Hints for the size and the position of a window. */ 335 /* Hints for the size and the position of a window. */
336 XSizeHints *size_hints; 336 XSizeHints *size_hints;
337 337
338#if TARGET_API_MAC_CARBON
339 /* File name for the proxy icon of this frame. Might be NULL. */
340 char *file_name;
341#endif
342
338#if USE_CG_DRAWING 343#if USE_CG_DRAWING
339 /* Quartz 2D graphics context. */ 344 /* Quartz 2D graphics context. */
340 CGContextRef cg_context; 345 CGContextRef cg_context;
@@ -357,6 +362,8 @@ typedef struct mac_output mac_output;
357 362
358#define FRAME_SIZE_HINTS(f) ((f)->output_data.mac->size_hints) 363#define FRAME_SIZE_HINTS(f) ((f)->output_data.mac->size_hints)
359 364
365#define FRAME_FILE_NAME(f) ((f)->output_data.mac->file_name)
366
360/* This gives the mac_display_info structure for the display F is on. */ 367/* This gives the mac_display_info structure for the display F is on. */
361#define FRAME_MAC_DISPLAY_INFO(f) (&one_mac_display_info) 368#define FRAME_MAC_DISPLAY_INFO(f) (&one_mac_display_info)
362#define FRAME_X_DISPLAY_INFO(f) (&one_mac_display_info) 369#define FRAME_X_DISPLAY_INFO(f) (&one_mac_display_info)
@@ -603,6 +610,7 @@ extern int x_char_width P_ ((struct frame *));
603extern int x_char_height P_ ((struct frame *)); 610extern int x_char_height P_ ((struct frame *));
604extern void x_sync P_ ((struct frame *)); 611extern void x_sync P_ ((struct frame *));
605extern void x_set_tool_bar_lines P_ ((struct frame *, Lisp_Object, Lisp_Object)); 612extern void x_set_tool_bar_lines P_ ((struct frame *, Lisp_Object, Lisp_Object));
613extern void mac_update_title_bar P_ ((struct frame *, int));
606 614
607/* Defined in macmenu.c */ 615/* Defined in macmenu.c */
608 616
diff --git a/src/syntax.c b/src/syntax.c
index 3f668eac946..1c8d0debbf3 100644
--- a/src/syntax.c
+++ b/src/syntax.c
@@ -2123,8 +2123,6 @@ between them, return t; otherwise return nil. */)
2123 while (1) 2123 while (1)
2124 { 2124 {
2125 DEC_BOTH (from, from_byte); 2125 DEC_BOTH (from, from_byte);
2126 if (from == stop)
2127 break;
2128 UPDATE_SYNTAX_TABLE_BACKWARD (from); 2126 UPDATE_SYNTAX_TABLE_BACKWARD (from);
2129 c = FETCH_CHAR (from_byte); 2127 c = FETCH_CHAR (from_byte);
2130 if (SYNTAX (c) == Scomment_fence 2128 if (SYNTAX (c) == Scomment_fence
@@ -2133,6 +2131,8 @@ between them, return t; otherwise return nil. */)
2133 found = 1; 2131 found = 1;
2134 break; 2132 break;
2135 } 2133 }
2134 else if (from == stop)
2135 break;
2136 } 2136 }
2137 if (found == 0) 2137 if (found == 0)
2138 { 2138 {
@@ -2140,6 +2140,9 @@ between them, return t; otherwise return nil. */)
2140 from_byte = ini_byte; 2140 from_byte = ini_byte;
2141 goto leave; 2141 goto leave;
2142 } 2142 }
2143 else
2144 /* We have skipped one comment. */
2145 break;
2143 } 2146 }
2144 else if (code == Sendcomment) 2147 else if (code == Sendcomment)
2145 { 2148 {
diff --git a/src/unexmacosx.c b/src/unexmacosx.c
index 4ca0be829a2..f65fd9cbc22 100644
--- a/src/unexmacosx.c
+++ b/src/unexmacosx.c
@@ -1021,6 +1021,9 @@ void
1021unexec (char *outfile, char *infile, void *start_data, void *start_bss, 1021unexec (char *outfile, char *infile, void *start_data, void *start_bss,
1022 void *entry_address) 1022 void *entry_address)
1023{ 1023{
1024 if (in_dumped_exec)
1025 unexec_error ("Unexec from a dumped executable is not supported.");
1026
1024 infd = open (infile, O_RDONLY, 0); 1027 infd = open (infile, O_RDONLY, 0);
1025 if (infd < 0) 1028 if (infd < 0)
1026 { 1029 {
diff --git a/src/xdisp.c b/src/xdisp.c
index 25dd0ffce3d..d05b1c5293d 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -8955,6 +8955,9 @@ prepare_menu_bars ()
8955 update_menu_bar (f, 0); 8955 update_menu_bar (f, 0);
8956#ifdef HAVE_WINDOW_SYSTEM 8956#ifdef HAVE_WINDOW_SYSTEM
8957 update_tool_bar (f, 0); 8957 update_tool_bar (f, 0);
8958#ifdef MAC_OS
8959 mac_update_title_bar (f, 0);
8960#endif
8958#endif 8961#endif
8959 UNGCPRO; 8962 UNGCPRO;
8960 } 8963 }
@@ -8967,6 +8970,9 @@ prepare_menu_bars ()
8967 update_menu_bar (sf, 1); 8970 update_menu_bar (sf, 1);
8968#ifdef HAVE_WINDOW_SYSTEM 8971#ifdef HAVE_WINDOW_SYSTEM
8969 update_tool_bar (sf, 1); 8972 update_tool_bar (sf, 1);
8973#ifdef MAC_OS
8974 mac_update_title_bar (sf, 1);
8975#endif
8970#endif 8976#endif
8971 } 8977 }
8972 8978
@@ -18534,8 +18540,7 @@ get_glyph_face_and_encoding (f, glyph, char2b, two_byte_p)
18534 sure to use a face suitable for unibyte. */ 18540 sure to use a face suitable for unibyte. */
18535 STORE_XCHAR2B (char2b, 0, glyph->u.ch); 18541 STORE_XCHAR2B (char2b, 0, glyph->u.ch);
18536 } 18542 }
18537 else if (glyph->u.ch < 128 18543 else if (glyph->u.ch < 128)
18538 && glyph->face_id < BASIC_FACE_ID_SENTINEL)
18539 { 18544 {
18540 /* Case of ASCII in a face known to fit ASCII. */ 18545 /* Case of ASCII in a face known to fit ASCII. */
18541 STORE_XCHAR2B (char2b, 0, glyph->u.ch); 18546 STORE_XCHAR2B (char2b, 0, glyph->u.ch);
@@ -18937,7 +18942,7 @@ get_char_face_and_encoding (f, c, face_id, char2b, multibyte_p, display_p)
18937 face_id = FACE_FOR_CHAR (f, face, c); 18942 face_id = FACE_FOR_CHAR (f, face, c);
18938 face = FACE_FROM_ID (f, face_id); 18943 face = FACE_FROM_ID (f, face_id);
18939 } 18944 }
18940 else if (c < 128 && face_id < BASIC_FACE_ID_SENTINEL) 18945 else if (c < 128)
18941 { 18946 {
18942 /* Case of ASCII in a face known to fit ASCII. */ 18947 /* Case of ASCII in a face known to fit ASCII. */
18943 STORE_XCHAR2B (char2b, 0, c); 18948 STORE_XCHAR2B (char2b, 0, c);
diff --git a/src/xmenu.c b/src/xmenu.c
index 6e5ec6c5058..794a6f22898 100644
--- a/src/xmenu.c
+++ b/src/xmenu.c
@@ -327,6 +327,7 @@ restore_menu_items (saved)
327 menu_items_n_panes = XINT (XCAR (saved)); 327 menu_items_n_panes = XINT (XCAR (saved));
328 saved = XCDR (saved); 328 saved = XCDR (saved);
329 menu_items_submenu_depth = XINT (XCAR (saved)); 329 menu_items_submenu_depth = XINT (XCAR (saved));
330 return Qnil;
330} 331}
331 332
332/* Push the whole state of menu_items processing onto the specpdl. 333/* Push the whole state of menu_items processing onto the specpdl.