Route whether or not a window is fullscreen down into GPUI

This still needs to be able to invalidate things to be useful
but it's a good first cut at just making the information available
to platform-agnostic code

Co-authored-by: Mikayla <mikayla@zed.dev>
This commit is contained in:
ForLoveOfCats 2022-08-09 15:34:57 -04:00
parent ae8dd1e3fd
commit ab760493cf
4 changed files with 129 additions and 3 deletions

View file

@ -37,6 +37,7 @@ pub struct Window {
event_handlers: Vec<Box<dyn FnMut(super::Event) -> bool>>,
resize_handlers: Vec<Box<dyn FnMut()>>,
close_handlers: Vec<Box<dyn FnOnce()>>,
fullscreen_handlers: Vec<Box<dyn FnMut(bool)>>,
pub(crate) active_status_change_handlers: Vec<Box<dyn FnMut(bool)>>,
pub(crate) should_close_handler: Option<Box<dyn FnMut() -> bool>>,
pub(crate) title: Option<String>,
@ -199,6 +200,7 @@ impl Window {
close_handlers: Default::default(),
should_close_handler: Default::default(),
active_status_change_handlers: Default::default(),
fullscreen_handlers: Default::default(),
scale_factor: 1.0,
current_scene: None,
title: None,
@ -253,6 +255,10 @@ impl super::Window for Window {
self.active_status_change_handlers.push(callback);
}
fn on_fullscreen(&mut self, callback: Box<dyn FnMut(bool)>) {
self.fullscreen_handlers.push(callback)
}
fn on_resize(&mut self, callback: Box<dyn FnMut()>) {
self.resize_handlers.push(callback);
}