]> code.delx.au - gnu-emacs/blobdiff - src/nsfns.m
Ensure NS frames remain hidden when invisible
[gnu-emacs] / src / nsfns.m
index df5c7e13daf41bc92992f60aafdec6bb514ca73e..5d944593f56065f7dd9e82d0c6d397d6b8506a98 100644 (file)
@@ -1,5 +1,5 @@
 /* Functions for the NeXT/Open/GNUstep and MacOSX window system.
-   Copyright (C) 1989, 1992, 1993, 1994, 2005, 2006, 2008
+   Copyright (C) 1989, 1992, 1993, 1994, 2005, 2006, 2008, 2009
      Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
@@ -203,46 +203,32 @@ ns_get_window (Lisp_Object maybeFrame)
 
 
 static NSScreen *
-ns_get_screen (Lisp_Object anythingUnderTheSun)
-{
-  id window =nil;
-  NSScreen *screen = 0;
-
-  struct terminal *terminal;
-  struct ns_display_info *dpyinfo;
-  struct frame *f = NULL;
-  Lisp_Object frame;
-
-  if (INTEGERP (anythingUnderTheSun)) {
-    /* we got a terminal */
-    terminal = get_terminal (anythingUnderTheSun, 1);
-    dpyinfo = terminal->display_info.ns;
-    f = dpyinfo->x_focus_frame;
-    if (!f)
-      f = dpyinfo->x_highlight_frame;
-
-  } else if (FRAMEP (anythingUnderTheSun) &&
-             FRAME_NS_P (XFRAME (anythingUnderTheSun))) {
-    /* we got a frame */
-    f = XFRAME (anythingUnderTheSun);
-
-  } else if (STRINGP (anythingUnderTheSun)) { /* FIXME/cl for multi-display */
-  }
-
-  if (!f)
-    f = SELECTED_FRAME ();
-  if (f)
+ns_get_screen (Lisp_Object screen)
+{
+  struct terminal *terminal = get_terminal (screen, 1);
+  if (terminal->type != output_ns)
+    // Not sure if this special case for nil is needed.  It does seem to be
+    // important in xfns.c for the make-frame call in frame-initialize,
+    // so let's keep it here for now.
+    return (NILP (screen) ? [NSScreen mainScreen] : NULL);
+  else
     {
-      XSETFRAME (frame, f);
-      window = ns_get_window (frame);
+      struct ns_display_info *dpyinfo = terminal->display_info.ns;
+      struct frame *f = dpyinfo->x_focus_frame;
+      if (!f)
+       f = dpyinfo->x_highlight_frame;
+      if (!f)
+       return NULL;
+      else
+       {
+         id window = nil;
+         Lisp_Object frame;
+         eassert (FRAME_NS_P (f));
+         XSETFRAME (frame, f);
+         window = ns_get_window (frame);
+         return window ? [window screen] : NULL;
+       }
     }
-
-  if (window)
-    screen = [window screen];
-  if (!screen)
-    screen = [NSScreen mainScreen];
-
-  return screen;
 }
 
 
@@ -338,7 +324,7 @@ interpret_services_menu (NSMenu *menu, Lisp_Object prefix, Lisp_Object old)
 
 
 static void
-ns_set_foreground_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
+x_set_foreground_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
 {
   NSColor *col;
 
@@ -363,7 +349,7 @@ ns_set_foreground_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
 
 
 static void
-ns_set_background_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
+x_set_background_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
 {
   struct face *face;
   NSColor *col;
@@ -389,14 +375,6 @@ ns_set_background_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
       [[view window] setBackgroundColor: col];
       alpha = [col alphaComponent];
 
-#ifdef NS_IMPL_COCOA
-      /* the alpha code below only works on 10.4, so we need to do something
-         else (albeit less good) otherwise.
-         Check NSApplication.h for useful NSAppKitVersionNumber values. */
-      if (NSAppKitVersionNumber < 744.0)
-          [[view window] setAlphaValue: alpha];
-#endif
-
       if (alpha != 1.0)
           [[view window] setOpaque: NO];
       else
@@ -420,7 +398,7 @@ ns_set_background_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
 
 
 static void
-ns_set_cursor_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
+x_set_cursor_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
 {
   NSColor *col;
 
@@ -443,10 +421,10 @@ ns_set_cursor_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
 
 
 static void
-ns_set_icon_name (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
+x_set_icon_name (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
 {
   NSView *view = FRAME_NS_VIEW (f);
-  NSTRACE (ns_set_icon_name);
+  NSTRACE (x_set_icon_name);
 
   if (ns_in_resize)
     return;
@@ -589,9 +567,9 @@ ns_set_name (struct frame *f, Lisp_Object name, int explicit)
    specified a name for the frame; the name will override any set by the
    redisplay code.  */
 static void
-ns_explicitly_set_name (FRAME_PTR f, Lisp_Object arg, Lisp_Object oldval)
+x_explicitly_set_name (FRAME_PTR f, Lisp_Object arg, Lisp_Object oldval)
 {
-  NSTRACE (ns_explicitly_set_name);
+  NSTRACE (x_explicitly_set_name);
   ns_set_name_iconic (f, arg, 1);
   ns_set_name (f, arg, 1);
 }
@@ -622,9 +600,9 @@ x_implicitly_set_name (FRAME_PTR f, Lisp_Object arg, Lisp_Object oldval)
    suggesting a new name, which lisp code should override; if
    F->explicit_name is set, ignore the new name; otherwise, set it.  */
 static void
-ns_set_title (struct frame *f, Lisp_Object name, Lisp_Object old_name)
+x_set_title (struct frame *f, Lisp_Object name, Lisp_Object old_name)
 {
-  NSTRACE (ns_set_title);
+  NSTRACE (x_set_title);
   /* Don't change the title if it's already NAME.  */
   if (EQ (name, f->title))
     return;
@@ -747,7 +725,7 @@ x_set_menu_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval)
 }
 
 
-/* 23: toolbar support */
+/* toolbar support */
 void
 x_set_tool_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval)
 {
@@ -852,13 +830,13 @@ ns_implicitly_set_icon_type (struct frame *f)
 
 
 static void
-ns_set_icon_type (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
+x_set_icon_type (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
 {
   EmacsView *view = FRAME_NS_VIEW (f);
   id image = nil;
   BOOL setMini = YES;
 
-  NSTRACE (ns_set_icon_type);
+  NSTRACE (x_set_icon_type);
 
   if (!NILP (arg) && SYMBOLP (arg))
     {
@@ -891,7 +869,7 @@ ns_set_icon_type (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
 }
 
 
-/* 23: added Xism; we stub out (we do implement this in ns-win.el) */
+/* Xism; we stub out (we do implement this in ns-win.el) */
 int
 XParseGeometry (char *string, int *x, int *y,
                 unsigned int *width, unsigned int *height)
@@ -934,9 +912,9 @@ ns_cursor_type_to_lisp (int arg)
     }
 }
 
-/* this is like x_set_cursor_type defined in xfns.c */
+/* This is the same as the xfns.c definition.  */
 void
-ns_set_cursor_type (f, arg, oldval)
+x_set_cursor_type (f, arg, oldval)
      FRAME_PTR f;
      Lisp_Object arg, oldval;
 {
@@ -947,10 +925,10 @@ ns_set_cursor_type (f, arg, oldval)
 }
 \f
 
-/* 23: called to set mouse pointer color, but all other terms use it to
-       initialize pointer types (and don't set the color ;) */
+/* called to set mouse pointer color, but all other terms use it to
+   initialize pointer types (and don't set the color ;) */
 static void
-ns_set_mouse_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
+x_set_mouse_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
 {
   /* don't think we can do this on Nextstep */
 }
@@ -960,7 +938,7 @@ ns_set_mouse_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
 #define Xstr(x) Str(x)
 
 static Lisp_Object
-ns_appkit_version ()
+ns_appkit_version_str ()
 {
   char tmp[80];
 
@@ -975,6 +953,21 @@ ns_appkit_version ()
 }
 
 
+/* This is for use by x-server-version and collapses all version info we
+   have into a single int.  For a better picture of the implementation
+   running, use ns_appkit_version_str.*/
+static int
+ns_appkit_version_int ()
+{
+#ifdef NS_IMPL_GNUSTEP
+  return GNUSTEP_GUI_MAJOR_VERSION * 100 + GNUSTEP_GUI_MINOR_VERSION;
+#elif defined(NS_IMPL_COCOA)
+  return (int)NSAppKitVersionNumber;
+#endif
+  return 0;
+}
+
+
 static void
 x_icon (struct frame *f, Lisp_Object parms)
 /* --------------------------------------------------------------------------
@@ -1005,28 +998,26 @@ x_icon (struct frame *f, Lisp_Object parms)
 }
 
 
-/* 23 Note: commented out ns_... entries are no longer used in 23.
-            commented out x_... entries have not been implemented yet.
-   see frame.c for template, also where all generic OK functions are impl */
+/* Note: see frame.c for template, also where generic functions are impl */
 frame_parm_handler ns_frame_parm_handlers[] =
 {
   x_set_autoraise, /* generic OK */
   x_set_autolower, /* generic OK */
-  ns_set_background_color,
+  x_set_background_color,
   0, /* x_set_border_color,  may be impossible under Nextstep */
   0, /* x_set_border_width,  may be impossible under Nextstep */
-  ns_set_cursor_color,
-  ns_set_cursor_type,
+  x_set_cursor_color,
+  x_set_cursor_type,
   x_set_font, /* generic OK */
-  ns_set_foreground_color,
-  ns_set_icon_name,
-  ns_set_icon_type,
+  x_set_foreground_color,
+  x_set_icon_name,
+  x_set_icon_type,
   x_set_internal_border_width, /* generic OK */
   x_set_menu_bar_lines,
-  ns_set_mouse_color,
-  ns_explicitly_set_name,
+  x_set_mouse_color,
+  x_explicitly_set_name,
   x_set_scroll_bar_width, /* generic OK */
-  ns_set_title,
+  x_set_title,
   x_set_unsplittable, /* generic OK */
   x_set_vertical_scroll_bars, /* generic OK */
   x_set_visibility, /* generic OK */
@@ -1326,13 +1317,20 @@ be shared by the new frame.  */)
 
   if (! f->output_data.ns->explicit_parent)
     {
-        tem = x_get_arg (dpyinfo, parms, Qvisibility, 0, 0, RES_TYPE_BOOLEAN);
-        if (EQ (tem, Qunbound))
-            tem = Qnil;
-
-        x_set_visibility (f, tem, Qnil);
-        if (EQ (tem, Qt))
-            [[FRAME_NS_VIEW (f) window] makeKeyWindow];
+      tem = x_get_arg (dpyinfo, parms, Qvisibility, 0, 0, RES_TYPE_SYMBOL);
+      if (EQ (tem, Qunbound))
+       tem = Qt;
+      x_set_visibility (f, tem, Qnil);
+      if (EQ (tem, Qicon))
+       x_iconify_frame (f);
+      else if (! NILP (tem))
+       {
+         x_make_frame_visible (f);
+         f->async_visible = 1;
+         [[FRAME_NS_VIEW (f) window] makeKeyWindow];
+       }
+      else
+         f->async_visible = 0;
     }
 
   if (FRAME_HAS_MINIBUF_P (f)
@@ -1374,17 +1372,6 @@ FRAME nil means use the selected frame.  */)
 }
 
 
-DEFUN ("ns-popup-prefs-panel", Fns_popup_prefs_panel, Sns_popup_prefs_panel,
-       0, 0, "",
-       doc: /* Pop up the preferences panel. */)
-     ()
-{
-  check_ns ();
-  [(EmacsApp *)NSApp showPreferencesWindow: NSApp];
-  return Qnil;
-}
-
-
 DEFUN ("ns-popup-font-panel", Fns_popup_font_panel, Sns_popup_font_panel,
        0, 1, "",
        doc: /* Pop up the font panel. */)
@@ -1411,7 +1398,7 @@ DEFUN ("ns-popup-font-panel", Fns_popup_font_panel, Sns_popup_font_panel,
 }
 
 
-DEFUN ("ns-popup-color-panel", Fns_popup_color_panel, Sns_popup_color_panel, 
+DEFUN ("ns-popup-color-panel", Fns_popup_color_panel, Sns_popup_color_panel,
        0, 1, "",
        doc: /* Pop up the color panel.  */)
      (frame)
@@ -1444,7 +1431,7 @@ Optional arg INIT, if non-nil, provides a default file name to use.  */)
   static id fileDelegate = nil;
   int ret;
   id panel;
-  NSString *fname;
+  Lisp_Object fname;
 
   NSString *promptS = NILP (prompt) || !STRINGP (prompt) ? nil :
     [NSString stringWithUTF8String: SDATA (prompt)];
@@ -1477,6 +1464,7 @@ Optional arg INIT, if non-nil, provides a default file name to use.  */)
   [panel setDelegate: fileDelegate];
 
   panelOK = 0;
+  BLOCK_INPUT;
   if (NILP (isLoad))
     {
       ret = [panel runModalForDirectory: dirS file: initS];
@@ -1487,13 +1475,15 @@ Optional arg INIT, if non-nil, provides a default file name to use.  */)
       ret = [panel runModalForDirectory: dirS file: initS types: nil];
     }
 
-  ret = (ret = NSOKButton) || panelOK;
+  ret = (ret == NSOKButton) || panelOK;
 
-  fname = [panel filename];
+  if (ret)
+    fname = build_string ([[panel filename] UTF8String]);
 
   [[FRAME_NS_VIEW (SELECTED_FRAME ()) window] makeKeyWindow];
+  UNBLOCK_INPUT;
 
-  return ret ? build_string ([fname UTF8String]) : Qnil;
+  return ret ? fname : Qnil;
 }
 
 
@@ -1569,11 +1559,11 @@ transparency and 1 is opaque.  */)
   CHECK_NUMBER_OR_FLOAT (alpha);
 
   if (ns_lisp_to_color (color, &col))
-    error ("Unknown color.");
+    error ("Unknown color");
 
   a = XFLOATINT (alpha);
   if (a < 0.0 || a > 1.0)
-    error ("Alpha value should be between 0 and 1 inclusive.");
+    error ("Alpha value should be between 0 and 1 inclusive");
 
   col = [col colorWithAlphaComponent: a];
   return ns_color_to_lisp (col);
@@ -1610,14 +1600,26 @@ If omitted or nil, the selected frame's display is used.  */)
 
 
 DEFUN ("x-server-version", Fx_server_version, Sx_server_version, 0, 1, 0,
-       doc: /* Return the version number of Nextstep display server DISPLAY.
+       doc: /* Return the version numbers of the server of DISPLAY.
+The value is a list of three integers: the major and minor
+version numbers of the X Protocol in use, and the distributor-specific
+release number.  See also the function `x-server-vendor'.
+
+The optional argument DISPLAY specifies which display to ask about.
 DISPLAY should be either a frame or a display name (a string).
-If omitted or nil, the selected frame's display is used.
-See also the function `ns-server-vendor'.  */)
+If omitted or nil, that stands for the selected frame's display.  */)
      (display)
      Lisp_Object display;
 {
-  return ns_appkit_version ();
+  /*NOTE: it is unclear what would best correspond with "protocol";
+          we return 10.3, meaning Panther, since this is roughly the
+          level that GNUstep's APIs correspond to.
+          The last number is where we distinguish between the Apple
+          and GNUstep implementations ("distributor-specific release
+          number") and give int'ized versions of major.minor. */
+  return Fcons (make_number (10),
+               Fcons (make_number (3),
+                      Fcons (make_number (ns_appkit_version_int()), Qnil)));
 }
 
 
@@ -1789,7 +1791,7 @@ Optional arguments XRM-STRING and MUST-SUCCEED are currently ignored.  */)
 DEFUN ("x-close-connection", Fx_close_connection, Sx_close_connection,
        1, 1, 0,
        doc: /* Close the connection to the current Nextstep display server.
-The second argument DISPLAY is currently ignored.  */)
+The argument DISPLAY is currently ignored.  */)
      (display)
      Lisp_Object display;
 {
@@ -1819,7 +1821,7 @@ DEFUN ("x-display-list", Fx_display_list, Sx_display_list, 0, 0, 0,
 
 DEFUN ("ns-hide-others", Fns_hide_others, Sns_hide_others,
        0, 0, 0,
-       doc: /* Hides all applications other than emacs.  */)
+       doc: /* Hides all applications other than Emacs.  */)
      ()
 {
   check_ns ();
@@ -1829,9 +1831,9 @@ DEFUN ("ns-hide-others", Fns_hide_others, Sns_hide_others,
 
 DEFUN ("ns-hide-emacs", Fns_hide_emacs, Sns_hide_emacs,
        1, 1, 0,
-       doc: /* If ON is non-nil, the entire emacs application is hidden.
-Otherwise if emacs is hidden, it is unhidden.
-If ON is equal to `activate', emacs is unhidden and becomes
+       doc: /* If ON is non-nil, the entire Emacs application is hidden.
+Otherwise if Emacs is hidden, it is unhidden.
+If ON is equal to `activate', Emacs is unhidden and becomes
 the active application.  */)
      (on)
      Lisp_Object on;
@@ -2007,7 +2009,7 @@ there was no result.  */)
 
 DEFUN ("ns-convert-utf8-nfd-to-nfc", Fns_convert_utf8_nfd_to_nfc,
        Sns_convert_utf8_nfd_to_nfc, 1, 1, 0,
-       doc: /* Return an NFC string that matches  the UTF-8 NFD string STR.  */)
+       doc: /* Return an NFC string that matches the UTF-8 NFD string STR.  */)
     (str)
     Lisp_Object str;
 {
@@ -2051,9 +2053,9 @@ ns_do_applescript (script, result)
 
   returnDescriptor = [scriptObject executeAndReturnError: &errorDict];
   [scriptObject release];
-  
+
   *result = Qnil;
-  
+
   if (returnDescriptor != NULL)
     {
       // successful execution
@@ -2062,8 +2064,10 @@ ns_do_applescript (script, result)
          *result = Qt;
          // script returned an AppleScript result
          if ((typeUnicodeText == [returnDescriptor descriptorType]) ||
-             (typeUTF16ExternalRepresentation 
+#if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4
+             (typeUTF16ExternalRepresentation
               == [returnDescriptor descriptorType]) ||
+#endif
              (typeUTF8Text == [returnDescriptor descriptorType]) ||
              (typeCString == [returnDescriptor descriptorType]))
            {
@@ -2090,10 +2094,10 @@ ns_do_applescript (script, result)
 }
 
 DEFUN ("ns-do-applescript", Fns_do_applescript, Sns_do_applescript, 1, 1, 0,
-       doc: /* Execute AppleScript SCRIPT and return the result.  If
-compilation and execution are successful, the resulting script value
-is returned as a string, a number or, in the case of other constructs,
-t.  In case the execution fails, an error is signaled. */)
+       doc: /* Execute AppleScript SCRIPT and return the result.
+If compilation and execution are successful, the resulting script value
+is returned as a string, a number or, in the case of other constructs, t.
+In case the execution fails, an error is signaled. */)
     (script)
     Lisp_Object script;
 {
@@ -2124,14 +2128,15 @@ t.  In case the execution fails, an error is signaled. */)
    ========================================================================== */
 
 
-/* 23: call in image.c */
+/* called from image.c */
 FRAME_PTR
 check_x_frame (Lisp_Object frame)
 {
   return check_ns_frame (frame);
 }
 
-/* 23: added, due to call in frame.c */
+
+/* called from frame.c */
 struct ns_display_info *
 check_x_display_info (Lisp_Object frame)
 {
@@ -2139,7 +2144,6 @@ check_x_display_info (Lisp_Object frame)
 }
 
 
-/* 23: new function; we don't have much in the way of flexibility though */
 void
 x_set_scroll_bar_default_width (f)
      struct frame *f;
@@ -2151,7 +2155,7 @@ x_set_scroll_bar_default_width (f)
 }
 
 
-/* 23: terms now impl this instead of x-get-resource directly */
+/* terms impl this instead of x-get-resource directly */
 const char *
 x_get_string_resource (XrmDatabase rdb, char *name, char *class)
 {
@@ -2165,9 +2169,10 @@ x_get_string_resource (XrmDatabase rdb, char *name, char *class)
     toCheck = name + (!strncmp (name, "emacs.", 6) ? 6 : 0);
 
 /*fprintf (stderr, "Checking '%s'\n", toCheck); */
-  
-  res = [[[NSUserDefaults standardUserDefaults] objectForKey:
-                   [NSString stringWithUTF8String: toCheck]] UTF8String];
+
+  res = ns_no_defaults ? NULL :
+    [[[NSUserDefaults standardUserDefaults] objectForKey:
+                     [NSString stringWithUTF8String: toCheck]] UTF8String];
   return !res ? NULL :
       (!strncasecmp (res, "YES", 3) ? "true" :
           (!strncasecmp (res, "NO", 2) ? "false" : res));
@@ -2320,7 +2325,7 @@ If omitted or nil, that stands for the selected frame's display. */)
 
 DEFUN ("x-display-pixel-width", Fx_display_pixel_width, Sx_display_pixel_width,
        0, 1, 0,
-       doc: /* Returns the width in pixels of the Nextstep display DISPLAY.
+       doc: /* Return the width in pixels of the Nextstep display DISPLAY.
 The optional argument DISPLAY specifies which display to ask about.
 DISPLAY should be either a frame, a display name (a string), or terminal ID.
 If omitted or nil, that stands for the selected frame's display.  */)
@@ -2334,7 +2339,7 @@ If omitted or nil, that stands for the selected frame's display.  */)
 
 DEFUN ("x-display-pixel-height", Fx_display_pixel_height,
        Sx_display_pixel_height, 0, 1, 0,
-       doc: /* Returns the height in pixels of the Nextstep display DISPLAY.
+       doc: /* Return the height in pixels of the Nextstep display DISPLAY.
 The optional argument DISPLAY specifies which display to ask about.
 DISPLAY should be either a frame, a display name (a string), or terminal ID.
 If omitted or nil, that stands for the selected frame's display.  */)
@@ -2348,7 +2353,7 @@ If omitted or nil, that stands for the selected frame's display.  */)
 
 DEFUN ("display-usable-bounds", Fns_display_usable_bounds,
        Sns_display_usable_bounds, 0, 1, 0,
-       doc: /*Return the bounds of the usable part of the screen.
+       doc: /* Return the bounds of the usable part of the screen.
 The return value is a list of integers (LEFT TOP WIDTH HEIGHT), which
 are the boundaries of the usable part of the screen, excluding areas
 reserved for the Mac menu, dock, and so forth.
@@ -2376,7 +2381,7 @@ that stands for the selected frame's display. */)
 
 DEFUN ("x-display-planes", Fx_display_planes, Sx_display_planes,
        0, 1, 0,
-       doc: /* Returns the number of bitplanes of the Nextstep display DISPLAY.
+       doc: /* Return the number of bitplanes of the Nextstep display DISPLAY.
 The optional argument DISPLAY specifies which display to ask about.
 DISPLAY should be either a frame, a display name (a string), or terminal ID.
 If omitted or nil, that stands for the selected frame's display.  */)
@@ -2385,7 +2390,7 @@ If omitted or nil, that stands for the selected frame's display.  */)
 {
   check_ns ();
   return make_number
-    (NSBitsPerSampleFromDepth ([ns_get_screen (display) depth]));
+    (NSBitsPerPixelFromDepth ([ns_get_screen (display) depth]));
 }
 
 
@@ -2420,7 +2425,7 @@ compute_tip_xy (f, parms, dx, dy, width, height, root_x, root_y)
   Lisp_Object left, top;
   EmacsView *view = FRAME_NS_VIEW (f);
   NSPoint pt;
-  
+
   /* Start with user-specified or mouse position.  */
   left = Fcdr (Fassq (Qleft, parms));
   if (INTEGERP (left))
@@ -2465,7 +2470,7 @@ compute_tip_xy (f, parms, dx, dy, width, height, root_x, root_y)
 
 
 DEFUN ("x-show-tip", Fx_show_tip, Sx_show_tip, 1, 6, 0,
-       doc: /* Show STRING in a "tooltip" window on frame FRAME.
+       doc: /* Show STRING in a \"tooltip\" window on frame FRAME.
 A tooltip window is a small window displaying a string.
 
 FRAME nil or omitted means use the selected frame.
@@ -2624,6 +2629,7 @@ Value is t if tooltip was open, nil otherwise.  */)
 
 #endif
 
+
 /* ==========================================================================
 
     Lisp interface declaration
@@ -2638,8 +2644,6 @@ syms_of_nsfns ()
 
   Qnone = intern ("none");
   staticpro (&Qnone);
-  Qbuffered = intern ("bufferd");
-  staticpro (&Qbuffered);
   Qfontsize = intern ("fontsize");
   staticpro (&Qfontsize);
 
@@ -2666,7 +2670,7 @@ be used as the image of the icon representing the frame.  */);
 
   DEFVAR_LISP ("ns-version-string", &Vns_version_string,
                doc: /* Toolkit version for NS Windowing.  */);
-  Vns_version_string = ns_appkit_version ();
+  Vns_version_string = ns_appkit_version_str ();
 
   defsubr (&Sns_read_file_name);
   defsubr (&Sns_get_resource);
@@ -2707,7 +2711,6 @@ be used as the image of the icon representing the frame.  */);
   defsubr (&Sns_perform_service);
   defsubr (&Sns_convert_utf8_nfd_to_nfc);
   defsubr (&Sx_focus_frame);
-  defsubr (&Sns_popup_prefs_panel);
   defsubr (&Sns_popup_font_panel);
   defsubr (&Sns_popup_color_panel);