From deb3e9a368664745fddbcaed5a8b98292f67b2c2 Mon Sep 17 00:00:00 2001 From: Bjorn Winckler Date: Thu, 30 Dec 2010 15:20:08 +0100 Subject: [PATCH] Add full screen window title to "Window" menu --- src/MacVim/MMFullscreenWindow.m | 7 ++++++- src/MacVim/MMWindowController.m | 13 +++++++++++-- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/src/MacVim/MMFullscreenWindow.m b/src/MacVim/MMFullscreenWindow.m index 3b1f10271b..a0e9891a30 100644 --- a/src/MacVim/MMFullscreenWindow.m +++ b/src/MacVim/MMFullscreenWindow.m @@ -148,9 +148,14 @@ // NOTE: Calling setTitle:nil causes an exception to be raised (and it is // possible that 'target' has no title when we get here). - if ([target title]) + if ([target title]) { [self setTitle:[target title]]; + // NOTE: Cocoa does not add borderless windows to the "Window" menu so + // we have to do it manually. + [NSApp changeWindowsItem:self title:[target title] filename:NO]; + } + [self setOpaque:[target isOpaque]]; // don't set this sooner, so we don't get an additional diff --git a/src/MacVim/MMWindowController.m b/src/MacVim/MMWindowController.m index f367145551..29dd92b144 100644 --- a/src/MacVim/MMWindowController.m +++ b/src/MacVim/MMWindowController.m @@ -360,8 +360,17 @@ - (void)setTitle:(NSString *)title { - if (title) - [decoratedWindow setTitle:title]; + if (!title) + return; + + [decoratedWindow setTitle:title]; + if (fullscreenEnabled) { + [fullscreenWindow setTitle:title]; + + // NOTE: Cocoa does not update the "Window" menu for borderless windows + // so we have to do it manually. + [NSApp changeWindowsItem:fullscreenWindow title:title filename:NO]; + } } - (void)setDocumentFilename:(NSString *)filename