add action set icon while running (#1590)

* set windows icon live action

* change get icon to insto raw

* remove mobile docs

* format

* fix format

* add file methods to Icon

* Rename action to `ChangeIcon` and tidy up `Icon` modules

* Fix documentation of `icon::Error`

* Remove unnecessary `\` in `icon` documentation

* Remove `etc.` from `Icon` documentation

---------

Co-authored-by: Héctor Ramón Jiménez <hector0193@gmail.com>
This commit is contained in:
Night_Hunter 2023-04-12 18:47:53 +12:00 committed by GitHub
parent e7549877ef
commit 5a056ce051
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 177 additions and 163 deletions

View file

@ -510,6 +510,15 @@ pub fn user_attention(
}
}
/// Converts some [`Icon`] into it's `winit` counterpart.
///
/// Returns `None` if there is an error during the conversion.
pub fn icon(icon: window::Icon) -> Option<winit::window::Icon> {
let (pixels, size) = icon.into_raw();
winit::window::Icon::from_rgba(pixels, size.width, size.height).ok()
}
// As defined in: http://www.unicode.org/faq/private_use.html
pub(crate) fn is_private_use_character(c: char) -> bool {
matches!(