summaryrefslogtreecommitdiff
path: root/src/window_controller.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/window_controller.rs')
-rw-r--r--src/window_controller.rs21
1 files changed, 13 insertions, 8 deletions
diff --git a/src/window_controller.rs b/src/window_controller.rs
index 34f9fd4..78af0e1 100644
--- a/src/window_controller.rs
+++ b/src/window_controller.rs
@@ -1,17 +1,22 @@
use crate::*;
+use std::num::NonZeroU32;
+use std::path::Path;
+
+const NON_ZERO_ONE: NonZeroU32 = unsafe { NonZeroU32::new_unchecked(1) };
pub trait WindowController {
fn title(&self) -> String { String::from("Phosphor") }
- fn cursor_icon(&self) -> Option<CursorIcon> { None }
- fn initial_size(&self) -> Dimensions { Dimensions::new(800,600) }
+ fn initial_size(&self) -> Option<Dimensions> { None }
fn minimum_size(&self) -> Option<Dimensions> { None }
fn maximum_size(&self) -> Option<Dimensions> { None }
- fn pixel_scale(&self) -> u32 { 1 }
- fn render_request(&self) -> RenderRequest { RenderRequest::None }
+ fn exact_size(&self) -> Option<Dimensions> { None }
+ fn pixel_scale(&self) -> NonZeroU32 { NON_ZERO_ONE }
+
+ fn cursor_icon(&mut self) -> Option<CursorIcon> { None }
+ fn render_request(&mut self) -> RenderRequest { RenderRequest::None }
fn is_visible(&self) -> bool { true }
fn is_cursor_visible(&self) -> bool { true }
- fn is_resizable(&self) -> bool { true }
fn on_init(&mut self) {}
fn on_resize(&mut self, _size: Dimensions) {}
@@ -37,8 +42,8 @@ pub trait WindowController {
fn on_keyboard_input(&mut self, _input: KeyboardInput) {}
fn on_keyboard_modifier_change(&mut self, _modifiers: ModifiersState) {}
- fn on_character_input(&mut self, _character: char) {}
- fn on_file_hover(&mut self, _path: std::path::PathBuf) {}
+ fn on_character_input(&mut self, _input: char) {}
+ fn on_file_hover(&mut self, _path: &Path) {}
fn on_file_hover_cancel(&mut self) {}
- fn on_file_drop(&mut self, _path: std::path::PathBuf) {}
+ fn on_file_drop(&mut self, _path: &Path) {}
}