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  Blurred results from @jansol (on Wayland), who contributed to this work:  --------- Co-authored-by: Jan Solanti <jhs@psonet.com>
This commit is contained in:
co-authored by
Jan Solanti
parent
056c785f4e
commit
e4f13dd561
@@ -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
|
||||
}
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user