aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKaroly Lorentey2007-01-06 15:25:16 +0000
committerKaroly Lorentey2007-01-06 15:25:16 +0000
commit191ae1cf7cd2571277635b3b8e488e773ca5c9b9 (patch)
treee0b26e3040767dae38fb39a03b757da05088c58f /src
parent382707ecfb50f8c7794a7ba3d8cd9db9b6cd29d0 (diff)
parentf85c5e3b72855951b071eacb7b6e2d002c5fc4be (diff)
downloademacs-191ae1cf7cd2571277635b3b8e488e773ca5c9b9.tar.gz
emacs-191ae1cf7cd2571277635b3b8e488e773ca5c9b9.zip
Merged from emacs@sv.gnu.org
Patches applied: * emacs@sv.gnu.org/emacs--devo--0--patch-585 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-586 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-587 Update from erc--emacs--22 * emacs@sv.gnu.org/emacs--devo--0--patch-588 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-589 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-590 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-591 Update from CVS git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-592
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog73
-rw-r--r--src/editfns.c38
-rw-r--r--src/gtkutil.c80
-rw-r--r--src/gtkutil.h2
-rw-r--r--src/indent.c19
-rw-r--r--src/mac.c8
-rw-r--r--src/macgui.h8
-rw-r--r--src/macmenu.c78
-rw-r--r--src/macterm.c170
-rw-r--r--src/macterm.h5
-rw-r--r--src/minibuf.c2
-rw-r--r--src/window.c3
12 files changed, 397 insertions, 89 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 3dc5a094d4a..97c9d4cbeb9 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,76 @@
12007-01-05 Kim F. Storm <storm@cua.dk>
2
3 * indent.c (Fvertical_motion): Fix it overshoot check for overlay
4 strings without embedded newlines immediately followed by newline.
5
62007-01-05 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
7
8 * editfns.c (Fformat_time_string, Fdecode_time, Fencode_time)
9 (Fcurrent_time_string, Fcurrent_time_zone): Add BLOCK_INPUT around
10 gmtime/localtime/emacs_memftimeu/mktime.
11
12 * mac.c (Fmac_set_file_creator): Use MAC_EMACS_CREATOR_CODE
13 instead of 'EMAx'.
14 [!MAC_OSX] (sys_open, sys_creat, sys_fopen): Likewise.
15
16 * macgui.h (struct _XGC) [USE_CG_DRAWING
17 && MAC_OS_X_VERSION_MAX_ALLOWED >= 1030]: New members cg_fore_color
18 and cg_back_color.
19
20 * macmenu.c (Vshow_help_function) [TARGET_API_MAC_CARBON]: Add extern.
21 (restore_show_help_function, menu_target_item_handler)
22 [TARGET_API_MAC_CARBON]: New functions.
23 (install_menu_target_item_handler): New function.
24 (add_menu_item) [TARGET_API_MAC_CARBON]: Set help string as menu
25 item property.
26
27 * macterm.c (CG_SET_FILL_COLOR_MAYBE_WITH_CGCOLOR)
28 (CG_SET_FILL_COLOR_WITH_GC_FOREGROUND)
29 (CG_SET_FILL_COLOR_WITH_GC_BACKGROUND)
30 (CG_SET_STROKE_COLOR_MAYBE_WITH_CGCOLOR)
31 (CG_SET_STROKE_COLOR_WITH_GC_FOREGROUND): New macros.
32 (mac_cg_color_space_rgb) [USE_CG_DRAWING]: New variable.
33 (mac_cg_color_black) [USE_CG_DRAWING
34 && MAC_OS_X_VERSION_MAX_ALLOWED >= 1030]: New variable.
35 (init_cg_color) [USE_CG_DRAWING]: New function.
36 (mac_draw_line, mac_draw_rectangle) [USE_CG_DRAWING]: Use
37 CG_SET_STROKE_COLOR_WITH_GC_FOREGROUND instead of CG_SET_STROKE_COLOR.
38 (mac_erase_rectangle, mac_clear_window, mac_draw_cg_image)
39 (mac_fill_rectangle, mac_draw_image_string_cg) [USE_CG_DRAWING]:
40 Use CG_SET_FILL_COLOR_WITH_GC_FOREGROUND or
41 CG_SET_FILL_COLOR_WITH_GC_BACKGROUND instead of CG_SET_FILL_COLOR.
42 (mac_draw_string_common) [MAC_OSX && USE_ATSUI]: Likewise.
43 (XCreateGC, XFreeGC, XSetForeground, XSetBackground) [USE_CG_DRAWING
44 && MAC_OS_X_VERSION_MAX_ALLOWED >= 1030]: Use gc->cg_fore_color and/or
45 gc->cg_back_color.
46 (install_drag_handler, remove_drag_handler): Make extern.
47 (install_menu_target_item_handler): Add extern.
48 (install_window_handler): Call install_menu_target_item_handler.
49 [MAC_OS8] (main): Use MAC_EMACS_CREATOR_CODE instead of 'EMAx'.
50 (mac_initialize) [USE_CG_DRAWING]: Call init_cg_color.
51
52 * macterm.h (MAC_EMACS_CREATOR_CODE): New enumerator.
53
542007-01-04 Juanma Barranquero <lekktu@gmail.com>
55
56 * window.c (Fwindow_end): Fix use of >= operator.
57
582007-01-03 Richard Stallman <rms@gnu.org>
59
60 * window.c (Fwindow_end): Check BUF_OVERLAY_MODIFF like BUF_MODIFF.
61
622007-01-02 Jan Dj,Ad(Brv <jan.h.d@swipnet.se>
63
64 * gtkutil.h (xg_menu_item_cb_data_): Remove highlight_id and
65 unhighlight_id.
66
67 * gtkutil.c (menuitem_highlight_callback): Invoked widget is the
68 parent of the menu item. Get menu item widget from event.
69 (xg_create_one_menuitem, xg_update_menu_item): highlight_id and
70 unhighlight_id has been removed.
71 (create_menus): Connect enter/leave-notify-event to the menu instead
72 of individual items.
73
12006-12-31 Jan Dj,Ad(Brv <jan.h.d@swipnet.se> 742006-12-31 Jan Dj,Ad(Brv <jan.h.d@swipnet.se>
2 75
3 * gtkutil.c (update_frame_tool_bar): Connect create-menu-proxy with 76 * gtkutil.c (update_frame_tool_bar): Connect create-menu-proxy with
diff --git a/src/editfns.c b/src/editfns.c
index 39f8f87c673..6089ee9a2e2 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -1678,7 +1678,9 @@ For example, to produce full ISO 8601 format, use "%Y-%m-%dT%T%z". */)
1678 /* This is probably enough. */ 1678 /* This is probably enough. */
1679 size = SBYTES (format_string) * 6 + 50; 1679 size = SBYTES (format_string) * 6 + 50;
1680 1680
1681 BLOCK_INPUT;
1681 tm = ut ? gmtime (&value) : localtime (&value); 1682 tm = ut ? gmtime (&value) : localtime (&value);
1683 UNBLOCK_INPUT;
1682 if (! tm) 1684 if (! tm)
1683 error ("Specified time is not representable"); 1685 error ("Specified time is not representable");
1684 1686
@@ -1690,18 +1692,22 @@ For example, to produce full ISO 8601 format, use "%Y-%m-%dT%T%z". */)
1690 int result; 1692 int result;
1691 1693
1692 buf[0] = '\1'; 1694 buf[0] = '\1';
1695 BLOCK_INPUT;
1693 result = emacs_memftimeu (buf, size, SDATA (format_string), 1696 result = emacs_memftimeu (buf, size, SDATA (format_string),
1694 SBYTES (format_string), 1697 SBYTES (format_string),
1695 tm, ut); 1698 tm, ut);
1699 UNBLOCK_INPUT;
1696 if ((result > 0 && result < size) || (result == 0 && buf[0] == '\0')) 1700 if ((result > 0 && result < size) || (result == 0 && buf[0] == '\0'))
1697 return code_convert_string_norecord (make_unibyte_string (buf, result), 1701 return code_convert_string_norecord (make_unibyte_string (buf, result),
1698 Vlocale_coding_system, 0); 1702 Vlocale_coding_system, 0);
1699 1703
1700 /* If buffer was too small, make it bigger and try again. */ 1704 /* If buffer was too small, make it bigger and try again. */
1705 BLOCK_INPUT;
1701 result = emacs_memftimeu (NULL, (size_t) -1, 1706 result = emacs_memftimeu (NULL, (size_t) -1,
1702 SDATA (format_string), 1707 SDATA (format_string),
1703 SBYTES (format_string), 1708 SBYTES (format_string),
1704 tm, ut); 1709 tm, ut);
1710 UNBLOCK_INPUT;
1705 size = result + 1; 1711 size = result + 1;
1706 } 1712 }
1707} 1713}
@@ -1732,7 +1738,9 @@ DOW and ZONE.) */)
1732 if (! lisp_time_argument (specified_time, &time_spec, NULL)) 1738 if (! lisp_time_argument (specified_time, &time_spec, NULL))
1733 error ("Invalid time specification"); 1739 error ("Invalid time specification");
1734 1740
1741 BLOCK_INPUT;
1735 decoded_time = localtime (&time_spec); 1742 decoded_time = localtime (&time_spec);
1743 UNBLOCK_INPUT;
1736 if (! decoded_time) 1744 if (! decoded_time)
1737 error ("Specified time is not representable"); 1745 error ("Specified time is not representable");
1738 XSETFASTINT (list_args[0], decoded_time->tm_sec); 1746 XSETFASTINT (list_args[0], decoded_time->tm_sec);
@@ -1748,7 +1756,9 @@ DOW and ZONE.) */)
1748 1756
1749 /* Make a copy, in case gmtime modifies the struct. */ 1757 /* Make a copy, in case gmtime modifies the struct. */
1750 save_tm = *decoded_time; 1758 save_tm = *decoded_time;
1759 BLOCK_INPUT;
1751 decoded_time = gmtime (&time_spec); 1760 decoded_time = gmtime (&time_spec);
1761 UNBLOCK_INPUT;
1752 if (decoded_time == 0) 1762 if (decoded_time == 0)
1753 list_args[8] = Qnil; 1763 list_args[8] = Qnil;
1754 else 1764 else
@@ -1804,7 +1814,11 @@ usage: (encode-time SECOND MINUTE HOUR DAY MONTH YEAR &optional ZONE) */)
1804 if (CONSP (zone)) 1814 if (CONSP (zone))
1805 zone = Fcar (zone); 1815 zone = Fcar (zone);
1806 if (NILP (zone)) 1816 if (NILP (zone))
1807 time = mktime (&tm); 1817 {
1818 BLOCK_INPUT;
1819 time = mktime (&tm);
1820 UNBLOCK_INPUT;
1821 }
1808 else 1822 else
1809 { 1823 {
1810 char tzbuf[100]; 1824 char tzbuf[100];
@@ -1829,7 +1843,9 @@ usage: (encode-time SECOND MINUTE HOUR DAY MONTH YEAR &optional ZONE) */)
1829 value doesn't suffice, since that would mishandle leap seconds. */ 1843 value doesn't suffice, since that would mishandle leap seconds. */
1830 set_time_zone_rule (tzstring); 1844 set_time_zone_rule (tzstring);
1831 1845
1846 BLOCK_INPUT;
1832 time = mktime (&tm); 1847 time = mktime (&tm);
1848 UNBLOCK_INPUT;
1833 1849
1834 /* Restore TZ to previous value. */ 1850 /* Restore TZ to previous value. */
1835 newenv = environ; 1851 newenv = environ;
@@ -1873,7 +1889,9 @@ but this is considered obsolete. */)
1873 /* Convert to a string, checking for out-of-range time stamps. 1889 /* Convert to a string, checking for out-of-range time stamps.
1874 Don't use 'ctime', as that might dump core if VALUE is out of 1890 Don't use 'ctime', as that might dump core if VALUE is out of
1875 range. */ 1891 range. */
1892 BLOCK_INPUT;
1876 tm = localtime (&value); 1893 tm = localtime (&value);
1894 UNBLOCK_INPUT;
1877 if (! (tm && TM_YEAR_IN_ASCTIME_RANGE (tm->tm_year) && (tem = asctime (tm)))) 1895 if (! (tm && TM_YEAR_IN_ASCTIME_RANGE (tm->tm_year) && (tem = asctime (tm))))
1878 error ("Specified time is not representable"); 1896 error ("Specified time is not representable");
1879 1897
@@ -1929,9 +1947,21 @@ the data it can't find. */)
1929 struct tm *t; 1947 struct tm *t;
1930 struct tm gmt; 1948 struct tm gmt;
1931 1949
1932 if (lisp_time_argument (specified_time, &value, NULL) 1950 if (!lisp_time_argument (specified_time, &value, NULL))
1933 && (t = gmtime (&value)) != 0 1951 t = NULL;
1934 && (gmt = *t, t = localtime (&value)) != 0) 1952 else
1953 {
1954 BLOCK_INPUT;
1955 t = gmtime (&value);
1956 if (t)
1957 {
1958 gmt = *t;
1959 t = localtime (&value);
1960 }
1961 UNBLOCK_INPUT;
1962 }
1963
1964 if (t)
1935 { 1965 {
1936 int offset = tm_diff (t, &gmt); 1966 int offset = tm_diff (t, &gmt);
1937 char *s = 0; 1967 char *s = 0;
diff --git a/src/gtkutil.c b/src/gtkutil.c
index d136dbe0fce..d57a0b56c0c 100644
--- a/src/gtkutil.c
+++ b/src/gtkutil.c
@@ -1718,9 +1718,9 @@ menuitem_destroy_callback (w, client_data)
1718} 1718}
1719 1719
1720/* Callback called when the pointer enters/leaves a menu item. 1720/* Callback called when the pointer enters/leaves a menu item.
1721 W is the menu item. 1721 W is the parent of the menu item.
1722 EVENT is either an enter event or leave event. 1722 EVENT is either an enter event or leave event.
1723 CLIENT_DATA points to the xg_menu_item_cb_data associated with the W. 1723 CLIENT_DATA is not used.
1724 1724
1725 Returns FALSE to tell GTK to keep processing this event. */ 1725 Returns FALSE to tell GTK to keep processing this event. */
1726 1726
@@ -1730,15 +1730,21 @@ menuitem_highlight_callback (w, event, client_data)
1730 GdkEventCrossing *event; 1730 GdkEventCrossing *event;
1731 gpointer client_data; 1731 gpointer client_data;
1732{ 1732{
1733 if (client_data) 1733 GdkEvent ev;
1734 { 1734 GtkWidget *subwidget;
1735 xg_menu_item_cb_data *data = (xg_menu_item_cb_data*) client_data; 1735 xg_menu_item_cb_data *data;
1736 gpointer call_data = event->type == GDK_LEAVE_NOTIFY ? 0 : client_data;
1737 1736
1737 ev.crossing = *event;
1738 subwidget = gtk_get_event_widget (&ev);
1739 data = (xg_menu_item_cb_data *) g_object_get_data (G_OBJECT (subwidget),
1740 XG_ITEM_DATA);
1741 if (data)
1742 {
1738 if (! NILP (data->help) && data->cl_data->highlight_cb) 1743 if (! NILP (data->help) && data->cl_data->highlight_cb)
1739 { 1744 {
1745 gpointer call_data = event->type == GDK_LEAVE_NOTIFY ? 0 : data;
1740 GtkCallback func = (GtkCallback) data->cl_data->highlight_cb; 1746 GtkCallback func = (GtkCallback) data->cl_data->highlight_cb;
1741 (*func) (w, call_data); 1747 (*func) (subwidget, call_data);
1742 } 1748 }
1743 } 1749 }
1744 1750
@@ -2004,7 +2010,7 @@ xg_create_one_menuitem (item, f, select_cb, highlight_cb, cl_data, group)
2004 2010
2005 xg_list_insert (&xg_menu_item_cb_list, &cb_data->ptrs); 2011 xg_list_insert (&xg_menu_item_cb_list, &cb_data->ptrs);
2006 2012
2007 cb_data->unhighlight_id = cb_data->highlight_id = cb_data->select_id = 0; 2013 cb_data->select_id = 0;
2008 cb_data->help = item->help; 2014 cb_data->help = item->help;
2009 cb_data->cl_data = cl_data; 2015 cb_data->cl_data = cl_data;
2010 cb_data->call_data = item->call_data; 2016 cb_data->call_data = item->call_data;
@@ -2025,22 +2031,6 @@ xg_create_one_menuitem (item, f, select_cb, highlight_cb, cl_data, group)
2025 = g_signal_connect (G_OBJECT (w), "activate", select_cb, cb_data); 2031 = g_signal_connect (G_OBJECT (w), "activate", select_cb, cb_data);
2026 } 2032 }
2027 2033
2028 if (! NILP (item->help) && highlight_cb)
2029 {
2030 /* We use enter/leave notify instead of select/deselect because
2031 select/deselect doesn't go well with detached menus. */
2032 cb_data->highlight_id
2033 = g_signal_connect (G_OBJECT (w),
2034 "enter-notify-event",
2035 G_CALLBACK (menuitem_highlight_callback),
2036 cb_data);
2037 cb_data->unhighlight_id
2038 = g_signal_connect (G_OBJECT (w),
2039 "leave-notify-event",
2040 G_CALLBACK (menuitem_highlight_callback),
2041 cb_data);
2042 }
2043
2044 return w; 2034 return w;
2045} 2035}
2046 2036
@@ -2123,6 +2113,17 @@ create_menus (data, f, select_cb, deactivate_cb, highlight_cb,
2123 { 2113 {
2124 wmenu = gtk_menu_new (); 2114 wmenu = gtk_menu_new ();
2125 xg_set_screen (wmenu, f); 2115 xg_set_screen (wmenu, f);
2116 /* Connect this to the menu instead of items so we get enter/leave for
2117 disabled items also. TODO: Still does not get enter/leave for
2118 disabled items in detached menus. */
2119 g_signal_connect (G_OBJECT (wmenu),
2120 "enter-notify-event",
2121 G_CALLBACK (menuitem_highlight_callback),
2122 NULL);
2123 g_signal_connect (G_OBJECT (wmenu),
2124 "leave-notify-event",
2125 G_CALLBACK (menuitem_highlight_callback),
2126 NULL);
2126 } 2127 }
2127 else wmenu = gtk_menu_bar_new (); 2128 else wmenu = gtk_menu_bar_new ();
2128 2129
@@ -2619,37 +2620,6 @@ xg_update_menu_item (val, w, select_cb, highlight_cb, cl_data)
2619 g_signal_handler_disconnect (w, cb_data->select_id); 2620 g_signal_handler_disconnect (w, cb_data->select_id);
2620 cb_data->select_id = 0; 2621 cb_data->select_id = 0;
2621 } 2622 }
2622
2623 if (NILP (cb_data->help))
2624 {
2625 /* Shall not have help. Remove if any existed previously. */
2626 if (cb_data->highlight_id)
2627 {
2628 g_signal_handler_disconnect (G_OBJECT (w),
2629 cb_data->highlight_id);
2630 cb_data->highlight_id = 0;
2631 }
2632 if (cb_data->unhighlight_id)
2633 {
2634 g_signal_handler_disconnect (G_OBJECT (w),
2635 cb_data->unhighlight_id);
2636 cb_data->unhighlight_id = 0;
2637 }
2638 }
2639 else if (! cb_data->highlight_id && highlight_cb)
2640 {
2641 /* Have help now, but didn't previously. Add callback. */
2642 cb_data->highlight_id
2643 = g_signal_connect (G_OBJECT (w),
2644 "enter-notify-event",
2645 G_CALLBACK (menuitem_highlight_callback),
2646 cb_data);
2647 cb_data->unhighlight_id
2648 = g_signal_connect (G_OBJECT (w),
2649 "leave-notify-event",
2650 G_CALLBACK (menuitem_highlight_callback),
2651 cb_data);
2652 }
2653 } 2623 }
2654} 2624}
2655 2625
diff --git a/src/gtkutil.h b/src/gtkutil.h
index 742e3ecb1e5..c3957223a18 100644
--- a/src/gtkutil.h
+++ b/src/gtkutil.h
@@ -79,8 +79,6 @@ typedef struct xg_menu_item_cb_data_
79{ 79{
80 xg_list_node ptrs; 80 xg_list_node ptrs;
81 81
82 gulong highlight_id;
83 gulong unhighlight_id;
84 gulong select_id; 82 gulong select_id;
85 Lisp_Object help; 83 Lisp_Object help;
86 gpointer call_data; 84 gpointer call_data;
diff --git a/src/indent.c b/src/indent.c
index e84059972f3..af556bc38e3 100644
--- a/src/indent.c
+++ b/src/indent.c
@@ -2076,7 +2076,7 @@ whether or not it is currently displayed in some window. */)
2076 { 2076 {
2077 int it_start; 2077 int it_start;
2078 int oselective; 2078 int oselective;
2079 int it_overshoot_expected_p; 2079 int it_overshoot_expected;
2080 2080
2081 SET_TEXT_POS (pt, PT, PT_BYTE); 2081 SET_TEXT_POS (pt, PT, PT_BYTE);
2082 start_display (&it, w, pt); 2082 start_display (&it, w, pt);
@@ -2102,12 +2102,16 @@ whether or not it is currently displayed in some window. */)
2102 while (s < e && *s != '\n') 2102 while (s < e && *s != '\n')
2103 ++s; 2103 ++s;
2104 2104
2105 it_overshoot_expected_p = (s == e); 2105 /* If there is no newline in the string, we need to check
2106 whether there is a newline immediately after the string
2107 in move_it_to below. This may happen if there is an
2108 overlay with an after-string just before the newline. */
2109 it_overshoot_expected = (s == e) ? -1 : 0;
2106 } 2110 }
2107 else 2111 else
2108 it_overshoot_expected_p = (it.method == GET_FROM_IMAGE 2112 it_overshoot_expected = (it.method == GET_FROM_IMAGE
2109 || it.method == GET_FROM_STRETCH 2113 || it.method == GET_FROM_STRETCH
2110 || it.method == GET_FROM_COMPOSITION); 2114 || it.method == GET_FROM_COMPOSITION);
2111 2115
2112 reseat_at_previous_visible_line_start (&it); 2116 reseat_at_previous_visible_line_start (&it);
2113 it.current_x = it.hpos = 0; 2117 it.current_x = it.hpos = 0;
@@ -2121,7 +2125,10 @@ whether or not it is currently displayed in some window. */)
2121 truncate-lines is on and PT is beyond right margin. 2125 truncate-lines is on and PT is beyond right margin.
2122 Don't go back if the overshoot is expected (see above). */ 2126 Don't go back if the overshoot is expected (see above). */
2123 if (IT_CHARPOS (it) > it_start && XINT (lines) > 0 2127 if (IT_CHARPOS (it) > it_start && XINT (lines) > 0
2124 && !it_overshoot_expected_p) 2128 && (!it_overshoot_expected
2129 || (it_overshoot_expected < 0
2130 && it.method == GET_FROM_BUFFER
2131 && it.c == '\n')))
2125 move_it_by_lines (&it, -1, 0); 2132 move_it_by_lines (&it, -1, 0);
2126 2133
2127 it.vpos = 0; 2134 it.vpos = 0;
diff --git a/src/mac.c b/src/mac.c
index 7a08d828725..d834bfb8de4 100644
--- a/src/mac.c
+++ b/src/mac.c
@@ -2261,7 +2261,7 @@ sys_open (const char *path, int oflag)
2261 int res = open (mac_pathname, oflag); 2261 int res = open (mac_pathname, oflag);
2262 /* if (oflag == O_WRONLY || oflag == O_RDWR) */ 2262 /* if (oflag == O_WRONLY || oflag == O_RDWR) */
2263 if (oflag & O_CREAT) 2263 if (oflag & O_CREAT)
2264 fsetfileinfo (mac_pathname, 'EMAx', 'TEXT'); 2264 fsetfileinfo (mac_pathname, MAC_EMACS_CREATOR_CODE, 'TEXT');
2265 return res; 2265 return res;
2266#else /* not __MRC__ */ 2266#else /* not __MRC__ */
2267 return open (mac_pathname, oflag); 2267 return open (mac_pathname, oflag);
@@ -2287,7 +2287,7 @@ sys_creat (const char *path, mode_t mode)
2287 { 2287 {
2288#ifdef __MRC__ 2288#ifdef __MRC__
2289 int result = creat (mac_pathname); 2289 int result = creat (mac_pathname);
2290 fsetfileinfo (mac_pathname, 'EMAx', 'TEXT'); 2290 fsetfileinfo (mac_pathname, MAC_EMACS_CREATOR_CODE, 'TEXT');
2291 return result; 2291 return result;
2292#else /* not __MRC__ */ 2292#else /* not __MRC__ */
2293 return creat (mac_pathname, mode); 2293 return creat (mac_pathname, mode);
@@ -2415,7 +2415,7 @@ sys_fopen (const char *name, const char *mode)
2415 { 2415 {
2416#ifdef __MRC__ 2416#ifdef __MRC__
2417 if (mode[0] == 'w' || mode[0] == 'a') 2417 if (mode[0] == 'w' || mode[0] == 'a')
2418 fsetfileinfo (mac_pathname, 'EMAx', 'TEXT'); 2418 fsetfileinfo (mac_pathname, MAC_EMACS_CREATOR_CODE, 'TEXT');
2419#endif /* not __MRC__ */ 2419#endif /* not __MRC__ */
2420 return fopen (mac_pathname, mode); 2420 return fopen (mac_pathname, mode);
2421 } 2421 }
@@ -4316,7 +4316,7 @@ assumed. Return non-nil if successful. */)
4316 OSType cCode; 4316 OSType cCode;
4317 CHECK_STRING (filename); 4317 CHECK_STRING (filename);
4318 4318
4319 cCode = mac_get_code_from_arg(code, 'EMAx'); 4319 cCode = mac_get_code_from_arg(code, MAC_EMACS_CREATOR_CODE);
4320 4320
4321 if (NILP(Ffile_exists_p(filename)) || !NILP(Ffile_directory_p(filename))) { 4321 if (NILP(Ffile_exists_p(filename)) || !NILP(Ffile_directory_p(filename))) {
4322 return Qnil; 4322 return Qnil;
diff --git a/src/macgui.h b/src/macgui.h
index 1ea53af59be..3a9913181de 100644
--- a/src/macgui.h
+++ b/src/macgui.h
@@ -244,6 +244,14 @@ typedef struct _XGC
244 /* QuickDraw background color. */ 244 /* QuickDraw background color. */
245 RGBColor back_color; 245 RGBColor back_color;
246 246
247#if USE_CG_DRAWING && MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
248 /* Quartz 2D foreground color. */
249 CGColorRef cg_fore_color;
250
251 /* Quartz 2D background color. */
252 CGColorRef cg_back_color;
253#endif
254
247#define MAX_CLIP_RECTS 2 255#define MAX_CLIP_RECTS 2
248 /* Number of clipping rectangles. */ 256 /* Number of clipping rectangles. */
249 int n_clip_rects; 257 int n_clip_rects;
diff --git a/src/macmenu.c b/src/macmenu.c
index 14bfe92cb25..9981250979a 100644
--- a/src/macmenu.c
+++ b/src/macmenu.c
@@ -1450,6 +1450,80 @@ update_submenu_strings (first_wv)
1450} 1450}
1451 1451
1452 1452
1453#if TARGET_API_MAC_CARBON
1454extern Lisp_Object Vshow_help_function;
1455
1456static Lisp_Object
1457restore_show_help_function (old_show_help_function)
1458 Lisp_Object old_show_help_function;
1459{
1460 Vshow_help_function = old_show_help_function;
1461
1462 return Qnil;
1463}
1464
1465static pascal OSStatus
1466menu_target_item_handler (next_handler, event, data)
1467 EventHandlerCallRef next_handler;
1468 EventRef event;
1469 void *data;
1470{
1471 OSStatus err, result;
1472 MenuRef menu;
1473 MenuItemIndex menu_item;
1474 Lisp_Object help;
1475 GrafPtr port;
1476 int specpdl_count = SPECPDL_INDEX ();
1477
1478 result = CallNextEventHandler (next_handler, event);
1479
1480 err = GetEventParameter (event, kEventParamDirectObject, typeMenuRef,
1481 NULL, sizeof (MenuRef), NULL, &menu);
1482 if (err == noErr)
1483 err = GetEventParameter (event, kEventParamMenuItemIndex,
1484 typeMenuItemIndex, NULL,
1485 sizeof (MenuItemIndex), NULL, &menu_item);
1486 if (err == noErr)
1487 err = GetMenuItemProperty (menu, menu_item,
1488 MAC_EMACS_CREATOR_CODE, 'help',
1489 sizeof (Lisp_Object), NULL, &help);
1490 if (err != noErr)
1491 help = Qnil;
1492
1493 /* Temporarily bind Vshow_help_function to Qnil because we don't
1494 want tooltips during menu tracking. */
1495 record_unwind_protect (restore_show_help_function, Vshow_help_function);
1496 Vshow_help_function = Qnil;
1497 GetPort (&port);
1498 show_help_echo (help, Qnil, Qnil, Qnil, 1);
1499 SetPort (port);
1500 unbind_to (specpdl_count, Qnil);
1501
1502 return err == noErr ? noErr : result;
1503}
1504#endif
1505
1506OSStatus
1507install_menu_target_item_handler (window)
1508 WindowPtr window;
1509{
1510 OSStatus err = noErr;
1511#if TARGET_API_MAC_CARBON
1512 static const EventTypeSpec specs[] =
1513 {{kEventClassMenu, kEventMenuTargetItem}};
1514 static EventHandlerUPP menu_target_item_handlerUPP = NULL;
1515
1516 if (menu_target_item_handlerUPP == NULL)
1517 menu_target_item_handlerUPP =
1518 NewEventHandlerUPP (menu_target_item_handler);
1519
1520 err = InstallWindowEventHandler (window, menu_target_item_handlerUPP,
1521 GetEventTypeCount (specs), specs,
1522 NULL, NULL);
1523#endif
1524 return err;
1525}
1526
1453/* Event handler function that pops down a menu on C-g. We can only pop 1527/* Event handler function that pops down a menu on C-g. We can only pop
1454 down menus if CancelMenuTracking is present (OSX 10.3 or later). */ 1528 down menus if CancelMenuTracking is present (OSX 10.3 or later). */
1455 1529
@@ -2485,6 +2559,10 @@ add_menu_item (menu, pos, wv)
2485 EnableMenuItem (menu, pos); 2559 EnableMenuItem (menu, pos);
2486 else 2560 else
2487 DisableMenuItem (menu, pos); 2561 DisableMenuItem (menu, pos);
2562
2563 if (STRINGP (wv->help))
2564 SetMenuItemProperty (menu, pos, MAC_EMACS_CREATOR_CODE, 'help',
2565 sizeof (Lisp_Object), &wv->help);
2488#else /* ! TARGET_API_MAC_CARBON */ 2566#else /* ! TARGET_API_MAC_CARBON */
2489 item_name[sizeof (item_name) - 1] = '\0'; 2567 item_name[sizeof (item_name) - 1] = '\0';
2490 strncpy (item_name, wv->name, sizeof (item_name) - 1); 2568 strncpy (item_name, wv->name, sizeof (item_name) - 1);
diff --git a/src/macterm.c b/src/macterm.c
index 6eaf549ba85..7c3f036f1ba 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 *));
288static int max_fringe_bmp = 0; 335static int max_fringe_bmp = 0;
289static CGImageRef *fringe_bmp = 0; 336static CGImageRef *fringe_bmp = 0;
290 337
338static CGColorSpaceRef mac_cg_color_space_rgb;
339#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
340static CGColorRef mac_cg_color_black;
341#endif
342
343static void
344init_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
291static CGContextRef 361static CGContextRef
292mac_begin_cg_clip (f, gc) 362mac_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,
8738extern OSErr init_coercion_handler P_ ((void)); 8868extern OSErr init_coercion_handler P_ ((void));
8739 8869
8740/* Drag and Drop */ 8870/* Drag and Drop */
8741OSErr install_drag_handler P_ ((WindowRef)); 8871extern OSErr install_drag_handler P_ ((WindowRef));
8742void remove_drag_handler P_ ((WindowRef)); 8872extern void remove_drag_handler P_ ((WindowRef));
8873
8874/* Showing help echo string during menu tracking */
8875extern 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
8746extern void init_service_handler (); 8879extern void init_service_handler ();
8747static Lisp_Object Qservice, Qpaste, Qperform; 8880static Lisp_Object Qservice, Qpaste, Qperform;
8748#endif 8881#endif
8882
8749/* Window Event Handler */ 8883/* Window Event Handler */
8750static pascal OSStatus mac_handle_window_event (EventHandlerCallRef, 8884static 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
@@ -11692,6 +11828,8 @@ mac_initialize ()
11692#endif 11828#endif
11693 11829
11694#if USE_CG_DRAWING 11830#if USE_CG_DRAWING
11831 init_cg_color ();
11832
11695 mac_init_fringe (); 11833 mac_init_fringe ();
11696#endif 11834#endif
11697 11835
diff --git a/src/macterm.h b/src/macterm.h
index a7e4ccff775..c941fafb690 100644
--- a/src/macterm.h
+++ b/src/macterm.h
@@ -528,6 +528,11 @@ struct scroll_bar {
528#define HOURGLASS_HEIGHT 16 528#define HOURGLASS_HEIGHT 16
529 529
530/* Some constants that are used locally. */ 530/* Some constants that are used locally. */
531/* Creator code for Emacs on Mac OS. */
532enum {
533 MAC_EMACS_CREATOR_CODE = 'EMAx'
534};
535
531/* Apple event descriptor types */ 536/* Apple event descriptor types */
532enum { 537enum {
533 TYPE_FILE_NAME = 'fNam' 538 TYPE_FILE_NAME = 'fNam'
diff --git a/src/minibuf.c b/src/minibuf.c
index 7b276a2e925..3778d185e97 100644
--- a/src/minibuf.c
+++ b/src/minibuf.c
@@ -989,7 +989,7 @@ POSITION in the minibuffer. Any integer value less than or equal to
989one puts point at the beginning of the string. *Note* that this 989one puts point at the beginning of the string. *Note* that this
990behavior differs from the way such arguments are used in `completing-read' 990behavior differs from the way such arguments are used in `completing-read'
991and some related functions, which use zero-indexing for POSITION. */) 991and some related functions, which use zero-indexing for POSITION. */)
992(prompt, initial_contents, keymap, read, hist, default_value, inherit_input_method) 992 (prompt, initial_contents, keymap, read, hist, default_value, inherit_input_method)
993 Lisp_Object prompt, initial_contents, keymap, read, hist, default_value; 993 Lisp_Object prompt, initial_contents, keymap, read, hist, default_value;
994 Lisp_Object inherit_input_method; 994 Lisp_Object inherit_input_method;
995{ 995{
diff --git a/src/window.c b/src/window.c
index b34cc3659c1..00a2e06bdeb 100644
--- a/src/window.c
+++ b/src/window.c
@@ -1184,7 +1184,8 @@ if it isn't already recorded. */)
1184 1184
1185 if (! NILP (update) 1185 if (! NILP (update)
1186 && ! (! NILP (w->window_end_valid) 1186 && ! (! NILP (w->window_end_valid)
1187 && XFASTINT (w->last_modified) >= BUF_MODIFF (b)) 1187 && XFASTINT (w->last_modified) >= BUF_MODIFF (b)
1188 && XFASTINT (w->last_overlay_modified) >= BUF_OVERLAY_MODIFF (b))
1188 && !noninteractive) 1189 && !noninteractive)
1189 { 1190 {
1190 struct text_pos startp; 1191 struct text_pos startp;