From 3bcd07d56297e02a3fe8216915cb450d3c1a4cef Mon Sep 17 00:00:00 2001 From: Bjorn Winckler Date: Thu, 30 Dec 2010 21:23:13 +0100 Subject: [PATCH] Avoid switching Spaces when entering full screen This fixes a bug where MacVim would switch Space when entering full screen (which only occurred when MacVim was assigned to a specific Space in the System Preferences). --- src/MacVim/MMFullscreenWindow.m | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/MacVim/MMFullscreenWindow.m b/src/MacVim/MMFullscreenWindow.m index a0e9891a30..ca6ceeeb59 100644 --- a/src/MacVim/MMFullscreenWindow.m +++ b/src/MacVim/MMFullscreenWindow.m @@ -116,6 +116,12 @@ { ASLogDebug(@"Enter full screen now"); + // HACK! Put window on all Spaces to avoid Spaces from moving the full + // screen window to a separate Space from the one the decorated window is + // occupying. The collection behavior is restored further down. + NSWindowCollectionBehavior wcb = [self collectionBehavior]; + [self setCollectionBehavior:NSWindowCollectionBehaviorCanJoinAllSpaces]; + // fade to black Boolean didBlend = NO; CGDisplayFadeReservationToken token; @@ -231,6 +237,9 @@ kCGDisplayBlendNormal, .0, .0, .0, false); CGReleaseDisplayFadeReservation(token); } + + // Restore collection behavior (see hack at start of this method). + [self setCollectionBehavior:wcb]; } - (void)leaveFullscreen