aboutsummaryrefslogtreecommitdiffstats
path: root/src/nsfns.m
diff options
context:
space:
mode:
authorAlan Third2018-02-11 11:34:49 +0000
committerAlan Third2018-02-11 20:54:28 +0000
commitf7a853d818d4ef04ceefe5e34d445fd73da8fe11 (patch)
tree177a51a62ab203a24b760c5183c6ed98ffee0f79 /src/nsfns.m
parent5a75cd1f8fbdb1dc5dbadf32c1e224e32a712194 (diff)
downloademacs-f7a853d818d4ef04ceefe5e34d445fd73da8fe11.tar.gz
emacs-f7a853d818d4ef04ceefe5e34d445fd73da8fe11.zip
Remove NS special handling of 'frame-title-format'
* lisp/term/ns-win.el (frame-title-format, icon-title-format): Change default format to just the filename. * src/nsfns.m (ns-use-proxy-icon): New variable. (ns_set_name_as_filename): Remove function. (x_implicitly_set_name): Get rid of special handling of frame-title-format. * src/nsterm.h (ns_set_represented_filename): Use new definition. * src/nsterm.m (ns_set_represented_filename): Move some of the logic from ns_set_name_as_filename into this function.
Diffstat (limited to 'src/nsfns.m')
-rw-r--r--src/nsfns.m91
1 files changed, 8 insertions, 83 deletions
diff --git a/src/nsfns.m b/src/nsfns.m
index 0f60bb8107f..bbb6644ce03 100644
--- a/src/nsfns.m
+++ b/src/nsfns.m
@@ -61,7 +61,6 @@ static int as_status;
61static ptrdiff_t image_cache_refcount; 61static ptrdiff_t image_cache_refcount;
62 62
63static struct ns_display_info *ns_display_info_for_name (Lisp_Object); 63static struct ns_display_info *ns_display_info_for_name (Lisp_Object);
64static void ns_set_name_as_filename (struct frame *);
65 64
66/* ========================================================================== 65/* ==========================================================================
67 66
@@ -483,17 +482,10 @@ x_implicitly_set_name (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
483{ 482{
484 NSTRACE ("x_implicitly_set_name"); 483 NSTRACE ("x_implicitly_set_name");
485 484
486 Lisp_Object frame_title = buffer_local_value 485 if (! NILP (ns_use_proxy_icon))
487 (Qframe_title_format, XWINDOW (f->selected_window)->contents); 486 ns_set_represented_filename (f);
488 Lisp_Object icon_title = buffer_local_value
489 (Qicon_title_format, XWINDOW (f->selected_window)->contents);
490 487
491 /* Deal with NS specific format t. */ 488 ns_set_name (f, arg, 0);
492 if (FRAME_NS_P (f) && ((FRAME_ICONIFIED_P (f) && EQ (icon_title, Qt))
493 || EQ (frame_title, Qt)))
494 ns_set_name_as_filename (f);
495 else
496 ns_set_name (f, arg, 0);
497} 489}
498 490
499 491
@@ -520,78 +512,6 @@ x_set_title (struct frame *f, Lisp_Object name, Lisp_Object old_name)
520 ns_set_name_internal (f, name); 512 ns_set_name_internal (f, name);
521} 513}
522 514
523
524static void
525ns_set_name_as_filename (struct frame *f)
526{
527 NSView *view;
528 Lisp_Object name, filename;
529 Lisp_Object buf = XWINDOW (f->selected_window)->contents;
530 const char *title;
531 NSAutoreleasePool *pool;
532 Lisp_Object encoded_name, encoded_filename;
533 NSString *str;
534 NSTRACE ("ns_set_name_as_filename");
535
536 if (f->explicit_name || ! NILP (f->title))
537 return;
538
539 block_input ();
540 pool = [[NSAutoreleasePool alloc] init];
541 filename = BVAR (XBUFFER (buf), filename);
542 name = BVAR (XBUFFER (buf), name);
543
544 if (NILP (name))
545 {
546 if (! NILP (filename))
547 name = Ffile_name_nondirectory (filename);
548 else
549 name = build_string ([ns_app_name UTF8String]);
550 }
551
552 encoded_name = ENCODE_UTF_8 (name);
553
554 view = FRAME_NS_VIEW (f);
555
556 title = FRAME_ICONIFIED_P (f) ? [[[view window] miniwindowTitle] UTF8String]
557 : [[[view window] title] UTF8String];
558
559 if (title && (! strcmp (title, SSDATA (encoded_name))))
560 {
561 [pool release];
562 unblock_input ();
563 return;
564 }
565
566 str = [NSString stringWithUTF8String: SSDATA (encoded_name)];
567 if (str == nil) str = @"Bad coding";
568
569 if (FRAME_ICONIFIED_P (f))
570 [[view window] setMiniwindowTitle: str];
571 else
572 {
573 NSString *fstr;
574
575 if (! NILP (filename))
576 {
577 encoded_filename = ENCODE_UTF_8 (filename);
578
579 fstr = [NSString stringWithUTF8String: SSDATA (encoded_filename)];
580 if (fstr == nil) fstr = @"";
581 }
582 else
583 fstr = @"";
584
585 ns_set_represented_filename (fstr, f);
586 [[view window] setTitle: str];
587 fset_name (f, name);
588 }
589
590 [pool release];
591 unblock_input ();
592}
593
594
595void 515void
596ns_set_doc_edited (void) 516ns_set_doc_edited (void)
597{ 517{
@@ -3311,6 +3231,11 @@ be used as the image of the icon representing the frame. */);
3311 doc: /* Toolkit version for NS Windowing. */); 3231 doc: /* Toolkit version for NS Windowing. */);
3312 Vns_version_string = ns_appkit_version_str (); 3232 Vns_version_string = ns_appkit_version_str ();
3313 3233
3234 DEFVAR_BOOL ("ns-use-proxy-icon", ns_use_proxy_icon,
3235 doc: /* When non-nil display a proxy icon in the titlebar.
3236Default is t. */);
3237 ns_use_proxy_icon = Qt;
3238
3314 defsubr (&Sns_read_file_name); 3239 defsubr (&Sns_read_file_name);
3315 defsubr (&Sns_get_resource); 3240 defsubr (&Sns_get_resource);
3316 defsubr (&Sns_set_resource); 3241 defsubr (&Sns_set_resource);