diff --git a/lisp/term/ns-win.el b/lisp/term/ns-win.el
index 06b6747..97cbc3d 100644
--- a/lisp/term/ns-win.el
+++ b/lisp/term/ns-win.el
@@ -928,6 +928,10 @@ See the documentation of `create-fontset-from-fontset-spec' for the format.")
 (add-to-list 'frame-creation-function-alist '(ns . x-create-frame-with-faces))
 (add-to-list 'window-system-initialization-alist '(ns . ns-initialize-window-system))
 
+(declare-function ns-toggle-fullscreen-internal "nsfns.m" ())
+(defun ns-toggle-fullscreen ()
+  (interactive)
+  (ns-toggle-fullscreen-internal))
 
 (provide 'ns-win)
 
diff --git a/src/nsfns.m b/src/nsfns.m
index 072005d..322e8c5 100644
--- a/src/nsfns.m
+++ b/src/nsfns.m
@@ -2589,6 +2589,22 @@ Value is t if tooltip was open, nil otherwise.  */)
 }
 
 
+DEFUN ("ns-toggle-fullscreen-internal", Fns_toggle_fullscreen_internal, Sns_toggle_fullscreen_internal,
+        0, 0, 0,
+        doc: /* Toggle fulscreen mode */)
+()
+{
+  struct frame *f = SELECTED_FRAME();
+  EmacsWindow *window = ns_get_window(f);
+
+#if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7
+  [window toggleFullScreen:nil];
+#endif
+
+  return Qnil;
+}
+
+
 /* ==========================================================================
 
     Class implementations
@@ -2744,6 +2760,8 @@ be used as the image of the icon representing the frame.  */);
   defsubr (&Sx_show_tip);
   defsubr (&Sx_hide_tip);
 
+  defsubr (&Sns_toggle_fullscreen_internal);
+
   /* used only in fontset.c */
   check_window_system_func = check_ns;
 
diff --git a/src/nsmenu.m b/src/nsmenu.m
index 907d3ea..0974c04 100644
--- a/src/nsmenu.m
+++ b/src/nsmenu.m
@@ -1013,7 +1013,7 @@ free_frame_tool_bar (FRAME_PTR f)
    -------------------------------------------------------------------------- */
 {
   BLOCK_INPUT;
-  [[FRAME_NS_VIEW (f) toolbar] setVisible: NO];
+  [[FRAME_NS_VIEW (f) window] setToolbar: nil];
   FRAME_TOOLBAR_HEIGHT (f) = 0;
   UNBLOCK_INPUT;
 }
@@ -1030,6 +1030,8 @@ update_frame_tool_bar (FRAME_PTR f)
   EmacsToolbar *toolbar = [view toolbar];
 
   BLOCK_INPUT;
+  [window setToolbar: toolbar];
+
   [toolbar clearActive];
 
   /* update EmacsToolbar as in GtkUtils, build items list */
diff --git a/src/nsterm.h b/src/nsterm.h
index f3adab8..9b2f004 100644
--- a/src/nsterm.h
+++ b/src/nsterm.h
@@ -38,6 +38,9 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #ifndef MAC_OS_X_VERSION_10_6
 #define MAC_OS_X_VERSION_10_6 1060
 #endif
+#ifndef MAC_OS_X_VERSION_10_7
+#define MAC_OS_X_VERSION_10_7 1070
+#endif
 #endif /* NS_IMPL_COCOA */
 
 #ifdef __OBJC__
diff --git a/src/nsterm.m b/src/nsterm.m
index 0b26508..8cb22f9 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -1460,7 +1460,7 @@ ns_get_color (const char *name, NSColor **col)
 
   if (r >= 0.0)
     {
-      *col = [NSColor colorWithCalibratedRed: r green: g blue: b alpha: 1.0];
+      *col = [NSColor colorWithDeviceRed: r green: g blue: b alpha: 1.0];
       UNBLOCK_INPUT;
       return 0;
     }
@@ -1622,7 +1622,7 @@ ns_get_rgb_color (struct frame *f, float r, float g, float b, float a)
   if (a < 0.0) a = 0.0;
   else if (a > 1.0) a = 1.0;
   return (unsigned long) ns_index_color(
-    [NSColor colorWithCalibratedRed: r green: g blue: b alpha: a], f);
+    [NSColor colorWithDeviceRed: r green: g blue: b alpha: a], f);
 }
 
 
@@ -4095,7 +4095,7 @@ ns_term_init (Lisp_Object display_name)
             name = SSDATA (XCAR (color));
             c = XINT (XCDR (color));
             [cl setColor:
-                  [NSColor colorWithCalibratedRed: RED_FROM_ULONG (c) / 255.0
+                  [NSColor colorWithDeviceRed: RED_FROM_ULONG (c) / 255.0
                                             green: GREEN_FROM_ULONG (c) / 255.0
                                              blue: BLUE_FROM_ULONG (c) / 255.0
                                             alpha: 1.0]
@@ -5443,38 +5443,7 @@ not_in_argv (NSString *arg)
 #endif
   if (rows < MINHEIGHT)
     rows = MINHEIGHT;
-#ifdef NS_IMPL_COCOA
-  {
-    /* this sets window title to have size in it; the wm does this under GS */
-    NSRect r = [[self window] frame];
-    if (r.size.height == frameSize.height && r.size.width == frameSize.width)
-      {
-        if (old_title != 0)
-          {
-            xfree (old_title);
-            old_title = 0;
-          }
-      }
-    else
-      {
-        char *size_title;
-        NSWindow *window = [self window];
-        if (old_title == 0)
-          {
-            const char *t = [[[self window] title] UTF8String];
-            char *pos = strstr (t, "  —  ");
-            if (pos)
-              *pos = '\0';
-            old_title = xstrdup (t);
-          }
-        size_title = xmalloc (strlen (old_title) + 40);
-	esprintf (size_title, "%s  —  (%d x %d)", old_title, cols, rows);
-        [window setTitle: [NSString stringWithUTF8String: size_title]];
-        [window display];
-        xfree (size_title);
-      }
-  }
-#endif /* NS_IMPL_COCOA */
+
 /*fprintf (stderr,"    ...size became %.0f x %.0f  (%d x %d)\n",frameSize.width,frameSize.height,cols,rows); */
 
   return frameSize;
@@ -5496,14 +5465,6 @@ not_in_argv (NSString *arg)
   NSTRACE (windowDidResize);
 /*fprintf (stderr,"windowDidResize: %.0f\n",[theWindow frame].size.height); */
 
-#ifdef NS_IMPL_COCOA
-  if (old_title != 0)
-    {
-      xfree (old_title);
-      old_title = 0;
-    }
-#endif /* NS_IMPL_COCOA */
-
   /* Avoid loop under GNUstep due to call at beginning of this function.
      (x_set_window_size causes a resize which causes
      a "windowDidResize" which calls x_set_window_size).  */
@@ -5522,6 +5483,60 @@ not_in_argv (NSString *arg)
   ns_send_appdefined (-1);
 }
 
+#if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7
+- (void)windowDidEnterFullScreen:(NSNotification *)notification
+{
+    NSTRACE (windowDidEnterFullScreen);
+    /* NSLog(@"Calling windowDidEnterFullScreen"); */
+    
+    NSWindow *window = [self window];
+    NSRect wr = [window frame];
+    int w = (int)wr.size.width - emacsframe->border_width;
+    int h = (int)wr.size.height;
+    cols = FRAME_PIXEL_WIDTH_TO_TEXT_COLS(emacsframe, w);
+    rows = FRAME_PIXEL_HEIGHT_TO_TEXT_LINES(emacsframe, h);
+    /* NSLog(@"window_size=%dx%d (%dx%d)", w, h, cols, rows); */
+    FRAME_PIXEL_WIDTH (emacsframe) = w;
+    FRAME_PIXEL_HEIGHT (emacsframe) = h;
+    change_frame_size (emacsframe, rows, cols, 0, 1, 0);
+    SET_FRAME_GARBAGED (emacsframe);
+    cancel_mouse_face (emacsframe);
+    ns_send_appdefined (-1);
+}
+#endif
+
+#if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7
+- (void)windowDidExitFullScreen:(NSNotification *)notification
+{
+    NSTRACE (windowDidExitFullScreen);
+    /* NSLog(@"Calling windowDidExitFullScreen"); */
+    
+    NSWindow *window = [self window];
+    NSRect wr = [window frame];
+    int w = (int)wr.size.width - emacsframe->border_width;
+    int h = (int)wr.size.height
+    - FRAME_NS_TITLEBAR_HEIGHT (emacsframe)
+    - FRAME_TOOLBAR_HEIGHT (emacsframe);
+    cols = FRAME_PIXEL_WIDTH_TO_TEXT_COLS(emacsframe, w);
+    rows = FRAME_PIXEL_HEIGHT_TO_TEXT_LINES(emacsframe, h);
+    /* NSLog(@"window_size=%dx%d (%dx%d)", w, h, cols, rows); */
+    FRAME_PIXEL_WIDTH (emacsframe) = w;
+    FRAME_PIXEL_HEIGHT (emacsframe) = h;
+    change_frame_size (emacsframe, rows, cols, 0, 1, 0);
+    SET_FRAME_GARBAGED (emacsframe);
+    cancel_mouse_face (emacsframe);
+    ns_send_appdefined (-1);
+}
+#endif
+
+#if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7
+- (NSApplicationPresentationOptions)window:(NSWindow *)window willUseFullScreenPresentationOptions:(NSApplicationPresentationOptions)proposedOptions
+{
+    /* NSLog(@"Calling window:willUseFullScreenPresentationOptions: %d", proposedOptions); */
+    return proposedOptions | NSApplicationPresentationAutoHideToolbar;
+}
+#endif
+
 
 - (void)windowDidBecomeKey: (NSNotification *)notification
 /* cf. x_detect_focus_change(), x_focus_changed(), x_new_focus_frame() */
@@ -5692,6 +5707,14 @@ not_in_argv (NSString *arg)
   [NSApp registerServicesMenuSendTypes: ns_send_types
                            returnTypes: nil];
 
+#if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7
+  if (NSApp != nil && [NSApp isActive])
+  {
+    [NSApp setPresentationOptions: NSApplicationPresentationFullScreen | [NSApp presentationOptions] ];
+    [win setCollectionBehavior: NSWindowCollectionBehaviorFullScreenPrimary | [win collectionBehavior] ];
+  }
+#endif
+
   ns_window_num++;
   return self;
 }
