Refresh windows when OS appearance changes
This commit is contained in:
parent
0f9ff57568
commit
f67e2bea29
14 changed files with 304 additions and 67 deletions
|
@ -132,6 +132,8 @@ pub trait Window {
|
|||
fn scale_factor(&self) -> f32;
|
||||
fn titlebar_height(&self) -> f32;
|
||||
fn present_scene(&mut self, scene: Scene);
|
||||
fn appearance(&self) -> Appearance;
|
||||
fn on_appearance_changed(&mut self, callback: Box<dyn FnMut()>);
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
|
@ -147,6 +149,20 @@ pub struct TitlebarOptions<'a> {
|
|||
pub traffic_light_position: Option<Vector2F>,
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug)]
|
||||
pub enum Appearance {
|
||||
Light,
|
||||
VibrantLight,
|
||||
Dark,
|
||||
VibrantDark,
|
||||
}
|
||||
|
||||
impl Default for Appearance {
|
||||
fn default() -> Self {
|
||||
Self::Light
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum WindowBounds {
|
||||
Maximized,
|
||||
|
@ -173,6 +189,12 @@ pub enum CursorStyle {
|
|||
IBeam,
|
||||
}
|
||||
|
||||
impl Default for CursorStyle {
|
||||
fn default() -> Self {
|
||||
Self::Arrow
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord)]
|
||||
pub struct AppVersion {
|
||||
major: usize,
|
||||
|
@ -180,12 +202,6 @@ pub struct AppVersion {
|
|||
patch: usize,
|
||||
}
|
||||
|
||||
impl Default for CursorStyle {
|
||||
fn default() -> Self {
|
||||
Self::Arrow
|
||||
}
|
||||
}
|
||||
|
||||
impl FromStr for AppVersion {
|
||||
type Err = anyhow::Error;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue