From 7cb6e7438f7fb5d0d8be4528a31b888e2b12cd51 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Thu, 2 Sep 2021 16:30:14 +0700 Subject: Implement `move_to` and `resize` commands for `window` --- winit/src/window.rs | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) (limited to 'winit/src/window.rs') diff --git a/winit/src/window.rs b/winit/src/window.rs index 8ccb13ed..f3207e68 100644 --- a/winit/src/window.rs +++ b/winit/src/window.rs @@ -1,7 +1,18 @@ -pub use iced_native::window::*; +//! Interact with the window of your application. +use crate::command::{self, Command}; +use iced_native::window; -/// The window of an [`Application`]. -/// -/// [`Application`]: crate::Application -#[derive(Debug)] -pub struct Window {} +pub use window::Event; + +/// Resizes the window to the given logical dimensions. +pub fn resize(width: u32, height: u32) -> Command { + Command::single(command::Action::Window(window::Action::Resize { + width, + height, + })) +} + +/// Moves a window to the given logical coordinates. +pub fn move_to(x: i32, y: i32) -> Command { + Command::single(command::Action::Window(window::Action::Move { x, y })) +} -- cgit