Implemented window title update functionality for multiwindow.
This commit is contained in:
parent
1944e98f82
commit
ec41918ec4
14 changed files with 270 additions and 243 deletions
|
|
@ -4,6 +4,8 @@ mod event;
|
|||
mod icon;
|
||||
mod id;
|
||||
mod mode;
|
||||
mod position;
|
||||
mod settings;
|
||||
mod user_attention;
|
||||
|
||||
pub use action::Action;
|
||||
|
|
@ -11,6 +13,6 @@ pub use event::Event;
|
|||
pub use icon::Icon;
|
||||
pub use id::Id;
|
||||
pub use mode::Mode;
|
||||
pub use user_attention::UserAttention;
|
||||
pub use position::Position;
|
||||
pub use settings::Settings;
|
||||
pub use user_attention::UserAttention;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
use crate::window::{self, Mode, UserAttention};
|
||||
use crate::window;
|
||||
|
||||
use iced_futures::MaybeSend;
|
||||
use std::fmt;
|
||||
|
|
@ -13,9 +13,9 @@ pub enum Action<T> {
|
|||
/// There’s no guarantee that this will work unless the left mouse
|
||||
/// button was pressed immediately before this function is called.
|
||||
Drag,
|
||||
/// TODO(derezzedex)
|
||||
/// Spawns a new window with the provided [`window::Settings`].
|
||||
Spawn {
|
||||
/// TODO(derezzedex)
|
||||
/// The settings of the [`Window`].
|
||||
settings: window::Settings,
|
||||
},
|
||||
/// Resize the window.
|
||||
|
|
@ -62,7 +62,7 @@ pub enum Action<T> {
|
|||
/// - **macOS:** `None` has no effect.
|
||||
/// - **X11:** Requests for user attention must be manually cleared.
|
||||
/// - **Wayland:** Requires `xdg_activation_v1` protocol, `None` has no effect.
|
||||
RequestUserAttention(Option<UserAttention>),
|
||||
RequestUserAttention(Option<window::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.
|
||||
///
|
||||
|
|
|
|||
|
|
@ -3,10 +3,10 @@
|
|||
/// The icon of a window.
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct Icon {
|
||||
/// TODO(derezzedex)
|
||||
/// The __rgba__ color data of the window [`Icon`].
|
||||
pub rgba: Vec<u8>,
|
||||
/// TODO(derezzedex)
|
||||
/// The width of the window [`Icon`].
|
||||
pub width: u32,
|
||||
/// TODO(derezzedex)
|
||||
/// The height of the window [`Icon`].
|
||||
pub height: u32,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,15 +1,18 @@
|
|||
use std::collections::hash_map::DefaultHasher;
|
||||
use std::fmt::{Display, Formatter};
|
||||
use std::hash::{Hash, Hasher};
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord)]
|
||||
/// TODO(derezzedex)
|
||||
/// The ID of the window.
|
||||
///
|
||||
/// This is not necessarily the same as the window ID fetched from `winit::window::Window`.
|
||||
pub struct Id(u64);
|
||||
|
||||
impl Id {
|
||||
/// TODO(derezzedex): maybe change `u64` to an enum `Type::{Single, Multi(u64)}`
|
||||
pub const MAIN: Self = Id(0);
|
||||
|
||||
/// TODO(derezzedex)
|
||||
/// Creates a new unique window ID.
|
||||
pub fn new(id: impl Hash) -> Id {
|
||||
let mut hasher = DefaultHasher::new();
|
||||
id.hash(&mut hasher);
|
||||
|
|
@ -17,3 +20,9 @@ impl Id {
|
|||
Id(hasher.finish())
|
||||
}
|
||||
}
|
||||
|
||||
impl Display for Id {
|
||||
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
|
||||
write!(f, "Id({})", self.0)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue