]> code.delx.au - gnu-emacs/commitdiff
Backport from trunk.
authorJan Djärv <jan.h.d@swipnet.se>
Fri, 4 Apr 2014 16:32:24 +0000 (18:32 +0200)
committerJan Djärv <jan.h.d@swipnet.se>
Fri, 4 Apr 2014 16:32:24 +0000 (18:32 +0200)
       * nsmenu.m (update_frame_tool_bar): Return early if view or toolbar
is nil.  If waiting for toolbar to complete, force a redraw.
(free_frame_tool_bar): Set wait_for_tool_bar = NO

       * nsterm.h (EmacsView): Add wait_for_tool_bar.

* nsterm.m (updateFrameSize:): If waiting for the tool bar and tool
       bar is zero height, just return (Bug#16976).
       (initFrameFromEmacs:): Initialize wait_for_tool_bar.

src/ChangeLog
src/nsmenu.m
src/nsterm.h
src/nsterm.m

index c35206447f1fe872a848fd161288985e752e2647..c370bdc0404f24ef97ff41fdd60d73bcfad9908b 100644 (file)
@@ -1,3 +1,16 @@
+2014-04-04  Jan Djärv  <jan.h.d@swipnet.se>
+
+       Backport from trunk.
+       * nsterm.m (updateFrameSize:): If waiting for the tool bar and tool
+       bar is zero height, just return (Bug#16976).
+       (initFrameFromEmacs:): Initialize wait_for_tool_bar.
+
+       * nsterm.h (EmacsView): Add wait_for_tool_bar.
+
+       * nsmenu.m (update_frame_tool_bar): Return early if view or toolbar
+       is nil.  If waiting for toolbar to complete, force a redraw.
+       (free_frame_tool_bar): Set wait_for_tool_bar = NO (Bug#16976)
+
 2014-04-03  Ken Brown  <kbrown@cornell.edu>
 
        * Makefile.in (EMACS_MANIFEST): Update comment.  (Bug#17176)
index f8cd07478ed5d71ff14c6f5137d9da116f0e2881..24842241f37e22d8f89583bd62bf3edeacd60415 100644 (file)
@@ -1054,8 +1054,10 @@ free_frame_tool_bar (struct frame *f)
     Under NS we just hide the toolbar until it might be needed again.
    -------------------------------------------------------------------------- */
 {
+  EmacsView *view = FRAME_NS_VIEW (f);
   block_input ();
-  [[FRAME_NS_VIEW (f) toolbar] setVisible: NO];
+  view->wait_for_tool_bar = NO;
+  [[view toolbar] setVisible: NO];
   FRAME_TOOLBAR_HEIGHT (f) = 0;
   unblock_input ();
 }
@@ -1071,6 +1073,7 @@ update_frame_tool_bar (struct frame *f)
   NSWindow *window = [view window];
   EmacsToolbar *toolbar = [view toolbar];
 
+  if (view == nil || toolbar == nil) return;
   block_input ();
 
 #ifdef NS_IMPL_COCOA
@@ -1176,9 +1179,13 @@ update_frame_tool_bar (struct frame *f)
   FRAME_TOOLBAR_HEIGHT (f) =
     NSHeight ([window frameRectForContentRect: NSMakeRect (0, 0, 0, 0)])
     - FRAME_NS_TITLEBAR_HEIGHT (f);
-    if (FRAME_TOOLBAR_HEIGHT (f) < 0) // happens if frame is fullscreen.
-      FRAME_TOOLBAR_HEIGHT (f) = 0;
-    unblock_input ();
+  if (FRAME_TOOLBAR_HEIGHT (f) < 0) // happens if frame is fullscreen.
+    FRAME_TOOLBAR_HEIGHT (f) = 0;
+
+  if (view->wait_for_tool_bar && FRAME_TOOLBAR_HEIGHT (f) > 0)
+      [view setNeedsDisplay: YES];
+
+  unblock_input ();
 }
 
 
index 8e8a9b7f36fd9b14410c105b38fd93ac470f6f44..74789634a90048d52d5579a401e6f13d9b51acee 100644 (file)
@@ -162,6 +162,7 @@ typedef float EmacsCGFloat;
    int scrollbarsNeedingUpdate;
    EmacsToolbar *toolbar;
    NSRect ns_userRect;
+   BOOL wait_for_tool_bar;
    }
 
 /* AppKit-side interface */
index 0e8fc56fdd98b20f9971aa6cff991d2a3f03ed43..c7cb4faa3b787854d8931b8dfdca9bde545467ad 100644 (file)
@@ -5766,6 +5766,13 @@ not_in_argv (NSString *arg)
         + FRAME_TOOLBAR_HEIGHT (emacsframe);
     }
 
+  if (wait_for_tool_bar)
+    {
+      if (FRAME_TOOLBAR_HEIGHT (emacsframe) == 0)
+        return;
+      wait_for_tool_bar = NO;
+    }
+
   neww = (int)wr.size.width - emacsframe->border_width;
   newh = (int)wr.size.height - extra;
 
@@ -6078,6 +6085,13 @@ if (cols > 0 && rows > 0)
                                    ns_window_num]];
   [win setToolbar: toolbar];
   [toolbar setVisible: NO];
+
+  /* Don't set frame garbaged until tool bar is up to date?
+     This avoids an extra clear and redraw (flicker) at frame creation.  */
+  if (FRAME_EXTERNAL_TOOL_BAR (f)) wait_for_tool_bar = YES;
+  else wait_for_tool_bar = NO;
+
+
 #ifdef NS_IMPL_COCOA
   {
     NSButton *toggleButton;