From d1d13f6f160af73e549e2c2dd8a9d7991f10f1f6 Mon Sep 17 00:00:00 2001 From: Night_Hunter Date: Sat, 10 Dec 2022 01:42:51 +1300 Subject: add always on top action --- native/src/window/action.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'native/src') diff --git a/native/src/window/action.rs b/native/src/window/action.rs index 168974bc..b16b7243 100644 --- a/native/src/window/action.rs +++ b/native/src/window/action.rs @@ -70,6 +70,12 @@ pub enum Action { /// /// - **Web / Wayland:** Unsupported. GainFocus, + /// Change whether or not the window will always be on top of other windows. + /// + /// ## Platform-specific + /// + /// - **iOS / Android / Web / Wayland:** Unsupported. + AlwaysOnTop(bool), } impl Action { @@ -96,6 +102,7 @@ impl Action { Action::RequestUserAttention(attention_type) } Self::GainFocus => Action::GainFocus, + Self::AlwaysOnTop(bool) => Action::AlwaysOnTop(bool), } } } @@ -122,6 +129,9 @@ impl fmt::Debug for Action { write!(f, "Action::RequestUserAttention") } Self::GainFocus => write!(f, "Action::GainFocus"), + Self::AlwaysOnTop(value) => { + write!(f, "Action::AlwaysOnTop({})", value) + } } } } -- cgit From 095ecf016b53ad25337663fb9f11a84f373150e0 Mon Sep 17 00:00:00 2001 From: Night_Hunter Date: Thu, 29 Dec 2022 13:30:14 +1300 Subject: update docs and change to SetAlwaysOnTop --- native/src/window/action.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'native/src') diff --git a/native/src/window/action.rs b/native/src/window/action.rs index b16b7243..0c711090 100644 --- a/native/src/window/action.rs +++ b/native/src/window/action.rs @@ -74,8 +74,8 @@ pub enum Action { /// /// ## Platform-specific /// - /// - **iOS / Android / Web / Wayland:** Unsupported. - AlwaysOnTop(bool), + /// - **Web / Wayland:** Unsupported. + SetAlwaysOnTop(bool), } impl Action { @@ -102,7 +102,7 @@ impl Action { Action::RequestUserAttention(attention_type) } Self::GainFocus => Action::GainFocus, - Self::AlwaysOnTop(bool) => Action::AlwaysOnTop(bool), + Self::SetAlwaysOnTop(bool) => Action::SetAlwaysOnTop(bool), } } } @@ -129,7 +129,7 @@ impl fmt::Debug for Action { write!(f, "Action::RequestUserAttention") } Self::GainFocus => write!(f, "Action::GainFocus"), - Self::AlwaysOnTop(value) => { + Self::SetAlwaysOnTop(value) => { write!(f, "Action::AlwaysOnTop({})", value) } } -- cgit From df861d9ece5e8695d05d08f104d37f55222fb363 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Fri, 17 Feb 2023 13:22:45 +0100 Subject: Rename `SetAlwaysOnTop` to `ChangeAlwaysOnTop` --- native/src/window/action.rs | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) (limited to 'native/src') diff --git a/native/src/window/action.rs b/native/src/window/action.rs index 0c711090..c6361449 100644 --- a/native/src/window/action.rs +++ b/native/src/window/action.rs @@ -75,7 +75,7 @@ pub enum Action { /// ## Platform-specific /// /// - **Web / Wayland:** Unsupported. - SetAlwaysOnTop(bool), + ChangeAlwaysOnTop(bool), } impl Action { @@ -91,8 +91,8 @@ impl Action { Self::Close => Action::Close, Self::Drag => Action::Drag, Self::Resize { width, height } => Action::Resize { width, height }, - Self::Maximize(bool) => Action::Maximize(bool), - Self::Minimize(bool) => Action::Minimize(bool), + Self::Maximize(maximized) => Action::Maximize(maximized), + Self::Minimize(minimized) => Action::Minimize(minimized), Self::Move { x, y } => Action::Move { x, y }, Self::ChangeMode(mode) => Action::ChangeMode(mode), Self::FetchMode(o) => Action::FetchMode(Box::new(move |s| f(o(s)))), @@ -102,7 +102,9 @@ impl Action { Action::RequestUserAttention(attention_type) } Self::GainFocus => Action::GainFocus, - Self::SetAlwaysOnTop(bool) => Action::SetAlwaysOnTop(bool), + Self::ChangeAlwaysOnTop(on_top) => { + Action::ChangeAlwaysOnTop(on_top) + } } } } @@ -116,8 +118,12 @@ impl fmt::Debug for Action { f, "Action::Resize {{ widget: {width}, height: {height} }}" ), - Self::Maximize(value) => write!(f, "Action::Maximize({value})"), - Self::Minimize(value) => write!(f, "Action::Minimize({value}"), + Self::Maximize(maximized) => { + write!(f, "Action::Maximize({maximized})") + } + Self::Minimize(minimized) => { + write!(f, "Action::Minimize({minimized}") + } Self::Move { x, y } => { write!(f, "Action::Move {{ x: {x}, y: {y} }}") } @@ -129,8 +135,8 @@ impl fmt::Debug for Action { write!(f, "Action::RequestUserAttention") } Self::GainFocus => write!(f, "Action::GainFocus"), - Self::SetAlwaysOnTop(value) => { - write!(f, "Action::AlwaysOnTop({})", value) + Self::ChangeAlwaysOnTop(on_top) => { + write!(f, "Action::AlwaysOnTop({on_top})") } } } -- cgit