Files
oak-gpui/crates/title_bar/src/platforms/platform_linux.rs
T
apricotbucket28 5c7e6b7eff wayland: Fix window state issues (#13885)
Fixes some issues with the CSD added in
https://github.com/zed-industries/zed/pull/13611

Here's a video comparing the master branch (yellow icon) with this PR
(blue icon):


https://github.com/zed-industries/zed/assets/71973804/35be443a-8f24-4aed-910b-625bad9821e2

_Note: the flicker at the bottom of the window when maximizing is an
issue with the KDE floating task bar, it happens with all programs._

Release Notes:

- N/A
2024-07-05 13:42:11 -07:00

49 lines
1.3 KiB
Rust

use gpui::{prelude::*, Action, MouseButton};
use ui::prelude::*;
use crate::window_controls::{WindowControl, WindowControlType};
#[derive(IntoElement)]
pub struct LinuxWindowControls {
close_window_action: Box<dyn Action>,
}
impl LinuxWindowControls {
pub fn new(close_window_action: Box<dyn Action>) -> Self {
Self {
close_window_action,
}
}
}
impl RenderOnce for LinuxWindowControls {
fn render(self, cx: &mut WindowContext) -> impl IntoElement {
h_flex()
.id("generic-window-controls")
.px_3()
.gap_3()
.on_mouse_down(MouseButton::Left, |_, cx| cx.stop_propagation())
.child(WindowControl::new(
"minimize",
WindowControlType::Minimize,
cx,
))
.child(WindowControl::new(
"maximize-or-restore",
if cx.is_maximized() {
WindowControlType::Restore
} else {
WindowControlType::Maximize
},
cx,
))
.child(WindowControl::new_close(
"close",
WindowControlType::Close,
self.close_window_action,
cx,
))
}
}