summaryrefslogtreecommitdiff
path: root/src/nsterm.m
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2014-12-05 15:30:09 -0500
committerStefan Monnier <monnier@iro.umontreal.ca>2014-12-05 15:30:09 -0500
commit4fda400e58339cdf962b5679bf05ebe62c6189c5 (patch)
tree8588108b9046f7ec6747112cd30509466ea49459 /src/nsterm.m
parent0d7b2c96d388f5a9b539df3cb7f4ef115e7010b7 (diff)
parentc1c2cee7c5ae1eff6edb198814423e55cb11cc73 (diff)
downloademacs-4fda400e58339cdf962b5679bf05ebe62c6189c5.tar.gz
Merge from emacs-24
Diffstat (limited to 'src/nsterm.m')
-rw-r--r--src/nsterm.m27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/nsterm.m b/src/nsterm.m
index 8729fa55a92..f012528b40d 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -293,6 +293,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:
@@ -400,6 +403,13 @@ 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;
+}
+
+void
ns_init_events (struct input_event* ev)
{
EVENT_INIT (*ev);
@@ -4600,6 +4610,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])