From 64569f47366cc837f875eaa634165e4f7fa15e14 Mon Sep 17 00:00:00 2001 From: Jared Vititoe Date: Wed, 1 Jul 2026 21:18:25 -0400 Subject: [PATCH] =?UTF-8?q?fix(native):=20windows=200.61=20API=20paths=20?= =?UTF-8?q?=E2=80=94=20repair=20the=20CI=20Windows=20compile?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Four unresolved-import/type errors from the release build (first real compile): - toast.rs: generic IMap moved to the windows-collections crate; read the reply from the ValueSet returned by UserInput() directly (HasKey/Lookup are exposed on the class). - jumplist.rs: PROPVARIANT lives in Win32::System::Com::StructuredStorage (not windows::core); IObjectArray/IObjectCollection in Win32::System::Com (not UI::Shell); PKEY_Title in Win32::Storage::EnhancedStorage (feature added); build the title PROPVARIANT via From<&str> (VT_LPWSTR). - smtc.rs: event registrations return a plain i64 token in windows 0.61 (the EventRegistrationToken newtype is gone). - thumbbar.rs: HICON was imported inside the fn body but used in its signature — fully qualify the return type. Co-Authored-By: Claude Opus 4.8 --- src-tauri/Cargo.toml | 1 + src-tauri/src/native/jumplist.rs | 12 +++++++----- src-tauri/src/native/smtc.rs | 5 +++-- src-tauri/src/native/thumbbar.rs | 7 +++++-- src-tauri/src/native/toast.rs | 11 ++++++----- 5 files changed, 22 insertions(+), 14 deletions(-) diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index 8205261..9d2f994 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -56,6 +56,7 @@ windows = { version = "0.61", features = [ "UI_Notifications", # P5-41 WinRT toast notifications # Win32 namespaces "Win32_Foundation", + "Win32_Storage_EnhancedStorage", # P5-36 jump list (PKEY_Title) "Win32_Graphics_Gdi", "Win32_Networking_NetworkListManager", # P5-49 network awareness "Win32_System_Com", diff --git a/src-tauri/src/native/jumplist.rs b/src-tauri/src/native/jumplist.rs index d33a79c..a062f9a 100644 --- a/src-tauri/src/native/jumplist.rs +++ b/src-tauri/src/native/jumplist.rs @@ -42,16 +42,17 @@ pub fn set_jump_list(app: AppHandle, items: Vec) -> Result<(), String> use std::os::windows::ffi::OsStrExt; use windows::{ - core::{w, Interface, HSTRING, PCWSTR, PROPVARIANT}, + core::{w, Interface, PCWSTR}, Win32::{ + Storage::EnhancedStorage::PKEY_Title, System::Com::{ - CoCreateInstance, CoInitializeEx, CoUninitialize, CLSCTX_INPROC_SERVER, + CoCreateInstance, CoInitializeEx, CoUninitialize, IObjectArray, + IObjectCollection, StructuredStorage::PROPVARIANT, CLSCTX_INPROC_SERVER, COINIT_APARTMENTTHREADED, }, UI::Shell::{ DestinationList, EnumerableObjectCollection, ICustomDestinationList, - IObjectArray, IObjectCollection, IShellLinkW, ShellLink, - PropertiesSystem::{IPropertyStore, PKEY_Title}, + IShellLinkW, PropertiesSystem::IPropertyStore, ShellLink, }, }, }; @@ -109,7 +110,8 @@ pub fn set_jump_list(app: AppHandle, items: Vec) -> Result<(), String> // The visible label comes from System.Title on the link's // property store (a bare IShellLink has no display name). let store: IPropertyStore = link.cast()?; - let title = PROPVARIANT::from(&HSTRING::from(item.title.as_str())); + // From<&str> builds a VT_LPWSTR PROPVARIANT (what System.Title expects). + let title = PROPVARIANT::from(item.title.as_str()); store.SetValue(&PKEY_Title, &title)?; store.Commit()?; diff --git a/src-tauri/src/native/smtc.rs b/src-tauri/src/native/smtc.rs index 84e77fd..a01b155 100644 --- a/src-tauri/src/native/smtc.rs +++ b/src-tauri/src/native/smtc.rs @@ -38,8 +38,9 @@ struct Ev { struct SmtcState { controls: std::sync::Mutex>, // Kept alive so the ButtonPressed handler stays registered for the app's - // lifetime; never unregistered. - _token: windows::Foundation::EventRegistrationToken, + // lifetime; never unregistered. (windows 0.61 event registrations return a + // plain i64 token — the EventRegistrationToken newtype is gone.) + _token: i64, } /// Called once from `native::setup()`. Creates and configures the SMTC on diff --git a/src-tauri/src/native/thumbbar.rs b/src-tauri/src/native/thumbbar.rs index 21f1e15..d96c50e 100644 --- a/src-tauri/src/native/thumbbar.rs +++ b/src-tauri/src/native/thumbbar.rs @@ -186,7 +186,10 @@ enum Glyph { /// added tooltip-only). `slashed` overlays a transparent diagonal cut to signal /// the muted / deafened state. #[cfg(target_os = "windows")] -fn make_icon(glyph: Glyph, slashed: bool) -> Option { +fn make_icon( + glyph: Glyph, + slashed: bool, +) -> Option { use windows::core::BOOL; use windows::Win32::Foundation::COLORREF; use windows::Win32::Graphics::Gdi::{ @@ -194,7 +197,7 @@ fn make_icon(glyph: Glyph, slashed: bool) -> Option { DeleteDC, DeleteObject, Ellipse, GetDC, LineTo, MoveToEx, ReleaseDC, RoundRect, SelectObject, BITMAPINFO, BITMAPINFOHEADER, BI_RGB, DIB_RGB_COLORS, PS_SOLID, }; - use windows::Win32::UI::WindowsAndMessaging::{CreateIconIndirect, HICON, ICONINFO}; + use windows::Win32::UI::WindowsAndMessaging::{CreateIconIndirect, ICONINFO}; unsafe { let size = 32i32; diff --git a/src-tauri/src/native/toast.rs b/src-tauri/src/native/toast.rs index f5f8fc0..f615258 100644 --- a/src-tauri/src/native/toast.rs +++ b/src-tauri/src/native/toast.rs @@ -222,13 +222,14 @@ fn show_windows_toast( fn read_reply( args: &windows::UI::Notifications::ToastActivatedEventArgs, ) -> Option { - use windows::core::{HSTRING, IInspectable, Interface}; - use windows::Foundation::Collections::IMap; + use windows::core::{HSTRING, Interface}; use windows::Foundation::IReference; - // UserInput() is an IPropertySet (IMap); the text input value - // is boxed as an IReference. - let inputs: IMap = args.UserInput().ok()?.cast().ok()?; + // UserInput() returns a ValueSet; windows 0.61 exposes its IMap methods + // (HasKey/Lookup) directly on the class (the generic IMap interface itself + // moved to the separate windows-collections crate). The text input value is + // boxed as an IReference. + let inputs = args.UserInput().ok()?; let key = HSTRING::from("reply"); if !inputs.HasKey(&key).ok()? { return None;