-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Renames event handlers on RuntimeWindow
- Loading branch information
1 parent
3e1c1c9
commit aff2fa7
Showing
3 changed files
with
49 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,22 @@ | ||
use std::error::Error; | ||
use winit::dpi::{PhysicalPosition, PhysicalSize}; | ||
use winit::event::{DeviceId, InnerSizeWriter}; | ||
|
||
/// Encapsulates winit window with window-specific logic. | ||
/// | ||
/// The event loop will exit immediately if any method return an error. | ||
pub trait RuntimeWindow { | ||
fn update_size(&self, v: PhysicalSize<u32>) -> Result<(), Box<dyn Error + Send + Sync>>; | ||
fn set_active(&self, v: bool) -> Result<(), Box<dyn Error + Send + Sync>>; | ||
fn update_cursor(&self, v: PhysicalPosition<f64>) -> Result<(), Box<dyn Error + Send + Sync>>; | ||
fn update_scale_factor(&self, v: f64) -> Result<(), Box<dyn Error + Send + Sync>>; | ||
fn redraw(&self) -> Result<(), Box<dyn Error + Send + Sync>>; | ||
fn on_resized(&self, new: PhysicalSize<u32>) -> Result<(), Box<dyn Error + Send + Sync>>; | ||
fn on_focused(&self, gained: bool) -> Result<(), Box<dyn Error + Send + Sync>>; | ||
fn on_cursor_moved( | ||
&self, | ||
dev: DeviceId, | ||
pos: PhysicalPosition<f64>, | ||
) -> Result<(), Box<dyn Error + Send + Sync>>; | ||
fn on_scale_factor_changed( | ||
&self, | ||
new: f64, | ||
sw: InnerSizeWriter, | ||
) -> Result<(), Box<dyn Error + Send + Sync>>; | ||
fn on_redraw_requested(&self) -> Result<(), Box<dyn Error + Send + Sync>>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters