From ca8aaf9b8daa3d8b925165fb912af425438d4e79 Mon Sep 17 00:00:00 2001 From: JL710 <76447362+JL710@users.noreply.github.com> Date: Fri, 11 Oct 2024 11:51:44 +0200 Subject: add Task and Action for changing a window title --- winit/src/program.rs | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'winit/src') diff --git a/winit/src/program.rs b/winit/src/program.rs index cc19a4e0..052b36b0 100644 --- a/winit/src/program.rs +++ b/winit/src/program.rs @@ -1291,6 +1291,11 @@ fn run_action
( ); } } + window::Action::ChangeTitle(id, title) => { + if let Some(window) = window_manager.get_mut(id) { + window.raw.set_title(&title); + } + } window::Action::GetSize(id, channel) => { if let Some(window) = window_manager.get_mut(id) { let size = window -- cgit From 8ebbfa9767bcb8f8efd43cc1c7d40e9c61f6c461 Mon Sep 17 00:00:00 2001 From: JL710 <76447362+JL710@users.noreply.github.com> Date: Fri, 11 Oct 2024 12:10:30 +0200 Subject: window tasks for setting min and max size --- winit/src/program.rs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'winit/src') diff --git a/winit/src/program.rs b/winit/src/program.rs index 052b36b0..58fec9df 100644 --- a/winit/src/program.rs +++ b/winit/src/program.rs @@ -1291,6 +1291,26 @@ fn run_action
( ); } } + window::Action::SetMinSize(id, size) => { + if let Some(window) = window_manager.get_mut(id) { + window.raw.set_min_inner_size(size.map(|x| { + winit::dpi::LogicalSize { + width: x.width, + height: x.height, + } + })); + } + } + window::Action::SetMaxSize(id, size) => { + if let Some(window) = window_manager.get_mut(id) { + window.raw.set_max_inner_size(size.map(|x| { + winit::dpi::LogicalSize { + width: x.width, + height: x.height, + } + })); + } + } window::Action::ChangeTitle(id, title) => { if let Some(window) = window_manager.get_mut(id) { window.raw.set_title(&title); -- cgit From f5f075e5cdff84a58c181c498653b7ab66c9531a Mon Sep 17 00:00:00 2001 From: JL710 <76447362+JL710@users.noreply.github.com> Date: Fri, 11 Oct 2024 12:16:52 +0200 Subject: window resizable task --- winit/src/program.rs | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'winit/src') diff --git a/winit/src/program.rs b/winit/src/program.rs index 58fec9df..416c8e70 100644 --- a/winit/src/program.rs +++ b/winit/src/program.rs @@ -1316,6 +1316,11 @@ fn run_action
( window.raw.set_title(&title); } } + window::Action::SetResizable(id, resizable) => { + if let Some(window) = window_manager.get_mut(id) { + window.raw.set_resizable(resizable); + } + } window::Action::GetSize(id, channel) => { if let Some(window) = window_manager.get_mut(id) { let size = window -- cgit 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 --- winit/src/program.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'winit/src') diff --git a/winit/src/program.rs b/winit/src/program.rs index 416c8e70..58f4d96d 100644 --- a/winit/src/program.rs +++ b/winit/src/program.rs @@ -1311,6 +1311,16 @@ fn run_action
(
                     }));
                 }
             }
+            window::Action::SetResizeIncrements(id, increments) => {
+                if let Some(window) = window_manager.get_mut(id) {
+                    window.raw.set_resize_increments(increments.map(|x| {
+                        winit::dpi::LogicalSize {
+                            width: x.width,
+                            height: x.height,
+                        }
+                    }));
+                }
+            }
             window::Action::ChangeTitle(id, title) => {
                 if let Some(window) = window_manager.get_mut(id) {
                     window.raw.set_title(&title);
-- 
cgit 
From 91fd6d395fad08bcf5d068be95575865ccb305cb Mon Sep 17 00:00:00 2001
From: Héctor Ramón Jiménez  (
                     }));
                 }
             }
-            window::Action::ChangeTitle(id, title) => {
-                if let Some(window) = window_manager.get_mut(id) {
-                    window.raw.set_title(&title);
-                }
-            }
             window::Action::SetResizable(id, resizable) => {
                 if let Some(window) = window_manager.get_mut(id) {
                     window.raw.set_resizable(resizable);
-- 
cgit 
From ed199e5e8f5bc210ffc923553983e5d3aa6ee5b6 Mon Sep 17 00:00:00 2001
From: Héctor Ramón Jiménez  (
             }
             window::Action::SetMinSize(id, size) => {
                 if let Some(window) = window_manager.get_mut(id) {
-                    window.raw.set_min_inner_size(size.map(|x| {
+                    window.raw.set_min_inner_size(size.map(|size| {
                         winit::dpi::LogicalSize {
-                            width: x.width,
-                            height: x.height,
+                            width: size.width,
+                            height: size.height,
                         }
                     }));
                 }
             }
             window::Action::SetMaxSize(id, size) => {
                 if let Some(window) = window_manager.get_mut(id) {
-                    window.raw.set_max_inner_size(size.map(|x| {
+                    window.raw.set_max_inner_size(size.map(|size| {
                         winit::dpi::LogicalSize {
-                            width: x.width,
-                            height: x.height,
+                            width: size.width,
+                            height: size.height,
                         }
                     }));
                 }
             }
             window::Action::SetResizeIncrements(id, increments) => {
                 if let Some(window) = window_manager.get_mut(id) {
-                    window.raw.set_resize_increments(increments.map(|x| {
+                    window.raw.set_resize_increments(increments.map(|size| {
                         winit::dpi::LogicalSize {
-                            width: x.width,
-                            height: x.height,
+                            width: size.width,
+                            height: size.height,
                         }
                     }));
                 }
-- 
cgit 
From 5b70754809df9d9f4f3a2f7d4d348dd58bd86aa3 Mon Sep 17 00:00:00 2001
From: Héctor Ramón Jiménez  (
                     );
                 }
             }
-            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 (
                     ));
                 }
             }
-            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 (
                     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
-- 
cgit