-
Notifications
You must be signed in to change notification settings - Fork 69
Handle zero-sized buffers internally #295
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
5806393 to
76304d2
Compare
e557e78 to
2d34da5
Compare
2d34da5 to
2f274d7
Compare
And default to a 0-sized buffer instead of panicking in `buffer_mut`.
2f274d7 to
13c5cee
Compare
| self.released.clone(), | ||
| )) | ||
| } else { | ||
| None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can attach a null buffer to a surface on Wayland, but this has the effect of unmapping the surface, rather than having a surface with a 0x0 size. If that isn't how this behaves on other platforms, it may be better to use a 1x1 (transparent?) buffer to approximate the effect of having the surface mapped but with a 0x0 size.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I've been kinda going back and forth between what would be best here.
On macOS, if you don't provide any CALayer contents, whatever is behind the surface is rendered (usually the window backdrop). If the window is marked as transparent (the window backdrop is made transparent), only the title bar will remain.
IIUC that's basically what using a 1x1 buffer would do on Wayland, whereas unmapping the surface also means that the window decorations etc. are removed.
Use
u32in our public API instead ofNonZeroU32, and handlewidth == 0 || height == 0internally. This resolves #238. Note that there are still a few inconsistencies between platforms in how things are rendered when the buffer is smaller than the window, but that is pre-existing, see #177.We can now also default to a 0-sized buffer instead of panicking in
buffer_mut, which resolves #106.Tested on: