aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSteven Tamm2004-09-02 17:00:12 +0000
committerSteven Tamm2004-09-02 17:00:12 +0000
commitb3459c95eb15cac76a1d3ad9c6f1801e1748ef78 (patch)
treefae02212763a9883c99c17f9ed8de37cdfd8c74f /src
parent2ca75b4224d8b99fb948a1a27e7fb92ec28db5a3 (diff)
downloademacs-b3459c95eb15cac76a1d3ad9c6f1801e1748ef78.tar.gz
emacs-b3459c95eb15cac76a1d3ad9c6f1801e1748ef78.zip
(x_real_positions): Save the current window port and
set a new one before obtaining the global coordinate. Use FRAME_MAC_WINDOW. (x_set_name, x_set_title): Encode title to UTF8. Use SetWindowTitleWithCFString. (Fx_server_version): Get correct OS version.
Diffstat (limited to 'src')
-rw-r--r--src/macfns.c49
1 files changed, 36 insertions, 13 deletions
diff --git a/src/macfns.c b/src/macfns.c
index fbade05ea17..3b09b344a55 100644
--- a/src/macfns.c
+++ b/src/macfns.c
@@ -324,19 +324,21 @@ x_real_positions (f, xptr, yptr)
324 Point pt; 324 Point pt;
325 GrafPtr oldport; 325 GrafPtr oldport;
326 326
327#ifdef TARGET_API_MAC_CARBON 327 GetPort (&oldport);
328 SetPortWindowPort (FRAME_MAC_WINDOW (f));
329
330#if TARGET_API_MAC_CARBON
328 { 331 {
329 Rect r; 332 Rect r;
330 333
331 GetWindowPortBounds (f->output_data.mac->mWP, &r); 334 GetWindowPortBounds (FRAME_MAC_WINDOW (f), &r);
332 SetPt (&pt, r.left, r.top); 335 SetPt (&pt, r.left, r.top);
333 } 336 }
334#else /* not TARGET_API_MAC_CARBON */ 337#else /* not TARGET_API_MAC_CARBON */
335 SetPt (&pt, 338 SetPt (&pt,
336 f->output_data.mac->mWP->portRect.left, 339 FRAME_MAC_WINDOW (f)->portRect.left,
337 f->output_data.mac->mWP->portRect.top); 340 FRAME_MAC_WINDOW (f)->portRect.top);
338#endif /* not TARGET_API_MAC_CARBON */ 341#endif /* not TARGET_API_MAC_CARBON */
339 GetPort (&oldport);
340 LocalToGlobal (&pt); 342 LocalToGlobal (&pt);
341 SetPort (oldport); 343 SetPort (oldport);
342 344
@@ -1934,8 +1936,8 @@ x_set_name (f, name, explicit)
1934 if (FRAME_MAC_WINDOW (f)) 1936 if (FRAME_MAC_WINDOW (f))
1935 { 1937 {
1936 if (STRING_MULTIBYTE (name)) 1938 if (STRING_MULTIBYTE (name))
1937#if 0 /* MAC_TODO: encoding title string */ 1939#if TARGET_API_MAC_CARBON
1938 name = ENCODE_SYSTEM (name); 1940 name = ENCODE_UTF_8 (name);
1939#else 1941#else
1940 return; 1942 return;
1941#endif 1943#endif
@@ -1943,6 +1945,14 @@ x_set_name (f, name, explicit)
1943 BLOCK_INPUT; 1945 BLOCK_INPUT;
1944 1946
1945 { 1947 {
1948#if TARGET_API_MAC_CARBON
1949 CFStringRef windowTitle =
1950 CFStringCreateWithCString (NULL, SDATA (name),
1951 kCFStringEncodingUTF8);
1952
1953 SetWindowTitleWithCFString (FRAME_MAC_WINDOW (f), windowTitle);
1954 CFRelease (windowTitle);
1955#else
1946 Str255 windowTitle; 1956 Str255 windowTitle;
1947 if (strlen (SDATA (name)) < 255) 1957 if (strlen (SDATA (name)) < 255)
1948 { 1958 {
@@ -1950,6 +1960,7 @@ x_set_name (f, name, explicit)
1950 c2pstr (windowTitle); 1960 c2pstr (windowTitle);
1951 SetWTitle (FRAME_MAC_WINDOW (f), windowTitle); 1961 SetWTitle (FRAME_MAC_WINDOW (f), windowTitle);
1952 } 1962 }
1963#endif
1953 } 1964 }
1954 1965
1955 UNBLOCK_INPUT; 1966 UNBLOCK_INPUT;
@@ -2008,8 +2019,8 @@ x_set_title (f, name, old_name)
2008 if (FRAME_MAC_WINDOW (f)) 2019 if (FRAME_MAC_WINDOW (f))
2009 { 2020 {
2010 if (STRING_MULTIBYTE (name)) 2021 if (STRING_MULTIBYTE (name))
2011#if 0 /* MAC_TODO: encoding title string */ 2022#if TARGET_API_MAC_CARBON
2012 name = ENCODE_SYSTEM (name); 2023 name = ENCODE_UTF_8 (name);
2013#else 2024#else
2014 return; 2025 return;
2015#endif 2026#endif
@@ -2017,6 +2028,14 @@ x_set_title (f, name, old_name)
2017 BLOCK_INPUT; 2028 BLOCK_INPUT;
2018 2029
2019 { 2030 {
2031#if TARGET_API_MAC_CARBON
2032 CFStringRef windowTitle =
2033 CFStringCreateWithCString (NULL, SDATA (name),
2034 kCFStringEncodingUTF8);
2035
2036 SetWindowTitleWithCFString (FRAME_MAC_WINDOW (f), windowTitle);
2037 CFRelease (windowTitle);
2038#else
2020 Str255 windowTitle; 2039 Str255 windowTitle;
2021 if (strlen (SDATA (name)) < 255) 2040 if (strlen (SDATA (name)) < 255)
2022 { 2041 {
@@ -2024,6 +2043,7 @@ x_set_title (f, name, old_name)
2024 c2pstr (windowTitle); 2043 c2pstr (windowTitle);
2025 SetWTitle (FRAME_MAC_WINDOW (f), windowTitle); 2044 SetWTitle (FRAME_MAC_WINDOW (f), windowTitle);
2026 } 2045 }
2046#endif
2027 } 2047 }
2028 2048
2029 UNBLOCK_INPUT; 2049 UNBLOCK_INPUT;
@@ -2981,17 +3001,20 @@ If omitted or nil, that stands for the selected frame's display. */)
2981 (display) 3001 (display)
2982 Lisp_Object display; 3002 Lisp_Object display;
2983{ 3003{
2984 int mac_major_version, mac_minor_version; 3004 int mac_major_version;
2985 SInt32 response; 3005 SInt32 response;
2986 3006
2987 if (Gestalt (gestaltSystemVersion, &response) != noErr) 3007 if (Gestalt (gestaltSystemVersion, &response) != noErr)
2988 error ("Cannot get Mac OS version"); 3008 error ("Cannot get Mac OS version");
2989 3009
2990 mac_major_version = (response >> 8) & 0xf; 3010 mac_major_version = (response >> 8) & 0xff;
2991 mac_minor_version = (response >> 4) & 0xf; 3011 /* convert BCD to int */
3012 mac_major_version -= (mac_major_version >> 4) * 6;
2992 3013
2993 return Fcons (make_number (mac_major_version), 3014 return Fcons (make_number (mac_major_version),
2994 Fcons (make_number (mac_minor_version), Qnil)); 3015 Fcons (make_number ((response >> 4) & 0xf),
3016 Fcons (make_number (response & 0xf),
3017 Qnil)));
2995} 3018}
2996 3019
2997DEFUN ("x-display-screens", Fx_display_screens, Sx_display_screens, 0, 1, 0, 3020DEFUN ("x-display-screens", Fx_display_screens, Sx_display_screens, 0, 1, 0,