Skip to content

Commit 6d044f9

Browse files
committed
Fix non-native full screen sizing, fix 'fuoptions', allow menus
Fix misc non-native full screen sizing issues. Previously, in certain cases such as using non-native full screen in a secondary monitor, the non-native full screen window would be offsetted and half the window shown offscreen, making it hard to use. The bug is that we call `resizeVimView` and `centerView` immediately after resizing Vim's frame, but the frame resize only asynchronously calls processInputQueueDidFinish in MMWindowController, which now actually handles all the frame resizing logic. `centerView` was therefore calculating using the wrong info, and tried to center the view on wrong coordinates. Just fix this by removing those two functions as they are no longer needed as processInputQueueDidFinish already does everything. Also, fix `fuopts` to support unsetting maxvert/maxhorz again (this was what `centerView` was trying to do). Simply add hooks to processInputQueueDidFinish to query the non-native full screen window for what the desired size is, instead of just assuming we wan to fill the whole frame. * Fix #509 Also, add a new option `MMNonNativeFullScreenShowMenu` to allow showing the menu bar instead of auto-hiding it while using non-native full screen as it could be useful to show it, and less jarring to switch among different apps. Move preferences around so non-native full screen is now a "regular" option under Apperance instead of Advanced. Also expose the non-native show menu option so it's exposed to users. This is a follow-up to #1155.
1 parent ffe535a commit 6d044f9

10 files changed

Lines changed: 130 additions & 155 deletions

File tree

runtime/doc/gui_mac.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,7 @@ KEY VALUE ~
263263
*MMLoginShellArgument* login shell parameter [string]
264264
*MMLoginShellCommand* which shell to use to launch Vim [string]
265265
*MMNativeFullScreen* use native full screen mode [bool]
266+
*MMNonNativeFullScreenShowMenu* show menus when in non-native full screen [bool]
266267
*MMNoFontSubstitution* disable automatic font substitution [bool]
267268
(Deprecated: Non-CoreText renderer only)
268269
*MMFontPreserveLineSpacing* use the line-spacing as specified by font [bool]

runtime/doc/options.txt

Lines changed: 9 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3607,23 +3607,19 @@ A jump table for the options with a short description can be found at |Q_op|.
36073607
global
36083608
{not in Vi}
36093609
{only in MacVim GUI}
3610-
In fullscreen mode, most of the screen is black, only a part of the
3611-
screen is covered by the actual Vim control. The control is centered.
3612-
This option controls the size of the Vim control as well as the color
3613-
of the unused screen area.
3610+
{not supported in native full screen mode}
3611+
In non-native fullscreen mode, MacVim can be configured to either show
3612+
all the content filling up the whole screen, or only use part of the
3613+
screen to show the content, centered. This option controls the size
3614+
of the Vim control as well as the color of the unused screen area.
36143615
value effect ~
36153616
maxvert When entering fullscreen, 'lines' is set to the maximum number
3616-
of lines fitting on the screen in fullscreen mode. When
3617-
leaving fullscreen, if 'lines' is still equal to the maximized
3618-
number of lines, it is restored to the value it had before
3619-
entering fullscreen.
3617+
of lines fitting on the screen in fullscreen mode. If unset,
3618+
'lines' will be unchanged when entering fullscreen mode.
36203619
maxhorz When entering fullscreen, 'columns' is set to the maximum number
3621-
of columns fitting on the screen in fullscreen mode. When
3622-
leaving fullscreen, if 'columns' is still equal to the maximized
3623-
number of columns, it is restored to the value it had before
3624-
entering fullscreen.
3620+
of columns fitting on the screen in fullscreen mode. If unset,
3621+
'columns' will be unchanged when entering fullscreen mode.
36253622
background:color
3626-
{not supported in Mac OS X native full screen}
36273623
When entering fullscreen, 'color' defines the color of the part
36283624
of the screen that is not occupied by the Vim control. If
36293625
'color' is an 8-digit hexadecimal number preceded by '#',
@@ -3645,13 +3641,6 @@ A jump table for the options with a short description can be found at |Q_op|.
36453641
< Don't change size when entering fullscreen, and color the background
36463642
like the current text background: >
36473643
:set fuoptions=background:Normal
3648-
<
3649-
XXX: what if the font size is changed? you probably never want to
3650-
restore the old 'lines' or 'columns' in that case.
3651-
XXX: Each time the Vim window resizes (for example due to font size
3652-
changes, re-maximize Vim to fullscreen?)
3653-
XXX: The approach doesn't restore vertical Vim size if fu is entered
3654-
without tabs and leaves with tabs (or the other way round).
36553644
36563645
36573646

runtime/doc/tags

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5030,6 +5030,7 @@ MMLoginShellCommand gui_mac.txt /*MMLoginShellCommand*
50305030
MMNativeFullScreen gui_mac.txt /*MMNativeFullScreen*
50315031
MMNoFontSubstitution gui_mac.txt /*MMNoFontSubstitution*
50325032
MMNoTitleBarWindow gui_mac.txt /*MMNoTitleBarWindow*
5033+
MMNonNativeFullScreenShowMenu gui_mac.txt /*MMNonNativeFullScreenShowMenu*
50335034
MMShareFindPboard gui_mac.txt /*MMShareFindPboard*
50345035
MMShowAddTabButton gui_mac.txt /*MMShowAddTabButton*
50355036
MMTabMaxWidth gui_mac.txt /*MMTabMaxWidth*

src/MacVim/Base.lproj/Preferences.xib

Lines changed: 65 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -227,11 +227,11 @@
227227
<point key="canvasLocation" x="138" y="20"/>
228228
</customView>
229229
<customView id="hr4-G4-3ZG" userLabel="Appearance">
230-
<rect key="frame" x="0.0" y="0.0" width="483" height="270"/>
230+
<rect key="frame" x="0.0" y="0.0" width="483" height="315"/>
231231
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
232232
<subviews>
233233
<customView id="fw0-VK-Nbz" userLabel="Dark mode selection">
234-
<rect key="frame" x="19" y="92" width="433" height="156"/>
234+
<rect key="frame" x="19" y="137" width="433" height="156"/>
235235
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
236236
<subviews>
237237
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" id="T40-Os-PUf" userLabel="Dark mode selection">
@@ -292,7 +292,7 @@
292292
</subviews>
293293
</customView>
294294
<customView id="7af-iK-4r7" userLabel="Titlebar appearance">
295-
<rect key="frame" x="19" y="46" width="433" height="38"/>
295+
<rect key="frame" x="19" y="91" width="433" height="38"/>
296296
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
297297
<subviews>
298298
<button id="7ie-0J-0Zr">
@@ -330,27 +330,73 @@
330330
</button>
331331
</subviews>
332332
</customView>
333-
<customView id="BpJ-rH-ona" userLabel="Font">
333+
<customView id="BpJ-rH-ona" userLabel="Full Screen">
334+
<rect key="frame" x="19" y="45" width="433" height="38"/>
335+
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
336+
<subviews>
337+
<button toolTip="Use macOS's native full screen mode, which integrates with Mission Control and creates a new Space for the window." id="YKV-u2-Egc" userLabel="Use native full screen">
338+
<rect key="frame" x="189" y="19" width="244" height="18"/>
339+
<autoresizingMask key="autoresizingMask" flexibleMinY="YES"/>
340+
<buttonCell key="cell" type="check" title="Use native full screen mode" bezelStyle="regularSquare" imagePosition="left" alignment="left" inset="2" id="2ni-Is-Caz" userLabel="Use native full screen">
341+
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
342+
<font key="font" metaFont="system"/>
343+
</buttonCell>
344+
<connections>
345+
<action selector="fontPropertiesChanged:" target="-2" id="uaN-zX-Lvq"/>
346+
<binding destination="58" name="value" keyPath="values.MMNativeFullScreen" id="Y8t-au-n4b"/>
347+
</connections>
348+
</button>
349+
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" id="VAj-Yx-2uZ" userLabel="Full Sc">
350+
<rect key="frame" x="-2" y="20" width="187" height="17"/>
351+
<autoresizingMask key="autoresizingMask" flexibleMinY="YES"/>
352+
<textFieldCell key="cell" sendsActionOnEndEditing="YES" alignment="right" title="Full Screen:" id="bMQ-uG-iDR">
353+
<font key="font" metaFont="system"/>
354+
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
355+
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
356+
</textFieldCell>
357+
</textField>
358+
<button id="Fru-Q7-7SG" userLabel="Non-native menu bar">
359+
<rect key="frame" x="189" y="2" width="237" height="18"/>
360+
<autoresizingMask key="autoresizingMask" flexibleMinY="YES"/>
361+
<buttonCell key="cell" type="check" title="Show menu bar in non-native mode" bezelStyle="regularSquare" imagePosition="left" alignment="left" inset="2" id="Kok-Et-R5A" userLabel="Show menu bar in non-native full screen">
362+
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
363+
<font key="font" metaFont="system"/>
364+
<connections>
365+
<binding destination="58" name="enabled" keyPath="values.MMNativeFullScreen" id="Uw8-jM-9g1">
366+
<dictionary key="options">
367+
<string key="NSValueTransformerName">NSNegateBoolean</string>
368+
</dictionary>
369+
</binding>
370+
</connections>
371+
</buttonCell>
372+
<connections>
373+
<action selector="fontPropertiesChanged:" target="-2" id="1RM-UT-GNp"/>
374+
<binding destination="58" name="value" keyPath="values.MMNonNativeFullScreenShowMenu" id="5wX-jg-QPo"/>
375+
</connections>
376+
</button>
377+
</subviews>
378+
</customView>
379+
<customView id="a3v-cB-TFa" userLabel="Font">
334380
<rect key="frame" x="19" y="20" width="433" height="18"/>
335381
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
336382
<subviews>
337-
<button id="YKV-u2-Egc" userLabel="Preserve Line Spacing">
383+
<button id="A48-s0-kdR" userLabel="Preserve Line Spacing">
338384
<rect key="frame" x="189" y="-1" width="244" height="18"/>
339385
<autoresizingMask key="autoresizingMask" flexibleMinY="YES"/>
340386
<string key="toolTip">Some fonts have non-standard built-in line spacings (anything other than 1). If this is checked, MacVim will use the font's specified line spacing to calculate line height. Otherwise, it will just set it to 1, which helps if you would like a more compact spacing without having to install another font.</string>
341-
<buttonCell key="cell" type="check" title="Preserve font line spacing" bezelStyle="regularSquare" imagePosition="left" alignment="left" inset="2" id="2ni-Is-Caz" userLabel="Preserve Line Spacing">
387+
<buttonCell key="cell" type="check" title="Preserve font line spacing" bezelStyle="regularSquare" imagePosition="left" alignment="left" inset="2" id="SeR-yl-Gtz" userLabel="Preserve Line Spacing">
342388
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
343389
<font key="font" metaFont="system"/>
344390
</buttonCell>
345391
<connections>
346-
<action selector="fontPropertiesChanged:" target="-2" id="uaN-zX-Lvq"/>
347-
<binding destination="58" name="value" keyPath="values.MMFontPreserveLineSpacing" id="i6W-kG-7G5"/>
392+
<action selector="fontPropertiesChanged:" target="-2" id="tbK-S9-Vbs"/>
393+
<binding destination="58" name="value" keyPath="values.MMFontPreserveLineSpacing" id="6cJ-Uj-qVy"/>
348394
</connections>
349395
</button>
350-
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" id="VAj-Yx-2uZ" userLabel="Font">
396+
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" id="8WW-zu-LlE" userLabel="Font">
351397
<rect key="frame" x="-2" y="0.0" width="187" height="17"/>
352398
<autoresizingMask key="autoresizingMask" flexibleMinY="YES"/>
353-
<textFieldCell key="cell" sendsActionOnEndEditing="YES" alignment="right" title="Font:" id="bMQ-uG-iDR">
399+
<textFieldCell key="cell" sendsActionOnEndEditing="YES" alignment="right" title="Font:" id="eV4-3c-P2e">
354400
<font key="font" metaFont="system"/>
355401
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
356402
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
@@ -359,14 +405,14 @@
359405
</subviews>
360406
</customView>
361407
</subviews>
362-
<point key="canvasLocation" x="138" y="390"/>
408+
<point key="canvasLocation" x="137.5" y="412.5"/>
363409
</customView>
364410
<customView id="620" userLabel="Advanced">
365-
<rect key="frame" x="0.0" y="0.0" width="483" height="318"/>
411+
<rect key="frame" x="0.0" y="0.0" width="483" height="264"/>
366412
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
367413
<subviews>
368414
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" id="826">
369-
<rect key="frame" x="17" y="170" width="449" height="56"/>
415+
<rect key="frame" x="17" y="116" width="449" height="56"/>
370416
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
371417
<textFieldCell key="cell" controlSize="small" sendsActionOnEndEditing="YES" id="993">
372418
<font key="font" metaFont="smallSystem"/>
@@ -376,7 +422,7 @@
376422
</textFieldCell>
377423
</textField>
378424
<button id="817">
379-
<rect key="frame" x="18" y="228" width="133" height="18"/>
425+
<rect key="frame" x="18" y="174" width="133" height="18"/>
380426
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
381427
<buttonCell key="cell" type="check" title="Enable Quickstart" bezelStyle="regularSquare" imagePosition="left" alignment="left" inset="2" id="992">
382428
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
@@ -388,7 +434,7 @@
388434
</connections>
389435
</button>
390436
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" id="815">
391-
<rect key="frame" x="17" y="252" width="449" height="28"/>
437+
<rect key="frame" x="17" y="198" width="449" height="28"/>
392438
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
393439
<textFieldCell key="cell" controlSize="small" sendsActionOnEndEditing="YES" title="(Deprecated) Deselect this option to use the legacy renderer, which is unsupported and will be removed in a future version." id="991">
394440
<font key="font" metaFont="smallSystem"/>
@@ -397,7 +443,7 @@
397443
</textFieldCell>
398444
</textField>
399445
<button id="782">
400-
<rect key="frame" x="18" y="282" width="174" height="18"/>
446+
<rect key="frame" x="18" y="228" width="174" height="18"/>
401447
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
402448
<buttonCell key="cell" type="check" title="Use Core Text renderer" bezelStyle="regularSquare" imagePosition="left" alignment="left" inset="2" id="990">
403449
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
@@ -409,7 +455,7 @@
409455
</connections>
410456
</button>
411457
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" id="1001">
412-
<rect key="frame" x="17" y="74" width="444" height="70"/>
458+
<rect key="frame" x="17" y="20" width="444" height="70"/>
413459
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
414460
<textFieldCell key="cell" controlSize="small" sendsActionOnEndEditing="YES" id="1004">
415461
<font key="font" metaFont="smallSystem"/>
@@ -419,7 +465,7 @@
419465
</textFieldCell>
420466
</textField>
421467
<button id="1013">
422-
<rect key="frame" x="18" y="146" width="174" height="18"/>
468+
<rect key="frame" x="18" y="92" width="174" height="18"/>
423469
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
424470
<buttonCell key="cell" type="check" title="Draw marked text inline" bezelStyle="regularSquare" imagePosition="left" alignment="left" inset="2" id="1014">
425471
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
@@ -429,29 +475,8 @@
429475
<binding destination="58" name="value" keyPath="values.MMUseInlineIm" id="1016"/>
430476
</connections>
431477
</button>
432-
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" id="1017">
433-
<rect key="frame" x="17" y="20" width="415" height="28"/>
434-
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
435-
<textFieldCell key="cell" controlSize="small" sendsActionOnEndEditing="YES" id="1020">
436-
<font key="font" metaFont="smallSystem"/>
437-
<string key="title">You may want to disable this option when using multiple monitors since the native full-screen support renders secondary monitors useless.</string>
438-
<color key="textColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
439-
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
440-
</textFieldCell>
441-
</textField>
442-
<button id="1028">
443-
<rect key="frame" x="18" y="50" width="388" height="18"/>
444-
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
445-
<buttonCell key="cell" type="check" title="Prefer native full-screen support (requires Mac OS X 10.7)" bezelStyle="regularSquare" imagePosition="left" alignment="left" state="on" inset="2" id="1029">
446-
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
447-
<font key="font" metaFont="system"/>
448-
</buttonCell>
449-
<connections>
450-
<binding destination="58" name="value" keyPath="values.MMNativeFullScreen" id="1031"/>
451-
</connections>
452-
</button>
453478
</subviews>
454-
<point key="canvasLocation" x="138" y="770"/>
479+
<point key="canvasLocation" x="137.5" y="743"/>
455480
</customView>
456481
</objects>
457482
</document>

src/MacVim/MMAppController.m

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,7 @@ + (void)initialize
249249
[NSNumber numberWithBool:NO], MMSuppressTerminationAlertKey,
250250
[NSNumber numberWithBool:YES], MMNativeFullScreenKey,
251251
[NSNumber numberWithDouble:0.25], MMFullScreenFadeTimeKey,
252+
[NSNumber numberWithBool:NO], MMNonNativeFullScreenShowMenuKey,
252253
[NSNumber numberWithBool:YES], MMShareFindPboardKey,
253254
nil];
254255

src/MacVim/MMFullScreenWindow.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@
2525
// These are only valid in full-screen mode and store pre-fu vim size
2626
int nonFuRows, nonFuColumns;
2727

28-
// These store the size vim had right after entering fu mode
29-
int startFuRows, startFuColumns;
28+
/// The non-full-screen size of the Vim view. Used for non-maxvert/maxhorz options.
29+
NSSize nonFuVimViewSize;
3030

3131
// This stores the contents of fuoptions_flags at fu start time
3232
int startFuFlags;
@@ -41,7 +41,7 @@
4141
- (void)setOptions:(int)opt;
4242
- (void)enterFullScreen;
4343
- (void)leaveFullScreen;
44-
- (void)centerView;
44+
- (NSRect)getDesiredFrame;
4545

4646
- (BOOL)canBecomeKeyWindow;
4747
- (BOOL)canBecomeMainWindow;

0 commit comments

Comments
 (0)