Skip to content

Commit a6b0a12

Browse files
authored
fix: Update windows-rs to 0.44 (#220)
1 parent 54e82f6 commit a6b0a12

File tree

8 files changed

+27
-22
lines changed

8 files changed

+27
-22
lines changed

Cargo.lock

Lines changed: 17 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

platforms/windows/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ once_cell = "1.13.0"
1818
paste = "1.0"
1919

2020
[dependencies.windows]
21-
version = "0.42.0"
21+
version = "0.44.0"
2222
features = [
2323
"implement",
2424
"Win32_Foundation",

platforms/windows/examples/hello_world.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ static WINDOW_CLASS_ATOM: Lazy<u16> = Lazy::new(|| {
2323
let wc = WNDCLASSW {
2424
hCursor: unsafe { LoadCursorW(None, IDC_ARROW) }.unwrap(),
2525
hInstance: unsafe { GetModuleHandleW(None) }.unwrap(),
26-
lpszClassName: class_name.into(),
26+
lpszClassName: class_name,
2727
style: CS_HREDRAW | CS_VREDRAW,
2828
lpfnWndProc: Some(wndproc),
2929
..Default::default()

platforms/windows/src/adapter.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -254,8 +254,8 @@ impl QueuedEvents {
254254
UiaRaiseAutomationPropertyChangedEvent(
255255
&element,
256256
property_id,
257-
&old_value,
258-
&new_value,
257+
old_value,
258+
new_value,
259259
)
260260
}
261261
.unwrap();

platforms/windows/src/subclass.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use windows::{
1313

1414
use crate::{Adapter, QueuedEvents, UiaInitMarker};
1515

16-
const PROP_NAME: &HSTRING = w!("AccessKitAdapter");
16+
const PROP_NAME: PCWSTR = w!("AccessKitAdapter");
1717

1818
type LazyAdapter = Lazy<Adapter, Box<dyn FnOnce() -> Adapter>>;
1919

platforms/windows/src/tests/simple.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ fn is_button_named(element: &IUIAutomationElement, expected_name: &str) -> bool
7878
let control_type = unsafe { element.CurrentControlType() }.unwrap();
7979
let name = unsafe { element.CurrentName() }.unwrap();
8080
let name: String = name.try_into().unwrap();
81-
control_type == (UIA_ButtonControlTypeId.0 as i32) && name == expected_name
81+
control_type == UIA_ButtonControlTypeId && name == expected_name
8282
}
8383

8484
fn is_button_1(element: &IUIAutomationElement) -> bool {

platforms/windows/src/text.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,7 @@ impl ITextRangeProvider_Impl for PlatformRange {
400400

401401
fn FindAttribute(
402402
&self,
403-
_id: i32,
403+
_id: UIA_TEXTATTRIBUTE_ID,
404404
_value: &VARIANT,
405405
_backward: BOOL,
406406
) -> Result<ITextRangeProvider> {
@@ -421,8 +421,7 @@ impl ITextRangeProvider_Impl for PlatformRange {
421421
Err(Error::OK)
422422
}
423423

424-
fn GetAttributeValue(&self, id: i32) -> Result<VARIANT> {
425-
let id = UIA_TEXTATTRIBUTE_ID(id as _);
424+
fn GetAttributeValue(&self, id: UIA_TEXTATTRIBUTE_ID) -> Result<VARIANT> {
426425
match id {
427426
UIA_IsReadOnlyAttributeId => {
428427
// TBD: do we ever want to support mixed read-only/editable text?

platforms/windows/src/util.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ impl From<bool> for VariantFactory {
130130
Self(
131131
VT_BOOL,
132132
VARIANT_0_0_0 {
133-
boolVal: if value { VARIANT_TRUE } else { VARIANT_FALSE },
133+
boolVal: VARIANT_BOOL(if value { VARIANT_TRUE } else { VARIANT_FALSE }),
134134
},
135135
)
136136
}
@@ -240,7 +240,7 @@ pub(crate) fn window_title(hwnd: HWND) -> Option<BSTR> {
240240
}
241241
let len = result.0 as usize;
242242
unsafe { buffer.set_len(len) };
243-
Some(BSTR::from_wide(&buffer))
243+
Some(BSTR::from_wide(&buffer).unwrap())
244244
}
245245

246246
pub(crate) fn upgrade<T>(weak: &Weak<T>) -> Result<Arc<T>> {

0 commit comments

Comments
 (0)