Implemented focus_window (#1944)

This commit is contained in:
Max de Danschutter 2021-05-19 18:39:53 +02:00 committed by GitHub
parent 91591c4e94
commit b371b406d5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 107 additions and 0 deletions

View file

@ -731,6 +731,21 @@ impl Window {
self.window.set_ime_position(position.into())
}
/// 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
///
/// - **iOS / Android / Web / Wayland:** Unsupported.
#[inline]
pub fn focus_window(&self) {
self.window.focus_window()
}
/// Requests user attention to the window, this has no effect if the application
/// is already focused. How requesting for user attention manifests is platform dependent,
/// see `UserAttentionType` for details.