Navigation Menu

Skip to content

Commit

Permalink
Add window icon on X11 and Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
UK992 committed Jul 1, 2018
1 parent a3767de commit 4225cd5
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion ports/servo/Cargo.toml
Expand Up @@ -43,7 +43,7 @@ lazy_static = "1"
libservo = {path = "../../components/servo"}
log = "0.4"
tinyfiledialogs = "3.0"
winit = "0.15"
winit = {version = "0.15", features = ["icon_loading"]}

[target.'cfg(not(target_os = "android"))'.dependencies]
sig = "0.1"
Expand Down
9 changes: 8 additions & 1 deletion ports/servo/glutin_app/window.rs
Expand Up @@ -201,6 +201,13 @@ impl Window {
.with_visibility(visible)
.with_multitouch();

#[cfg(any(target_os = "linux", target_os = "windows"))]
{
let icon_bytes = include_bytes!("../../../resources/servo64.png");
let icon = Some(winit::Icon::from_bytes(icon_bytes).expect("Failed to open icon"));
window_builder = window_builder.with_window_icon(icon);
}

window_builder = builder_with_platform_options(window_builder);

let mut context_builder = ContextBuilder::new()
Expand Down Expand Up @@ -525,7 +532,7 @@ impl Window {
..
} => self.event_queue.borrow_mut().push(WindowEvent::Refresh),
Event::WindowEvent {
event: winit::WindowEvent::Closed,
event: winit::WindowEvent::CloseRequested,
..
} => {
self.event_queue.borrow_mut().push(WindowEvent::Quit);
Expand Down
Binary file added resources/servo64.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 4225cd5

Please sign in to comment.