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
50 changes: 47 additions & 3 deletions Cargo.lock

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

12 changes: 12 additions & 0 deletions changelog.d/8270-windows-mapview.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
### feat(windows): render MapView with a native MapControl

Windows `MapView` now replaces its text placeholder with a native
`Windows.UI.Xaml.Controls.Maps.MapControl` hosted in a XAML Island. The existing
cross-platform API drives the native center and zoom, titled `MapIcon` pins,
pin clearing, and Road/Aerial/AerialWithRoads styles. The island follows Perry's
Win32 layout and message loop, and is released with its host widget.

Perry's embedded Windows UI manifest now opts unpackaged applications into the
Windows 10 1903 compatibility context required by XAML Islands. Map-service-token
setup through `PERRY_MAP_SERVICE_TOKEN` and `PERRY_BING_MAPS_KEY` is documented.
Fixes #559.
18 changes: 18 additions & 0 deletions crates/perry-ui-windows/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -89,5 +89,23 @@ windows = { version = "0.62", features = [
"Win32_Networking_WinHttp",
] }

# UWP XAML Islands + MapControl (#559). The current windows crate no longer
# projects Windows.UI.Xaml, so keep the last Microsoft-generated projection
# that does, under an explicit alias. It is isolated to map_view.rs; HWNDs are
# bridged through their raw pointer value so no windows-core types cross the
# version boundary.
windows-xaml = { package = "windows", version = "0.35", features = [
"Foundation",
"Foundation_Collections",
"Devices_Geolocation",
"UI_Xaml",
"UI_Xaml_Controls",
"UI_Xaml_Controls_Maps",
"UI_Xaml_Hosting",
"Win32_Foundation",
"Win32_System_WinRT_Xaml",
"Win32_UI_WindowsAndMessaging",
] }

[features]
geisterhand = []
3 changes: 3 additions & 0 deletions crates/perry-ui-windows/src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,9 @@ unsafe fn dispatch_ui_message(msg: &MSG) {
});
return;
}
if crate::widgets::map_view::pre_translate_message(msg) {
return;
}
if (msg.message == WM_KEYDOWN || msg.message == WM_SYSKEYDOWN)
&& try_handle_shortcut(msg.wParam.0 as u16)
{
Expand Down
5 changes: 1 addition & 4 deletions crates/perry-ui-windows/src/ffi/rich_pdf_map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,7 @@ pub extern "C" fn perry_ui_pdf_view_set_scale(h: i64, s: f64) {
widgets::pdf_view::set_scale(h, s)
}

// MapView (#517 / #559) — Win32 stub-with-state. STATIC label shows
// the current region + pin count. Real WinUI MapControl in XAML
// Islands needs Windows App SDK + WinUI 3 stack + Bing Maps API key
// — tracked under #559 as multi-day follow-up.
// MapView (#517 / #559) — native MapControl hosted in a XAML Island.
#[no_mangle]
pub extern "C" fn perry_ui_map_view_create(w: f64, h: f64) -> i64 {
widgets::map_view::create(w, h)
Expand Down
Loading
Loading