emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] emacs-24 d9d3831: More flicker fixes for OSX, related to b


From: Jan D.
Subject: [Emacs-diffs] emacs-24 d9d3831: More flicker fixes for OSX, related to bug 18757.
Date: Tue, 02 Dec 2014 13:05:40 +0000

branch: emacs-24
commit d9d383147219f8e6a90d4c177e1b454e19acfac9
Author: Jan Djärv <address@hidden>
Commit: Jan Djärv <address@hidden>

    More flicker fixes for OSX, related to bug 18757.
    
    * nsfns.m (ns_set_name_as_filename): Don't set represented filename
    at once, call ns_set_represented_filename instead.
    
    * nsterm.h: Declare ns_set_represented_filename.
    
    * nsterm.m (represented_filename, represented_frame): New variables.
    (ns_set_represented_filename): New function.
    (sendEvent:): Set represented filename here to avoid flicker,
    related to Bug#18757.
---
 src/ChangeLog |   12 ++++++++++++
 src/nsfns.m   |    9 +--------
 src/nsterm.h  |    6 +++++-
 src/nsterm.m  |   28 ++++++++++++++++++++++++++++
 4 files changed, 46 insertions(+), 9 deletions(-)

diff --git a/src/ChangeLog b/src/ChangeLog
index 5ecb022..952e4ab 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,15 @@
+2014-12-02  Jan Djärv  <address@hidden>
+
+       * nsterm.m (represented_filename, represented_frame): New variables.
+       (ns_set_represented_filename): New function.
+       (sendEvent:): Set represented filename here to avoid flicker,
+       related to Bug#18757.
+
+       * nsterm.h: Declare ns_set_represented_filename.
+
+       * nsfns.m (ns_set_name_as_filename): Don't set represented filename
+       at once, call ns_set_represented_filename instead.
+
 2014-11-27  Eli Zaretskii  <address@hidden>
 
        * xdisp.c (handle_single_display_spec): When ignoring a fringe
diff --git a/src/nsfns.m b/src/nsfns.m
index e0f8cfe..ec4761b 100644
--- a/src/nsfns.m
+++ b/src/nsfns.m
@@ -621,18 +621,11 @@ ns_set_name_as_filename (struct frame *f)
 
           fstr = [NSString stringWithUTF8String: SSDATA (encoded_filename)];
           if (fstr == nil) fstr = @"";
-#ifdef NS_IMPL_COCOA
-          /* work around a bug observed on 10.3 and later where
-             setTitleWithRepresentedFilename does not clear out previous state
-             if given filename does not exist */
-          if (! [[NSFileManager defaultManager] fileExistsAtPath: fstr])
-            [[view window] setRepresentedFilename: @""];
-#endif
         }
       else
         fstr = @"";
 
-      [[view window] setRepresentedFilename: fstr];
+      ns_set_represented_filename (fstr, f);
       [[view window] setTitle: str];
       fset_name (f, name);
     }
diff --git a/src/nsterm.h b/src/nsterm.h
index 1c3fda8..115d7ac 100644
--- a/src/nsterm.h
+++ b/src/nsterm.h
@@ -895,11 +895,15 @@ extern int ns_select (int nfds, fd_set *readfds, fd_set 
*writefds,
 extern unsigned long ns_get_rgb_color (struct frame *f,
                                        float r, float g, float b, float a);
 
-/* From nsterm.m, needed in nsfont.m. */
 #ifdef __OBJC__
+/* From nsterm.m, needed in nsfont.m. */
 extern void
 ns_draw_text_decoration (struct glyph_string *s, struct face *face,
                          NSColor *defaultCol, CGFloat width, CGFloat x);
+/* Needed in nsfns.m.  */
+extern void
+ns_set_represented_filename (NSString* fstr, struct frame *f);
+
 #endif
 
 #ifdef NS_IMPL_GNUSTEP
diff --git a/src/nsterm.m b/src/nsterm.m
index 7e2d4be..656d866 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -290,6 +290,9 @@ static struct {
   NULL, 0, 0
 };
 
+static NSString *represented_filename = nil;
+static struct frame *represented_frame = 0;
+
 #ifdef NS_IMPL_COCOA
 /*
  * State for pending menu activation:
@@ -396,6 +399,14 @@ void x_set_frame_alpha (struct frame *f);
 
    ========================================================================== 
*/
 
+void
+ns_set_represented_filename (NSString* fstr, struct frame *f)
+{
+  represented_filename = [fstr retain];
+  represented_frame = f;
+}
+
+
 static void
 hold_event (struct input_event *event)
 {
@@ -4560,6 +4571,23 @@ ns_term_shutdown (int sig)
     }
 #endif
 
+  if (represented_filename != nil && represented_frame)
+    {
+      NSString *fstr = represented_filename;
+      NSView *view = FRAME_NS_VIEW (represented_frame);
+#ifdef NS_IMPL_COCOA
+      /* work around a bug observed on 10.3 and later where
+         setTitleWithRepresentedFilename does not clear out previous state
+         if given filename does not exist */
+      if (! [[NSFileManager defaultManager] fileExistsAtPath: fstr])
+        [[view window] setRepresentedFilename: @""];
+#endif
+      [[view window] setRepresentedFilename: fstr];
+      [represented_filename release];
+      represented_filename = nil;
+      represented_frame = NULL;
+    }
+
   if (type == NSApplicationDefined)
     {
       switch ([theEvent data2])



reply via email to

[Prev in Thread] Current Thread [Next in Thread]