Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 21 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion desktop/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ serde = { workspace = true }
ash = { version = "0.38", optional = true }

# Windows-specific dependencies
[target.'cfg(windows)'.dependencies]
[target.'cfg(target_os = "windows")'.dependencies]
windows = { version = "0.58.0", features = [
"Win32_Foundation",
"Win32_Graphics_Direct3D11",
Expand All @@ -72,3 +72,6 @@ core-foundation = { version = "0.9", optional = true }
# Linux-specific dependencies
[target.'cfg(target_os = "linux")'.dependencies]
libc = { version = "0.2", optional = true }

[target.'cfg(target_os = "windows")'.build-dependencies]
winres = "0.1"
Binary file added desktop/assets/graphite-icon-color.ico
Binary file not shown.
8 changes: 8 additions & 0 deletions desktop/build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
fn main() {
#[cfg(target_os = "windows")]
{
let mut res = winres::WindowsResource::new();
res.set_icon("assets/graphite-icon-color.ico");
res.compile().expect("Failed to compile Windows resources");
}
}
9 changes: 9 additions & 0 deletions desktop/src/native_window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,17 @@ impl NativeWindowHandle {
} else {
let x11_window = WindowAttributesX11::default().with_name(APP_ID, APP_NAME);
window.with_platform_attributes(Box::new(x11_window))
};
}

#[cfg(target_os = "windows")]
{
if let Ok(win_icon) = winit::platform::windows::WinIcon::from_resource(1, None) {
let icon = winit::icon::Icon(std::sync::Arc::new(win_icon));
window = window.with_window_icon(Some(icon));
}
}

window
}
#[allow(unused_variables)]
Expand Down
Loading