gpui: Add support for window transparency & blur on macOS (#9610)

This PR adds support for transparent and blurred window backgrounds on
macOS.

Release Notes:

- Added support for transparent and blurred window backgrounds on macOS
([#5040](https://github.com/zed-industries/zed/issues/5040)).
- This requires themes to specify a new `background.appearance` key
("opaque", "transparent" or "blurred") and to include an alpha value in
colors that should be transparent.

<img width="913" alt="image"
src="https://github.com/zed-industries/zed/assets/2588851/7547ee2a-e376-4d55-9114-e6fc2f5110bc">
<img width="994" alt="image"
src="https://github.com/zed-industries/zed/assets/2588851/b36fbc14-6e4d-4140-9448-69cad803c45a">
<img width="1020" alt="image"
src="https://github.com/zed-industries/zed/assets/2588851/d70e2005-54fd-4991-a211-ed484ccf26ef">

---------

Co-authored-by: Luiz Marcondes <luizgustavodevergennes@gmail.com>
Co-authored-by: Marshall Bowers <elliott.codes@gmail.com>
This commit is contained in:
jansol
2024-03-29 11:10:47 -04:00
committed by GitHub
co-authored by Luiz Marcondes Marshall Bowers
parent 1360dffead
commit 49144d94bf
20 changed files with 173 additions and 17 deletions
@@ -23,7 +23,7 @@ use crate::platform::{PlatformAtlas, PlatformInputHandler, PlatformWindow};
use crate::scene::Scene;
use crate::{
px, size, Bounds, DevicePixels, Modifiers, Pixels, PlatformDisplay, PlatformInput, Point,
PromptLevel, Size, WindowAppearance, WindowParams,
PromptLevel, Size, WindowAppearance, WindowBackgroundAppearance, WindowParams,
};
#[derive(Default)]
@@ -355,6 +355,10 @@ impl PlatformWindow for WaylandWindow {
self.0.toplevel.set_title(title.to_string());
}
fn set_background_appearance(&mut self, _background_appearance: WindowBackgroundAppearance) {
// todo(linux)
}
fn set_edited(&mut self, edited: bool) {
// todo(linux)
}
+5 -1
View File
@@ -4,7 +4,7 @@
use crate::{
platform::blade::BladeRenderer, size, Bounds, DevicePixels, Modifiers, Pixels, PlatformAtlas,
PlatformDisplay, PlatformInput, PlatformInputHandler, PlatformWindow, Point, PromptLevel,
Scene, Size, WindowAppearance, WindowOptions, WindowParams,
Scene, Size, WindowAppearance, WindowBackgroundAppearance, WindowOptions, WindowParams,
};
use blade_graphics as gpu;
use parking_lot::Mutex;
@@ -423,6 +423,10 @@ impl PlatformWindow for X11Window {
// todo(linux)
fn set_edited(&mut self, edited: bool) {}
fn set_background_appearance(&mut self, _background_appearance: WindowBackgroundAppearance) {
// todo(linux)
}
// todo(linux), this corresponds to `orderFrontCharacterPalette` on macOS,
// but it looks like the equivalent for Linux is GTK specific:
//