summaryrefslogtreecommitdiffstats
path: root/core/src/window
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2023-11-29 22:28:31 +0100
committerLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2023-11-29 22:28:31 +0100
commite09b4e24dda51b8212d8ece52431dacaa3922a7b (patch)
tree7005e181528134ebdde5bbbe5909273db9f30174 /core/src/window
parent83c7870c569a2976923ee6243a19813094d44673 (diff)
parent7f8b17604a31e00becc43130ec516c1a53552c88 (diff)
downloadiced-e09b4e24dda51b8212d8ece52431dacaa3922a7b.tar.gz
iced-e09b4e24dda51b8212d8ece52431dacaa3922a7b.tar.bz2
iced-e09b4e24dda51b8212d8ece52431dacaa3922a7b.zip
Merge branch 'master' into feat/multi-window-support
Diffstat (limited to 'core/src/window')
-rw-r--r--core/src/window/icon.rs4
-rw-r--r--core/src/window/redraw_request.rs2
-rw-r--r--core/src/window/settings.rs17
-rw-r--r--core/src/window/settings/linux.rs11
4 files changed, 25 insertions, 9 deletions
diff --git a/core/src/window/icon.rs b/core/src/window/icon.rs
index 31868ecf..5ef0eed7 100644
--- a/core/src/window/icon.rs
+++ b/core/src/window/icon.rs
@@ -3,7 +3,7 @@ use crate::Size;
use std::mem;
-/// Builds an [`Icon`] from its RGBA pixels in the sRGB color space.
+/// Builds an [`Icon`] from its RGBA pixels in the `sRGB` color space.
pub fn from_rgba(
rgba: Vec<u8>,
width: u32,
@@ -49,7 +49,7 @@ impl Icon {
}
#[derive(Debug, thiserror::Error)]
-/// An error produced when using [`Icon::from_rgba`] with invalid arguments.
+/// An error produced when using [`from_rgba`] with invalid arguments.
pub enum Error {
/// Produced when the length of the `rgba` argument isn't divisible by 4, thus `rgba` can't be
/// safely interpreted as 32bpp RGBA pixels.
diff --git a/core/src/window/redraw_request.rs b/core/src/window/redraw_request.rs
index 3b4f0fd3..8a59e83c 100644
--- a/core/src/window/redraw_request.rs
+++ b/core/src/window/redraw_request.rs
@@ -13,7 +13,7 @@ pub enum RedrawRequest {
#[cfg(test)]
mod tests {
use super::*;
- use std::time::{Duration, Instant};
+ use crate::time::{Duration, Instant};
#[test]
fn ordering() {
diff --git a/core/src/window/settings.rs b/core/src/window/settings.rs
index eba27914..25df8159 100644
--- a/core/src/window/settings.rs
+++ b/core/src/window/settings.rs
@@ -1,5 +1,4 @@
-use crate::window::{Icon, Level, Position};
-
+//! Configure your windows.
#[cfg(target_os = "windows")]
#[path = "settings/windows.rs"]
mod platform;
@@ -8,6 +7,10 @@ mod platform;
#[path = "settings/macos.rs"]
mod platform;
+#[cfg(target_os = "linux")]
+#[path = "settings/linux.rs"]
+mod platform;
+
#[cfg(target_arch = "wasm32")]
#[path = "settings/wasm.rs"]
mod platform;
@@ -15,13 +18,15 @@ mod platform;
#[cfg(not(any(
target_os = "windows",
target_os = "macos",
+ target_os = "linux",
target_arch = "wasm32"
)))]
#[path = "settings/other.rs"]
mod platform;
-pub use platform::PlatformSpecific;
+use crate::window::{Icon, Level, Position};
+pub use platform::PlatformSpecific;
/// The window settings of an application.
#[derive(Debug, Clone)]
pub struct Settings {
@@ -70,8 +75,8 @@ pub struct Settings {
}
impl Default for Settings {
- fn default() -> Settings {
- Settings {
+ fn default() -> Self {
+ Self {
size: (1024, 768),
position: Position::default(),
min_size: None,
@@ -82,8 +87,8 @@ impl Default for Settings {
transparent: false,
level: Level::default(),
icon: None,
- platform_specific: Default::default(),
exit_on_close_request: true,
+ platform_specific: PlatformSpecific::default(),
}
}
}
diff --git a/core/src/window/settings/linux.rs b/core/src/window/settings/linux.rs
new file mode 100644
index 00000000..009b9d9e
--- /dev/null
+++ b/core/src/window/settings/linux.rs
@@ -0,0 +1,11 @@
+//! Platform specific settings for Linux.
+
+/// The platform specific window settings of an application.
+#[derive(Debug, Clone, PartialEq, Eq, Default)]
+pub struct PlatformSpecific {
+ /// Sets the application id of the window.
+ ///
+ /// As a best practice, it is suggested to select an application id that match
+ /// the basename of the application’s .desktop file.
+ pub application_id: String,
+}