logiguard fork v2: patched GPUI on verified 8c74db0 tree
Rebuilt from the exact zed-industries/zed @ 8c74db00c4053d6c0a9037863d7bd048658da4ca tree (previous orphan was based on a stale/wrong fetch). Same 3-file patch: - serial.rs: add SerialKind::KeyboardEnter - client.rs: store wl_keyboard.enter serial; add latest_serial_of() - window.rs: activate() uses keyboard-enter serial (Mutter focus gate) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,60 @@
|
||||
use gpui::AnyElement;
|
||||
use ui::{Indicator, ListItem, prelude::*};
|
||||
|
||||
use crate::KernelSpecification;
|
||||
|
||||
#[derive(IntoElement)]
|
||||
pub struct KernelListItem {
|
||||
kernel_specification: KernelSpecification,
|
||||
status_color: Color,
|
||||
buttons: Vec<AnyElement>,
|
||||
children: Vec<AnyElement>,
|
||||
}
|
||||
|
||||
impl KernelListItem {
|
||||
pub fn new(kernel_specification: KernelSpecification) -> Self {
|
||||
Self {
|
||||
kernel_specification,
|
||||
status_color: Color::Disabled,
|
||||
buttons: Vec::new(),
|
||||
children: Vec::new(),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn status_color(mut self, color: Color) -> Self {
|
||||
self.status_color = color;
|
||||
self
|
||||
}
|
||||
|
||||
pub fn button(mut self, button: impl IntoElement) -> Self {
|
||||
self.buttons.push(button.into_any_element());
|
||||
self
|
||||
}
|
||||
|
||||
pub fn buttons(mut self, buttons: impl IntoIterator<Item = impl IntoElement>) -> Self {
|
||||
self.buttons
|
||||
.extend(buttons.into_iter().map(|button| button.into_any_element()));
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
impl ParentElement for KernelListItem {
|
||||
fn extend(&mut self, elements: impl IntoIterator<Item = AnyElement>) {
|
||||
self.children.extend(elements);
|
||||
}
|
||||
}
|
||||
|
||||
impl RenderOnce for KernelListItem {
|
||||
fn render(self, _window: &mut Window, _cx: &mut App) -> impl IntoElement {
|
||||
ListItem::new(self.kernel_specification.name())
|
||||
.selectable(false)
|
||||
.start_slot(
|
||||
h_flex()
|
||||
.size_3()
|
||||
.justify_center()
|
||||
.child(Indicator::dot().color(self.status_color)),
|
||||
)
|
||||
.children(self.children)
|
||||
.end_slot(h_flex().gap_2().children(self.buttons))
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user