diff options
| author | Alan Third | 2018-02-11 11:34:49 +0000 |
|---|---|---|
| committer | Alan Third | 2018-02-11 20:54:28 +0000 |
| commit | f7a853d818d4ef04ceefe5e34d445fd73da8fe11 (patch) | |
| tree | 177a51a62ab203a24b760c5183c6ed98ffee0f79 /src | |
| parent | 5a75cd1f8fbdb1dc5dbadf32c1e224e32a712194 (diff) | |
| download | emacs-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')
| -rw-r--r-- | src/nsfns.m | 91 | ||||
| -rw-r--r-- | src/nsterm.h | 2 | ||||
| -rw-r--r-- | src/nsterm.m | 30 |
3 files changed, 38 insertions, 85 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; | |||
| 61 | static ptrdiff_t image_cache_refcount; | 61 | static ptrdiff_t image_cache_refcount; |
| 62 | 62 | ||
| 63 | static struct ns_display_info *ns_display_info_for_name (Lisp_Object); | 63 | static struct ns_display_info *ns_display_info_for_name (Lisp_Object); |
| 64 | static 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 | |||
| 524 | static void | ||
| 525 | ns_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 | |||
| 595 | void | 515 | void |
| 596 | ns_set_doc_edited (void) | 516 | ns_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. | ||
| 3236 | Default 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); |
diff --git a/src/nsterm.h b/src/nsterm.h index cc4c6d5e910..8b985930ecb 100644 --- a/src/nsterm.h +++ b/src/nsterm.h | |||
| @@ -1237,7 +1237,7 @@ extern void ns_finish_events (void); | |||
| 1237 | #ifdef __OBJC__ | 1237 | #ifdef __OBJC__ |
| 1238 | /* Needed in nsfns.m. */ | 1238 | /* Needed in nsfns.m. */ |
| 1239 | extern void | 1239 | extern void |
| 1240 | ns_set_represented_filename (NSString *fstr, struct frame *f); | 1240 | ns_set_represented_filename (struct frame *f); |
| 1241 | 1241 | ||
| 1242 | #endif | 1242 | #endif |
| 1243 | 1243 | ||
diff --git a/src/nsterm.m b/src/nsterm.m index b7f5a32c098..56a1e01ba18 100644 --- a/src/nsterm.m +++ b/src/nsterm.m | |||
| @@ -444,10 +444,38 @@ static void ns_judge_scroll_bars (struct frame *f); | |||
| 444 | ========================================================================== */ | 444 | ========================================================================== */ |
| 445 | 445 | ||
| 446 | void | 446 | void |
| 447 | ns_set_represented_filename (NSString *fstr, struct frame *f) | 447 | ns_set_represented_filename (struct frame *f) |
| 448 | { | 448 | { |
| 449 | NSView *view; | ||
| 450 | Lisp_Object filename, encoded_filename; | ||
| 451 | Lisp_Object buf = XWINDOW (f->selected_window)->contents; | ||
| 452 | NSAutoreleasePool *pool; | ||
| 453 | NSString *fstr; | ||
| 454 | |||
| 455 | NSTRACE ("ns_set_represented_filename"); | ||
| 456 | |||
| 457 | if (f->explicit_name || ! NILP (f->title)) | ||
| 458 | return; | ||
| 459 | |||
| 460 | block_input (); | ||
| 461 | pool = [[NSAutoreleasePool alloc] init]; | ||
| 462 | filename = BVAR (XBUFFER (buf), filename); | ||
| 463 | |||
| 464 | if (! NILP (filename)) | ||
| 465 | { | ||
| 466 | encoded_filename = ENCODE_UTF_8 (filename); | ||
| 467 | |||
| 468 | fstr = [NSString stringWithUTF8String: SSDATA (encoded_filename)]; | ||
| 469 | if (fstr == nil) fstr = @""; | ||
| 470 | } | ||
| 471 | else | ||
| 472 | fstr = @""; | ||
| 473 | |||
| 449 | represented_filename = [fstr retain]; | 474 | represented_filename = [fstr retain]; |
| 450 | represented_frame = f; | 475 | represented_frame = f; |
| 476 | |||
| 477 | [pool release]; | ||
| 478 | unblock_input (); | ||
| 451 | } | 479 | } |
| 452 | 480 | ||
| 453 | void | 481 | void |