Stop using NSFullSizeContentViewWindowMask
to get borderless windows, because that disables the swap interval.
#729
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This hack is very simple but a little evil. We get the superview of the
content view, which is the
NSThemeFrame
, and install an OpenGL contextinto it.
NSThemeFrame
is a private class, but we never speak itsname, we get to it with public APIs, and we only call public
NSView
APIs on it, so this seems OK in terms of being supported by Apple going
forward.
Additionally, we remove the standard window buttons so that they
disappear and the user can't click them. This can also be done using
public APIs.
The reason for using this hack as opposed to
NSFullSizeContentViewWindowMask
is that the latter forces the windowto be Core Animation-backed, which results in us rendering to an off
screen surface. Not only does this inject another compositor into the
system, but it also results in us rendering to an off-screen surface,
disabling the swap interval.
This depends on a
cocoa-rs
upgrade to add a binding to the-[NSView superview]
method.Note that the top edge of the window is not rounded, although the shadow
is. Applications that wish to use this mode will need to round the top
edge themselves if they wish. (This is how Cocoa internally works:
rounding is done by the app, not the window manager.)
This should fix servo/servo#9431.