summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2022-07-18 18:37:41 +0200
committerLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2022-08-18 14:09:20 +0200
commit277b848ad8df1e8d038e33707548a45d63a601db (patch)
tree1da6c7a5135fb5f5c40a237224daae3721b2f685 /src
parent07cbed106467097543ff33d3b34e0e1ca6f695ae (diff)
downloadiced-277b848ad8df1e8d038e33707548a45d63a601db.tar.gz
iced-277b848ad8df1e8d038e33707548a45d63a601db.tar.bz2
iced-277b848ad8df1e8d038e33707548a45d63a601db.zip
Remove `window::Mode` and introduce `Settings::visible`
Additionally, only show the window once one frame has been rendered to avoid blank flashes on Windows.
Diffstat (limited to '')
-rw-r--r--src/application.rs21
-rw-r--r--src/window.rs2
-rw-r--r--src/window/mode.rs12
-rw-r--r--src/window/settings.rs5
4 files changed, 5 insertions, 35 deletions
diff --git a/src/application.rs b/src/application.rs
index 58d4a577..23ce034e 100644
--- a/src/application.rs
+++ b/src/application.rs
@@ -1,5 +1,4 @@
//! Build interactive cross-platform applications.
-use crate::window;
use crate::{Command, Element, Executor, Settings, Subscription};
pub use iced_native::application::{Appearance, StyleSheet};
@@ -169,18 +168,6 @@ pub trait Application: Sized {
Subscription::none()
}
- /// Returns the current [`Application`] mode.
- ///
- /// The runtime will automatically transition your application if a new mode
- /// is returned.
- ///
- /// Currently, the mode only has an effect in native platforms.
- ///
- /// By default, an application will run in windowed mode.
- fn mode(&self) -> window::Mode {
- window::Mode::Windowed
- }
-
/// Returns the scale factor of the [`Application`].
///
/// It can be used to dynamically control the size of the UI at runtime
@@ -277,14 +264,6 @@ where
self.0.style()
}
- fn mode(&self) -> iced_winit::Mode {
- match self.0.mode() {
- window::Mode::Windowed => iced_winit::Mode::Windowed,
- window::Mode::Fullscreen => iced_winit::Mode::Fullscreen,
- window::Mode::Hidden => iced_winit::Mode::Hidden,
- }
- }
-
fn subscription(&self) -> Subscription<Self::Message> {
self.0.subscription()
}
diff --git a/src/window.rs b/src/window.rs
index 71158816..eb5e17a6 100644
--- a/src/window.rs
+++ b/src/window.rs
@@ -1,12 +1,10 @@
//! Configure the window of your application in native platforms.
-mod mode;
mod position;
mod settings;
pub mod icon;
pub use icon::Icon;
-pub use mode::Mode;
pub use position::Position;
pub use settings::Settings;
diff --git a/src/window/mode.rs b/src/window/mode.rs
deleted file mode 100644
index fdce8e23..00000000
--- a/src/window/mode.rs
+++ /dev/null
@@ -1,12 +0,0 @@
-/// The mode of a window-based application.
-#[derive(Debug, Clone, Copy, PartialEq, Eq)]
-pub enum Mode {
- /// The application appears in its own window.
- Windowed,
-
- /// The application takes the whole screen of its current monitor.
- Fullscreen,
-
- /// The application is hidden
- Hidden,
-}
diff --git a/src/window/settings.rs b/src/window/settings.rs
index 8e32f4fb..24d0f4f9 100644
--- a/src/window/settings.rs
+++ b/src/window/settings.rs
@@ -15,6 +15,9 @@ pub struct Settings {
/// The maximum size of the window.
pub max_size: Option<(u32, u32)>,
+ /// Whether the window should be visible or not.
+ pub visible: bool,
+
/// Whether the window should be resizable or not.
pub resizable: bool,
@@ -38,6 +41,7 @@ impl Default for Settings {
position: Position::default(),
min_size: None,
max_size: None,
+ visible: true,
resizable: true,
decorations: true,
transparent: false,
@@ -54,6 +58,7 @@ impl From<Settings> for iced_winit::settings::Window {
position: iced_winit::Position::from(settings.position),
min_size: settings.min_size,
max_size: settings.max_size,
+ visible: settings.visible,
resizable: settings.resizable,
decorations: settings.decorations,
transparent: settings.transparent,