summaryrefslogtreecommitdiffstats
path: root/native
diff options
context:
space:
mode:
authorLibravatar Night_Hunter <samuelhuntnz@gmail.com>2022-12-10 01:49:29 +1300
committerLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2023-01-02 21:14:02 +0100
commit81cd0c45b7f18d6f695c16bb1f5ab05b29dc7037 (patch)
tree6f9dcd1c9abbaf02355f62d75503668fd320f24b /native
parentc740b3af75624c5faa6982fca56a1ebe03e03e98 (diff)
downloadiced-81cd0c45b7f18d6f695c16bb1f5ab05b29dc7037.tar.gz
iced-81cd0c45b7f18d6f695c16bb1f5ab05b29dc7037.tar.bz2
iced-81cd0c45b7f18d6f695c16bb1f5ab05b29dc7037.zip
Add `FocusWindow` to `window::Action`
Diffstat (limited to 'native')
-rw-r--r--native/src/window/action.rs13
1 files changed, 13 insertions, 0 deletions
diff --git a/native/src/window/action.rs b/native/src/window/action.rs
index f0fe845d..41d41ee7 100644
--- a/native/src/window/action.rs
+++ b/native/src/window/action.rs
@@ -58,6 +58,17 @@ pub enum Action<T> {
/// - **X11:** Requests for user attention must be manually cleared.
/// - **Wayland:** Requires `xdg_activation_v1` protocol, `None` has no effect.
RequestUserAttention(Option<UserAttention>),
+ /// Brings the window to the front and sets input focus. Has no effect if the window is
+ /// already in focus, minimized, or not visible.
+ ///
+ /// This method steals input focus from other applications. Do not use this method unless
+ /// you are certain that's what the user wants. Focus stealing can cause an extremely disruptive
+ /// user experience.
+ ///
+ /// ## Platform-specific
+ ///
+ /// - **Web / Wayland:** Unsupported.
+ FocusWindow,
}
impl<T> Action<T> {
@@ -83,6 +94,7 @@ impl<T> Action<T> {
Self::RequestUserAttention(attention_type) => {
Action::RequestUserAttention(attention_type)
}
+ Self::FocusWindow => Action::FocusWindow,
}
}
}
@@ -109,6 +121,7 @@ impl<T> fmt::Debug for Action<T> {
Self::RequestUserAttention(_) => {
write!(f, "Action::RequestUserAttention")
}
+ Self::FocusWindow => write!(f, "Action::FocusWindow"),
}
}
}