fix(native): windows 0.61 API paths — repair the CI Windows compile
Build Lotus Chat Desktop / prepare (push) Successful in 5s
Build Lotus Chat Desktop / build-windows (push) Failing after 18m50s
Build Lotus Chat Desktop / build-linux (push) Successful in 23m40s
Build Lotus Chat Desktop / update-manifest (push) Has been skipped

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 <noreply@anthropic.com>
This commit is contained in:
2026-07-01 21:18:25 -04:00
parent 89b82f441d
commit 64569f4736
5 changed files with 22 additions and 14 deletions
+1
View File
@@ -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",
+7 -5
View File
@@ -42,16 +42,17 @@ pub fn set_jump_list(app: AppHandle, items: Vec<JumpItem>) -> 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<JumpItem>) -> 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()?;
+3 -2
View File
@@ -38,8 +38,9 @@ struct Ev {
struct SmtcState {
controls: std::sync::Mutex<Option<windows::Media::SystemMediaTransportControls>>,
// 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
+5 -2
View File
@@ -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<HICON> {
fn make_icon(
glyph: Glyph,
slashed: bool,
) -> Option<windows::Win32::UI::WindowsAndMessaging::HICON> {
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<HICON> {
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;
+6 -5
View File
@@ -222,13 +222,14 @@ fn show_windows_toast(
fn read_reply(
args: &windows::UI::Notifications::ToastActivatedEventArgs,
) -> Option<String> {
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<String, Object>); the text input value
// is boxed as an IReference<HSTRING>.
let inputs: IMap<HSTRING, IInspectable> = 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<HSTRING>.
let inputs = args.UserInput().ok()?;
let key = HSTRING::from("reply");
if !inputs.HasKey(&key).ok()? {
return None;