Fix rendering issues when built against the 10.14 SDK. by s4y · Pull Request #757 · macvim-dev/macvim
Before this commit, the Core Text renderer relied on a legacy behavior of NSView to keep its content across draws. setNeedsDisplayInRect: drew over parts of the existing content as drawing commands were received, without ever redrawing old content. Layer backed views don't preserve content between draws and may be asked to redraw at any time, and layer backing is default on in the 10.14 SDK. This change adds a way to draw to a CGBitmapContext and then display that in the view's layer. It's similar to the CGLayer path, but I wasn't able to get the CGLayer path to work without hanging or crashing when I scrolled. My best guess from looking at stack traces is that using CGContextDrawLayerInRect to draw a layer into itself doesn't actually copy pixels, but adds the self-draw as an action to be performed when the CGLayer is drawn into a bitmap context. Scrolling stacks these actions, which either hangs or overflows the stack when drawn. The new code is controlled by the MMBufferedDrawing user default, which is on by default on macOS >= 10.14 with this change. Fixes macvim-dev#751.
Fix the misc resizing issues with the previous CoreText renderer commit, in particular cases where zoom button was clicked, Vim initiated resizing (e.g. ":set lines+=10"), font size changes (Cmd-+/-), fullscreen toggles, etc. - The core issue is that the order of operation for those are not consistent. Sometimes, MacVim changes window size first before letting Vim knows, but other times it lets Vim handle it before resizing (e.g. zoom). - The new CoreText renderer's buffer needs to know when the size change in order to resize the buffer, and it wasn't doing it in the right spot. Fix it so that it's delayed until updateLayer: is called. By that time both MacVim and Vim should have already come to an agreement on the new size. - Also, when using the new 10.14 buffer renderer, don't use [NSAnimationContext beginGrouping] to block the system from resizing the window, because it also suffers from the order of operation issue and sometimes endGrouping could get called before beginGrouping, causing the UI to appear frozen. Instead, just have updateLayer make a new image and copy over the old one to avoid the black flickering when resizing (which was what the begin/endGrouping was trying to solve to begin with), and the UI now works smoother as well (e.g. double clicking the border now works smoothly). The previous change also set the window background color to whatever default background color is which is fine but it affects the tabline separator as well and makes it look jarring. The tabline separator is mostly a relic of the older macOS versions, so disable it on new-ish macOS verisons. Also, update docs in the known issues section to make it clear there's currently an issue in performance under Mojave. That will be removed when the performance is fixed in the future.
This was referenced
Dec 4, 2018
comex
mentioned this pull request
ychin added a commit to ychin/macvim that referenced this pull request
Dec 5, 2018Vim patch 8.1.560
Targets macOS 10.8+
Features:
- macOS Mojave (10.14) is now supported.
- MacVim's UI now works with Dark Mode.
- Fixed broken rendering and flickering under Mojave when using the
default Core Text renderer. macvim-dev#757
- guioption 'k' is supported again. macvim-dev#731
- This option prevents window from resizing when UI elements such as
toolbars or tabs show or hide themselves.
Fixes:
- Fixed misc fullscreen and window resizing bugs and artifacts macvim-dev#745
- Dragging tabs to reorder now works properly macvim-dev#789
- Fixed timer callback handling in GUI macvim-dev#749
- Fixed native tabs (10.12+) interring with Vim tabs macvim-dev#788
- Fixed Japanese IME Ctrl-U/Ctrl-O handling macvim-dev#742
- Fixed MMShareFindPboard and Cmd-E/Cmd-G interactions macvim-dev#780
- Better handling of guifontwide font size macvim-dev#737
- Better python discovery in default vimrc macvim-dev#739
Known Issues:
- Scrolling performance is slightly worse under Mojave macvim-dev#796
Script interfaces have compatibility with these versions:
- Lua 5.3
- Perl 5.18
- Python2 2.7
- Python3 3.7
- Ruby 2.5
ychin added a commit that referenced this pull request
Dec 5, 2018Vim patch 8.1.560
Targets macOS 10.8+
Features:
- macOS Mojave (10.14) is now supported.
- MacVim's UI now works with Dark Mode.
- Fixed broken rendering and flickering under Mojave when using the
default Core Text renderer. #757
- guioption 'k' is supported again. #731
- This option prevents window from resizing when UI elements such as
toolbars or tabs show or hide themselves.
Fixes:
- Fixed misc fullscreen and window resizing bugs and artifacts #745
- Dragging tabs to reorder now works properly #789
- Fixed timer callback handling in GUI #749
- Fixed native tabs (10.12+) interring with Vim tabs #788
- Fixed Japanese IME Ctrl-U/Ctrl-O handling #742
- Fixed MMShareFindPboard and Cmd-E/Cmd-G interactions #780
- Better handling of guifontwide font size #737
- Better python discovery in default vimrc #739
Known Issues:
- Scrolling performance is slightly worse under Mojave #796
Script interfaces have compatibility with these versions:
- Lua 5.3
- Perl 5.18
- Python2 2.7
- Python3 3.7
- Ruby 2.5
ychin
mentioned this pull request
s4y
deleted the
fix-the-flicker
branch
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters