Blade window transparency (#10973)

Release Notes:

- N/A

Following up to #10880
TODO:
- [x] create window as transparent
  - [x] X11
  - [x] Wayland
  - [ ] Windows
  - [x] MacOS (when used with Blade)  
- [x] enable GPU surface transparency
- [x] adjust the pipeline blend modes
- [x] adjust shader outputs


![transparency2](https://github.com/zed-industries/zed/assets/107301/d554a41b-5d3f-4420-a857-c64c1747c2d5)

Blurred results from @jansol (on Wayland), who contributed to this work:


![zed-blur](https://github.com/zed-industries/zed/assets/107301/a6822171-2dcf-4109-be55-b75557c586de)

---------

Co-authored-by: Jan Solanti <jhs@psonet.com>
This commit is contained in:
Dzmitry Malyshau
2024-05-06 09:53:08 -07:00
committed by GitHub
co-authored by Jan Solanti
parent 056c785f4e
commit e4f13dd561
11 changed files with 343 additions and 127 deletions
@@ -37,6 +37,7 @@ pub unsafe fn new_renderer(
_native_window: *mut c_void,
_native_view: *mut c_void,
_bounds: crate::Size<f32>,
_transparent: bool,
) -> Renderer {
MetalRenderer::new(context)
}
@@ -231,6 +232,10 @@ impl MetalRenderer {
}
}
pub fn update_transparency(&mut self, _transparent: bool) {
// todo(mac)?
}
pub fn destroy(&mut self) {
// nothing to do
}
+5 -1
View File
@@ -626,6 +626,7 @@ impl MacWindow {
native_window as *mut _,
native_view as *mut _,
window_size,
window_background != WindowBackgroundAppearance::Opaque,
),
request_frame_callback: None,
event_callback: None,
@@ -979,7 +980,10 @@ impl PlatformWindow for MacWindow {
fn set_app_id(&mut self, _app_id: &str) {}
fn set_background_appearance(&mut self, background_appearance: WindowBackgroundAppearance) {
let this = self.0.as_ref().lock();
let mut this = self.0.as_ref().lock();
this.renderer
.update_transparency(background_appearance != WindowBackgroundAppearance::Opaque);
let blur_radius = if background_appearance == WindowBackgroundAppearance::Blurred {
80
} else {