mirror of
https://github.com/zed-industries/zed.git
synced 2025-01-13 05:42:59 +00:00
47aa761ca9
This PR adds support for full client side decorations on X11 and Wayland TODO: - [x] Adjust GPUI APIs to expose CSD related information - [x] Implement remaining CSD features (Resizing, window border, window shadow) - [x] Integrate with existing background appearance and window transparency - [x] Figure out how to check if the window is tiled on X11 - [x] Implement in Zed - [x] Repeatedly maximizing and unmaximizing can panic - [x] Resizing is strangely slow - [x] X11 resizing and movement doesn't work for this: https://discord.com/channels/869392257814519848/1204679850208657418/1256816908519604305 - [x] The top corner can clip with current styling - [x] Pressing titlebar buttons doesn't work - [x] Not showing maximize / unmaximize buttons - [x] Noisy transparency logs / surface transparency problem https://github.com/zed-industries/zed/pull/13611#issuecomment-2201685030 - [x] Strange offsets when dragging the project panel https://github.com/zed-industries/zed/pull/13611#pullrequestreview-2154606261 - [x] Shadow inset with `_GTK_FRAME_EXTENTS` doesn't respect tiling on X11 (observe by snapping an X11 window in any direction) Release Notes: - N/A --------- Co-authored-by: conrad <conrad@zed.dev> Co-authored-by: Owen Law <81528246+someone13574@users.noreply.github.com> Co-authored-by: apricotbucket28 <71973804+apricotbucket28@users.noreply.github.com> Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
67 lines
2 KiB
Rust
67 lines
2 KiB
Rust
use gpui::*;
|
|
|
|
struct WindowContent {
|
|
text: SharedString,
|
|
}
|
|
|
|
impl Render for WindowContent {
|
|
fn render(&mut self, _cx: &mut ViewContext<Self>) -> impl IntoElement {
|
|
div()
|
|
.flex()
|
|
.bg(rgb(0x1e2025))
|
|
.size_full()
|
|
.justify_center()
|
|
.items_center()
|
|
.text_xl()
|
|
.text_color(rgb(0xffffff))
|
|
.child(self.text.clone())
|
|
}
|
|
}
|
|
|
|
fn main() {
|
|
App::new().run(|cx: &mut AppContext| {
|
|
// Create several new windows, positioned in the top right corner of each screen
|
|
|
|
for screen in cx.displays() {
|
|
let options = {
|
|
let margin_right = px(16.);
|
|
let margin_height = px(-48.);
|
|
|
|
let size = Size {
|
|
width: px(400.),
|
|
height: px(72.),
|
|
};
|
|
|
|
let bounds = gpui::Bounds::<Pixels> {
|
|
origin: screen.bounds().upper_right()
|
|
- point(size.width + margin_right, margin_height),
|
|
size,
|
|
};
|
|
|
|
WindowOptions {
|
|
// Set the bounds of the window in screen coordinates
|
|
window_bounds: Some(WindowBounds::Windowed(bounds)),
|
|
// Specify the display_id to ensure the window is created on the correct screen
|
|
display_id: Some(screen.id()),
|
|
|
|
titlebar: None,
|
|
window_background: WindowBackgroundAppearance::default(),
|
|
focus: false,
|
|
show: true,
|
|
kind: WindowKind::PopUp,
|
|
is_movable: false,
|
|
app_id: None,
|
|
window_min_size: None,
|
|
window_decorations: None,
|
|
}
|
|
};
|
|
|
|
cx.open_window(options, |cx| {
|
|
cx.new_view(|_| WindowContent {
|
|
text: format!("{:?}", screen.id()).into(),
|
|
})
|
|
})
|
|
.unwrap();
|
|
}
|
|
});
|
|
}
|