Point pt;
GrafPtr oldport;
-#ifdef TARGET_API_MAC_CARBON
+ GetPort (&oldport);
+ SetPortWindowPort (FRAME_MAC_WINDOW (f));
+
+#if TARGET_API_MAC_CARBON
{
Rect r;
- GetWindowPortBounds (f->output_data.mac->mWP, &r);
+ GetWindowPortBounds (FRAME_MAC_WINDOW (f), &r);
SetPt (&pt, r.left, r.top);
}
#else /* not TARGET_API_MAC_CARBON */
SetPt (&pt,
- f->output_data.mac->mWP->portRect.left,
- f->output_data.mac->mWP->portRect.top);
+ FRAME_MAC_WINDOW (f)->portRect.left,
+ FRAME_MAC_WINDOW (f)->portRect.top);
#endif /* not TARGET_API_MAC_CARBON */
- GetPort (&oldport);
LocalToGlobal (&pt);
SetPort (oldport);
if (FRAME_MAC_WINDOW (f))
{
if (STRING_MULTIBYTE (name))
-#if 0 /* MAC_TODO: encoding title string */
- name = ENCODE_SYSTEM (name);
+#if TARGET_API_MAC_CARBON
+ name = ENCODE_UTF_8 (name);
#else
return;
#endif
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;
if (strlen (SDATA (name)) < 255)
{
c2pstr (windowTitle);
SetWTitle (FRAME_MAC_WINDOW (f), windowTitle);
}
+#endif
}
UNBLOCK_INPUT;
if (FRAME_MAC_WINDOW (f))
{
if (STRING_MULTIBYTE (name))
-#if 0 /* MAC_TODO: encoding title string */
- name = ENCODE_SYSTEM (name);
+#if TARGET_API_MAC_CARBON
+ name = ENCODE_UTF_8 (name);
#else
return;
#endif
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;
if (strlen (SDATA (name)) < 255)
{
c2pstr (windowTitle);
SetWTitle (FRAME_MAC_WINDOW (f), windowTitle);
}
+#endif
}
UNBLOCK_INPUT;
(display)
Lisp_Object display;
{
- int mac_major_version, mac_minor_version;
+ int mac_major_version;
SInt32 response;
if (Gestalt (gestaltSystemVersion, &response) != noErr)
error ("Cannot get Mac OS version");
- mac_major_version = (response >> 8) & 0xf;
- mac_minor_version = (response >> 4) & 0xf;
+ mac_major_version = (response >> 8) & 0xff;
+ /* convert BCD to int */
+ mac_major_version -= (mac_major_version >> 4) * 6;
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,