mirror of
https://github.com/tauri-apps/tauri.git
synced 2024-12-01 11:13:40 +03:00
This commit is contained in:
parent
8357ce5b2e
commit
4036e15f5a
7
.changes/focused.md
Normal file
7
.changes/focused.md
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
---
|
||||||
|
"tauri": minor
|
||||||
|
"tauri-runtime": minor
|
||||||
|
"tauri-runtime-wry": minor
|
||||||
|
---
|
||||||
|
|
||||||
|
Readd the option to create an unfocused window via the `focused` method. The `focus` function has been deprecated.
|
@ -690,7 +690,7 @@ unsafe impl Send for WindowBuilderWrapper {}
|
|||||||
impl WindowBuilderBase for WindowBuilderWrapper {}
|
impl WindowBuilderBase for WindowBuilderWrapper {}
|
||||||
impl WindowBuilder for WindowBuilderWrapper {
|
impl WindowBuilder for WindowBuilderWrapper {
|
||||||
fn new() -> Self {
|
fn new() -> Self {
|
||||||
Default::default()
|
Self::default().focused(true)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn with_config(config: WindowConfig) -> Self {
|
fn with_config(config: WindowConfig) -> Self {
|
||||||
@ -803,9 +803,8 @@ impl WindowBuilder for WindowBuilderWrapper {
|
|||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Deprecated since 0.1.4 (noop)
|
fn focused(mut self, focused: bool) -> Self {
|
||||||
/// Windows is automatically focused when created.
|
self.inner = self.inner.with_focused(focused);
|
||||||
fn focus(self) -> Self {
|
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -133,9 +133,9 @@ pub trait WindowBuilder: WindowBuilderBase {
|
|||||||
#[must_use]
|
#[must_use]
|
||||||
fn fullscreen(self, fullscreen: bool) -> Self;
|
fn fullscreen(self, fullscreen: bool) -> Self;
|
||||||
|
|
||||||
/// Whether the window will be initially hidden or focused.
|
/// Whether the window will be initially focused or not.
|
||||||
#[must_use]
|
#[must_use]
|
||||||
fn focus(self) -> Self;
|
fn focused(self, focused: bool) -> Self;
|
||||||
|
|
||||||
/// Whether the window should be maximized upon creation.
|
/// Whether the window should be maximized upon creation.
|
||||||
#[must_use]
|
#[must_use]
|
||||||
|
@ -838,7 +838,7 @@ pub struct WindowConfig {
|
|||||||
/// Whether the window starts as fullscreen or not.
|
/// Whether the window starts as fullscreen or not.
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub fullscreen: bool,
|
pub fullscreen: bool,
|
||||||
/// Whether the window will be initially hidden or focused.
|
/// Whether the window will be initially focused or not.
|
||||||
#[serde(default = "default_focus")]
|
#[serde(default = "default_focus")]
|
||||||
pub focus: bool,
|
pub focus: bool,
|
||||||
/// Whether the window is transparent or not.
|
/// Whether the window is transparent or not.
|
||||||
|
@ -221,7 +221,7 @@ impl WindowBuilder for MockWindowBuilder {
|
|||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
fn focus(self) -> Self {
|
fn focused(self, focused: bool) -> Self {
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -328,10 +328,21 @@ impl<'a, R: Runtime> WindowBuilder<'a, R> {
|
|||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Whether the window will be initially hidden or focused.
|
/// Sets the window to be initially focused.
|
||||||
#[must_use]
|
#[must_use]
|
||||||
|
#[deprecated(
|
||||||
|
since = "1.2.0",
|
||||||
|
note = "The window is automatically focused by default. This function Will be removed in 2.0.0. Use `focused` instead."
|
||||||
|
)]
|
||||||
pub fn focus(mut self) -> Self {
|
pub fn focus(mut self) -> Self {
|
||||||
self.window_builder = self.window_builder.focus();
|
self.window_builder = self.window_builder.focused(true);
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Whether the window will be initially focused or not.
|
||||||
|
#[must_use]
|
||||||
|
pub fn focused(mut self, focused: bool) -> Self {
|
||||||
|
self.window_builder = self.window_builder.focused(focused);
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2004,7 +2004,7 @@ interface WindowOptions {
|
|||||||
title?: string
|
title?: string
|
||||||
/** Whether the window is in fullscreen mode or not. */
|
/** Whether the window is in fullscreen mode or not. */
|
||||||
fullscreen?: boolean
|
fullscreen?: boolean
|
||||||
/** Whether the window will be initially hidden or focused. */
|
/** Whether the window will be initially focused or not. */
|
||||||
focus?: boolean
|
focus?: boolean
|
||||||
/**
|
/**
|
||||||
* Whether the window is transparent or not.
|
* Whether the window is transparent or not.
|
||||||
|
@ -612,7 +612,7 @@
|
|||||||
"type": "boolean"
|
"type": "boolean"
|
||||||
},
|
},
|
||||||
"focus": {
|
"focus": {
|
||||||
"description": "Whether the window will be initially hidden or focused.",
|
"description": "Whether the window will be initially focused or not.",
|
||||||
"default": true,
|
"default": true,
|
||||||
"type": "boolean"
|
"type": "boolean"
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user