Cross-platform titlebar (#9405)
This PR reverts https://github.com/zed-industries/zed/pull/9392 and fixes the regressions that led to the reversion. Release Notes: - N/A --------- Co-authored-by: Ezekiel Warren <ezekiel@seaube.com>
This commit is contained in:
parent
44ac6ca45c
commit
328aa2cc95
17 changed files with 719 additions and 156 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 {
|
||||
false
|
||||
}
|
||||
|
||||
fn content_size(&self) -> Size<Pixels> {
|
||||
let inner = self.0.inner.borrow_mut();
|
||||
Size {
|
||||
|
@ -291,11 +296,6 @@ impl PlatformWindow for WaylandWindow {
|
|||
self.0.inner.borrow_mut().scale
|
||||
}
|
||||
|
||||
// todo(linux)
|
||||
fn titlebar_height(&self) -> Pixels {
|
||||
unimplemented!()
|
||||
}
|
||||
|
||||
// todo(linux)
|
||||
fn appearance(&self) -> WindowAppearance {
|
||||
WindowAppearance::Light
|
||||
|
@ -378,7 +378,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