windows: better looking titlebar (#9053)
~~work in progress. not ready for review. made for visibility only, but feel free to comment :)~~ TODO: - [x] add close/min/max buttons (to be rendered with gpui) - [x] snap layout support - [x] fix issues with clicking items in titlebar - [x] cleanup/document Release Notes: - Added custom windows titlebar  --------- Co-authored-by: Mikayla <mikayla@zed.dev>
This commit is contained in:
parent
6bbc5e2efa
commit
948b3827c8
15 changed files with 694 additions and 122 deletions
|
@ -29,7 +29,7 @@ use crate::{
|
|||
#[derive(Default)]
|
||||
pub(crate) struct Callbacks {
|
||||
request_frame: Option<Box<dyn FnMut()>>,
|
||||
input: Option<Box<dyn FnMut(crate::PlatformInput) -> bool>>,
|
||||
input: Option<Box<dyn FnMut(crate::PlatformInput) -> crate::DispatchEventResult>>,
|
||||
active_status_change: Option<Box<dyn FnMut(bool)>>,
|
||||
resize: Option<Box<dyn FnMut(Size<Pixels>, f32)>>,
|
||||
fullscreen: Option<Box<dyn FnMut(bool)>>,
|
||||
|
@ -237,7 +237,7 @@ impl WaylandWindowState {
|
|||
|
||||
pub fn handle_input(&self, input: PlatformInput) {
|
||||
if let Some(ref mut fun) = self.callbacks.borrow_mut().input {
|
||||
if fun(input.clone()) {
|
||||
if !fun(input.clone()).propagate {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -279,6 +279,11 @@ impl PlatformWindow for WaylandWindow {
|
|||
unimplemented!()
|
||||
}
|
||||
|
||||
// todo(linux)
|
||||
fn is_maximized(&self) -> bool {
|
||||
unimplemented!()
|
||||
}
|
||||
|
||||
fn content_size(&self) -> Size<Pixels> {
|
||||
let inner = self.0.inner.borrow_mut();
|
||||
Size {
|
||||
|
@ -378,7 +383,7 @@ impl PlatformWindow for WaylandWindow {
|
|||
self.0.callbacks.borrow_mut().request_frame = Some(callback);
|
||||
}
|
||||
|
||||
fn on_input(&self, callback: Box<dyn FnMut(PlatformInput) -> bool>) {
|
||||
fn on_input(&self, callback: Box<dyn FnMut(PlatformInput) -> crate::DispatchEventResult>) {
|
||||
self.0.callbacks.borrow_mut().input = Some(callback);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue