Commit b3459c95 authored by Steven Tamm's avatar Steven Tamm

(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.
parent 2ca75b42
...@@ -324,19 +324,21 @@ x_real_positions (f, xptr, yptr) ...@@ -324,19 +324,21 @@ x_real_positions (f, xptr, yptr)
Point pt; Point pt;
GrafPtr oldport; GrafPtr oldport;
#ifdef TARGET_API_MAC_CARBON GetPort (&oldport);
SetPortWindowPort (FRAME_MAC_WINDOW (f));
#if TARGET_API_MAC_CARBON
{ {
Rect r; Rect r;
GetWindowPortBounds (f->output_data.mac->mWP, &r); GetWindowPortBounds (FRAME_MAC_WINDOW (f), &r);
SetPt (&pt, r.left, r.top); SetPt (&pt, r.left, r.top);
} }
#else /* not TARGET_API_MAC_CARBON */ #else /* not TARGET_API_MAC_CARBON */
SetPt (&pt, SetPt (&pt,
f->output_data.mac->mWP->portRect.left, FRAME_MAC_WINDOW (f)->portRect.left,
f->output_data.mac->mWP->portRect.top); FRAME_MAC_WINDOW (f)->portRect.top);
#endif /* not TARGET_API_MAC_CARBON */ #endif /* not TARGET_API_MAC_CARBON */
GetPort (&oldport);
LocalToGlobal (&pt); LocalToGlobal (&pt);
SetPort (oldport); SetPort (oldport);
...@@ -1934,8 +1936,8 @@ x_set_name (f, name, explicit) ...@@ -1934,8 +1936,8 @@ x_set_name (f, name, explicit)
if (FRAME_MAC_WINDOW (f)) if (FRAME_MAC_WINDOW (f))
{ {
if (STRING_MULTIBYTE (name)) if (STRING_MULTIBYTE (name))
#if 0 /* MAC_TODO: encoding title string */ #if TARGET_API_MAC_CARBON
name = ENCODE_SYSTEM (name); name = ENCODE_UTF_8 (name);
#else #else
return; return;
#endif #endif
...@@ -1943,6 +1945,14 @@ x_set_name (f, name, explicit) ...@@ -1943,6 +1945,14 @@ x_set_name (f, name, explicit)
BLOCK_INPUT; BLOCK_INPUT;
{ {
#if TARGET_API_MAC_CARBON
CFStringRef windowTitle =
CFStringCreateWithCString (NULL, SDATA (name),
kCFStringEncodingUTF8);
SetWindowTitleWithCFString (FRAME_MAC_WINDOW (f), windowTitle);
CFRelease (windowTitle);
#else
Str255 windowTitle; Str255 windowTitle;
if (strlen (SDATA (name)) < 255) if (strlen (SDATA (name)) < 255)
{ {
...@@ -1950,6 +1960,7 @@ x_set_name (f, name, explicit) ...@@ -1950,6 +1960,7 @@ x_set_name (f, name, explicit)
c2pstr (windowTitle); c2pstr (windowTitle);
SetWTitle (FRAME_MAC_WINDOW (f), windowTitle); SetWTitle (FRAME_MAC_WINDOW (f), windowTitle);
} }
#endif
} }
UNBLOCK_INPUT; UNBLOCK_INPUT;
...@@ -2008,8 +2019,8 @@ x_set_title (f, name, old_name) ...@@ -2008,8 +2019,8 @@ x_set_title (f, name, old_name)
if (FRAME_MAC_WINDOW (f)) if (FRAME_MAC_WINDOW (f))
{ {
if (STRING_MULTIBYTE (name)) if (STRING_MULTIBYTE (name))
#if 0 /* MAC_TODO: encoding title string */ #if TARGET_API_MAC_CARBON
name = ENCODE_SYSTEM (name); name = ENCODE_UTF_8 (name);
#else #else
return; return;
#endif #endif
...@@ -2017,6 +2028,14 @@ x_set_title (f, name, old_name) ...@@ -2017,6 +2028,14 @@ x_set_title (f, name, old_name)
BLOCK_INPUT; BLOCK_INPUT;
{ {
#if TARGET_API_MAC_CARBON
CFStringRef windowTitle =
CFStringCreateWithCString (NULL, SDATA (name),
kCFStringEncodingUTF8);
SetWindowTitleWithCFString (FRAME_MAC_WINDOW (f), windowTitle);
CFRelease (windowTitle);
#else
Str255 windowTitle; Str255 windowTitle;
if (strlen (SDATA (name)) < 255) if (strlen (SDATA (name)) < 255)
{ {
...@@ -2024,6 +2043,7 @@ x_set_title (f, name, old_name) ...@@ -2024,6 +2043,7 @@ x_set_title (f, name, old_name)
c2pstr (windowTitle); c2pstr (windowTitle);
SetWTitle (FRAME_MAC_WINDOW (f), windowTitle); SetWTitle (FRAME_MAC_WINDOW (f), windowTitle);
} }
#endif
} }
UNBLOCK_INPUT; UNBLOCK_INPUT;
...@@ -2981,17 +3001,20 @@ If omitted or nil, that stands for the selected frame's display. */) ...@@ -2981,17 +3001,20 @@ If omitted or nil, that stands for the selected frame's display. */)
(display) (display)
Lisp_Object display; Lisp_Object display;
{ {
int mac_major_version, mac_minor_version; int mac_major_version;
SInt32 response; SInt32 response;
if (Gestalt (gestaltSystemVersion, &response) != noErr) if (Gestalt (gestaltSystemVersion, &response) != noErr)
error ("Cannot get Mac OS version"); error ("Cannot get Mac OS version");
mac_major_version = (response >> 8) & 0xf; mac_major_version = (response >> 8) & 0xff;
mac_minor_version = (response >> 4) & 0xf; /* convert BCD to int */
mac_major_version -= (mac_major_version >> 4) * 6;
return Fcons (make_number (mac_major_version), return Fcons (make_number (mac_major_version),
Fcons (make_number (mac_minor_version), Qnil)); Fcons (make_number ((response >> 4) & 0xf),
Fcons (make_number (response & 0xf),
Qnil)));
} }
DEFUN ("x-display-screens", Fx_display_screens, Sx_display_screens, 0, 1, 0, DEFUN ("x-display-screens", Fx_display_screens, Sx_display_screens, 0, 1, 0,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment