gpui: Implement dynamic window control elements (#30828)

Allows setting element as window control elements which consist of
`Drag`, `Close`, `Max`, or `Min`. This allows you to implement
dynamically sized elements that control the platform window, this is
used for areas such as the title bar. Currently only implemented for
Windows.

Release Notes:

- N/A
This commit is contained in:
Matin Aniss 2025-06-07 03:11:24 +10:00 committed by GitHub
parent d9efa2860f
commit ca3f46588a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 129 additions and 96 deletions

View file

@ -31,8 +31,8 @@ use crate::{
AnyWindowHandle, Bounds, Decorations, Globals, GpuSpecs, Modifiers, Output, Pixels,
PlatformDisplay, PlatformInput, Point, PromptButton, PromptLevel, RequestFrameOptions,
ResizeEdge, ScaledPixels, Size, Tiling, WaylandClientStatePtr, WindowAppearance,
WindowBackgroundAppearance, WindowBounds, WindowControls, WindowDecorations, WindowParams, px,
size,
WindowBackgroundAppearance, WindowBounds, WindowControlArea, WindowControls, WindowDecorations,
WindowParams, px, size,
};
#[derive(Default)]
@ -978,6 +978,10 @@ impl PlatformWindow for WaylandWindow {
self.0.callbacks.borrow_mut().close = Some(callback);
}
fn on_hit_test_window_control(&self, _callback: Box<dyn FnMut() -> Option<WindowControlArea>>) {
unimplemented!()
}
fn on_appearance_changed(&self, callback: Box<dyn FnMut()>) {
self.0.callbacks.borrow_mut().appearance_changed = Some(callback);
}