diff options
-rw-r--r-- | examples/todos/src/main.rs | 4 | ||||
-rw-r--r-- | runtime/src/window.rs | 24 | ||||
-rw-r--r-- | winit/src/program.rs | 6 |
3 files changed, 16 insertions, 18 deletions
diff --git a/examples/todos/src/main.rs b/examples/todos/src/main.rs index a5bca235..e86e23b5 100644 --- a/examples/todos/src/main.rs +++ b/examples/todos/src/main.rs @@ -149,9 +149,7 @@ impl Todos { } } Message::ToggleFullscreen(mode) => window::get_latest() - .and_then(move |window| { - window::change_mode(window, mode) - }), + .and_then(move |window| window::set_mode(window, mode)), Message::Loaded(_) => Command::none(), }; diff --git a/runtime/src/window.rs b/runtime/src/window.rs index ab805e52..94ee0ae5 100644 --- a/runtime/src/window.rs +++ b/runtime/src/window.rs @@ -68,7 +68,7 @@ pub enum Action { Move(Id, Point), /// Change the [`Mode`] of the window. - ChangeMode(Id, Mode), + SetMode(Id, Mode), /// Get the current [`Mode`] of the window. GetMode(Id, oneshot::Sender<Mode>), @@ -111,7 +111,7 @@ pub enum Action { GainFocus(Id), /// Change the window [`Level`]. - ChangeLevel(Id, Level), + SetLevel(Id, Level), /// Show the system menu at cursor position. /// @@ -136,7 +136,7 @@ pub enum Action { /// /// - **X11:** Has no universal guidelines for icon sizes, so you're at the whims of the WM. That /// said, it's usually in the same ballpark as on Windows. - ChangeIcon(Id, Icon), + SetIcon(Id, Icon), /// Runs the closure with the native window handle of the window with the given [`Id`]. RunWithHandle(Id, Box<dyn FnOnce(WindowHandle<'_>) + Send>), @@ -351,11 +351,6 @@ pub fn move_to<T>(id: Id, position: Point) -> Task<T> { task::effect(crate::Action::Window(Action::Move(id, position))) } -/// Changes the [`Mode`] of the window. -pub fn change_mode<T>(id: Id, mode: Mode) -> Task<T> { - task::effect(crate::Action::Window(Action::ChangeMode(id, mode))) -} - /// Gets the current [`Mode`] of the window. pub fn get_mode(id: Id) -> Task<Mode> { task::oneshot(move |channel| { @@ -363,6 +358,11 @@ pub fn get_mode(id: Id) -> Task<Mode> { }) } +/// Changes the [`Mode`] of the window. +pub fn set_mode<T>(id: Id, mode: Mode) -> Task<T> { + task::effect(crate::Action::Window(Action::SetMode(id, mode))) +} + /// Toggles the window to maximized or back. pub fn toggle_maximize<T>(id: Id) -> Task<T> { task::effect(crate::Action::Window(Action::ToggleMaximize(id))) @@ -400,8 +400,8 @@ pub fn gain_focus<T>(id: Id) -> Task<T> { } /// Changes the window [`Level`]. -pub fn change_level<T>(id: Id, level: Level) -> Task<T> { - task::effect(crate::Action::Window(Action::ChangeLevel(id, level))) +pub fn set_level<T>(id: Id, level: Level) -> Task<T> { + task::effect(crate::Action::Window(Action::SetLevel(id, level))) } /// Show the [system menu] at cursor position. @@ -420,8 +420,8 @@ pub fn get_raw_id<Message>(id: Id) -> Task<u64> { } /// Changes the [`Icon`] of the window. -pub fn change_icon<T>(id: Id, icon: Icon) -> Task<T> { - task::effect(crate::Action::Window(Action::ChangeIcon(id, icon))) +pub fn set_icon<T>(id: Id, icon: Icon) -> Task<T> { + task::effect(crate::Action::Window(Action::SetIcon(id, icon))) } /// Runs the given callback with the native window handle for the window with the given id. diff --git a/winit/src/program.rs b/winit/src/program.rs index 95e8a281..499c6252 100644 --- a/winit/src/program.rs +++ b/winit/src/program.rs @@ -1389,7 +1389,7 @@ fn run_action<P, C>( ); } } - window::Action::ChangeMode(id, mode) => { + window::Action::SetMode(id, mode) => { if let Some(window) = window_manager.get_mut(id) { window.raw.set_visible(conversion::visible(mode)); window.raw.set_fullscreen(conversion::fullscreen( @@ -1398,7 +1398,7 @@ fn run_action<P, C>( )); } } - window::Action::ChangeIcon(id, icon) => { + window::Action::SetIcon(id, icon) => { if let Some(window) = window_manager.get_mut(id) { window.raw.set_window_icon(conversion::icon(icon)); } @@ -1436,7 +1436,7 @@ fn run_action<P, C>( window.raw.focus_window(); } } - window::Action::ChangeLevel(id, level) => { + window::Action::SetLevel(id, level) => { if let Some(window) = window_manager.get_mut(id) { window .raw |