From 00b60d819b25abe14790a26fe0eb5818c3c6bc4f Mon Sep 17 00:00:00 2001 From: JL710 <76447362+JL710@users.noreply.github.com> Date: Fri, 11 Oct 2024 12:24:05 +0200 Subject: window task for setting resize increments --- runtime/src/window.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'runtime') diff --git a/runtime/src/window.rs b/runtime/src/window.rs index cdef70e3..e82d4505 100644 --- a/runtime/src/window.rs +++ b/runtime/src/window.rs @@ -167,6 +167,9 @@ pub enum Action { /// Set the window to be resizable or not. SetResizable(Id, bool), + + /// Set the window size increment. + SetResizeIncrements(Id, Option), } /// Subscribes to the frames of the window of the running application. @@ -400,6 +403,15 @@ pub fn set_min_size(id: Id, size: Option) -> Task { task::effect(crate::Action::Window(Action::SetMinSize(id, size))) } +/// Set the window size increment. +/// +/// This is usually used by apps such as terminal emulators that need "blocky" resizing. +pub fn set_resize_increments(id: Id, increments: Option) -> Task { + task::effect(crate::Action::Window(Action::SetResizeIncrements( + id, increments, + ))) +} + /// Show the [system menu] at cursor position. /// /// [system menu]: https://en.wikipedia.org/wiki/Common_menus_in_Microsoft_Windows#System_menu -- cgit