Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve WinRT event representation and testing #3382

Merged
merged 5 commits into from
Dec 11, 2024
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
8 changes: 6 additions & 2 deletions .github/workflows/clippy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,12 @@ jobs:
run: cargo clippy -p test_enums
- name: Clippy test_error
run: cargo clippy -p test_error
- name: Clippy test_event
run: cargo clippy -p test_event
- name: Clippy test_event_core
run: cargo clippy -p test_event_core
- name: Clippy test_events
run: cargo clippy -p test_events
- name: Clippy test_events_client
run: cargo clippy -p test_events_client
- name: Clippy test_extensions
run: cargo clippy -p test_extensions
- name: Clippy test_handles
Expand Down
12 changes: 8 additions & 4 deletions .github/workflows/raw-dylib.yml
Original file line number Diff line number Diff line change
Expand Up @@ -214,8 +214,12 @@ jobs:
run: cargo test -p test_enums --target ${{ matrix.target }} ${{ matrix.etc }}
- name: Test test_error
run: cargo test -p test_error --target ${{ matrix.target }} ${{ matrix.etc }}
- name: Test test_event
run: cargo test -p test_event --target ${{ matrix.target }} ${{ matrix.etc }}
- name: Test test_event_core
run: cargo test -p test_event_core --target ${{ matrix.target }} ${{ matrix.etc }}
- name: Test test_events
run: cargo test -p test_events --target ${{ matrix.target }} ${{ matrix.etc }}
- name: Test test_events_client
run: cargo test -p test_events_client --target ${{ matrix.target }} ${{ matrix.etc }}
- name: Test test_extensions
run: cargo test -p test_extensions --target ${{ matrix.target }} ${{ matrix.etc }}
- name: Test test_handles
Expand Down Expand Up @@ -258,12 +262,12 @@ jobs:
run: cargo test -p test_readme --target ${{ matrix.target }} ${{ matrix.etc }}
- name: Test test_reference
run: cargo test -p test_reference --target ${{ matrix.target }} ${{ matrix.etc }}
- name: Clean
run: cargo clean
- name: Test test_reference_client
run: cargo test -p test_reference_client --target ${{ matrix.target }} ${{ matrix.etc }}
- name: Test test_reference_float
run: cargo test -p test_reference_float --target ${{ matrix.target }} ${{ matrix.etc }}
- name: Clean
run: cargo clean
- name: Test test_registry
run: cargo test -p test_registry --target ${{ matrix.target }} ${{ matrix.etc }}
- name: Test test_registry_default
Expand Down
12 changes: 8 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -211,8 +211,12 @@ jobs:
run: cargo test -p test_enums --target ${{ matrix.target }} ${{ matrix.etc }}
- name: Test test_error
run: cargo test -p test_error --target ${{ matrix.target }} ${{ matrix.etc }}
- name: Test test_event
run: cargo test -p test_event --target ${{ matrix.target }} ${{ matrix.etc }}
- name: Test test_event_core
run: cargo test -p test_event_core --target ${{ matrix.target }} ${{ matrix.etc }}
- name: Test test_events
run: cargo test -p test_events --target ${{ matrix.target }} ${{ matrix.etc }}
- name: Test test_events_client
run: cargo test -p test_events_client --target ${{ matrix.target }} ${{ matrix.etc }}
- name: Test test_extensions
run: cargo test -p test_extensions --target ${{ matrix.target }} ${{ matrix.etc }}
- name: Test test_handles
Expand Down Expand Up @@ -255,12 +259,12 @@ jobs:
run: cargo test -p test_readme --target ${{ matrix.target }} ${{ matrix.etc }}
- name: Test test_reference
run: cargo test -p test_reference --target ${{ matrix.target }} ${{ matrix.etc }}
- name: Clean
run: cargo clean
- name: Test test_reference_client
run: cargo test -p test_reference_client --target ${{ matrix.target }} ${{ matrix.etc }}
- name: Test test_reference_float
run: cargo test -p test_reference_float --target ${{ matrix.target }} ${{ matrix.etc }}
- name: Clean
run: cargo clean
- name: Test test_registry
run: cargo test -p test_registry --target ${{ matrix.target }} ${{ matrix.etc }}
- name: Test test_registry_default
Expand Down
2 changes: 2 additions & 0 deletions crates/libs/bindgen/src/type_name.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ impl TypeName {
pub const IsConst: Self = Self("System.Runtime.CompilerServices", "IsConst");

pub const HResult: Self = Self("Windows.Foundation", "HResult");
pub const EventRegistrationToken: Self = Self("Windows.Foundation", "EventRegistrationToken");

pub const IAsyncAction: Self = Self("Windows.Foundation", "IAsyncAction");
pub const IAsyncActionWithProgress: Self =
Self("Windows.Foundation", "IAsyncActionWithProgress");
Expand Down
1 change: 1 addition & 0 deletions crates/libs/bindgen/src/types/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ impl Type {
TypeName::BOOLEAN => Remap::Type(Self::Bool),
TypeName::IUnknown => Remap::Type(Self::IUnknown),
TypeName::Type => Remap::Type(Self::Type),
TypeName::EventRegistrationToken => Remap::Type(Type::I64),

TypeName::D2D_MATRIX_3X2_F => Remap::Name(TypeName::Matrix3x2),
TypeName::D3DMATRIX => Remap::Name(TypeName::Matrix4x4),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6169,8 +6169,8 @@ impl windows_core::RuntimeType for ISplashScreen {
pub struct ISplashScreen_Vtbl {
pub base__: windows_core::IInspectable_Vtbl,
pub ImageLocation: unsafe extern "system" fn(*mut core::ffi::c_void, *mut super::super::Foundation::Rect) -> windows_core::HRESULT,
pub Dismissed: unsafe extern "system" fn(*mut core::ffi::c_void, *mut core::ffi::c_void, *mut super::super::Foundation::EventRegistrationToken) -> windows_core::HRESULT,
pub RemoveDismissed: unsafe extern "system" fn(*mut core::ffi::c_void, super::super::Foundation::EventRegistrationToken) -> windows_core::HRESULT,
pub Dismissed: unsafe extern "system" fn(*mut core::ffi::c_void, *mut core::ffi::c_void, *mut i64) -> windows_core::HRESULT,
pub RemoveDismissed: unsafe extern "system" fn(*mut core::ffi::c_void, i64) -> windows_core::HRESULT,
}
windows_core::imp::define_interface!(IStartupTaskActivatedEventArgs, IStartupTaskActivatedEventArgs_Vtbl, 0x03b11a58_5276_4d91_8621_54611864d5fa);
impl windows_core::RuntimeType for IStartupTaskActivatedEventArgs {
Expand Down Expand Up @@ -7709,17 +7709,17 @@ impl SplashScreen {
(windows_core::Interface::vtable(this).ImageLocation)(windows_core::Interface::as_raw(this), &mut result__).map(|| core::mem::transmute(result__))
}
}
pub fn Dismissed<P0>(&self, handler: P0) -> windows_core::Result<super::super::Foundation::EventRegistrationToken>
pub fn Dismissed<P0>(&self, handler: P0) -> windows_core::Result<i64>
where
P0: windows_core::Param<super::super::Foundation::TypedEventHandler<SplashScreen, windows_core::IInspectable>>,
{
let this = self;
unsafe {
let mut result__ = core::mem::zeroed();
(windows_core::Interface::vtable(this).Dismissed)(windows_core::Interface::as_raw(this), handler.param().abi(), &mut result__).map(|| core::mem::transmute(result__))
(windows_core::Interface::vtable(this).Dismissed)(windows_core::Interface::as_raw(this), handler.param().abi(), &mut result__).map(|| result__)
}
}
pub fn RemoveDismissed(&self, cookie: super::super::Foundation::EventRegistrationToken) -> windows_core::Result<()> {
pub fn RemoveDismissed(&self, cookie: i64) -> windows_core::Result<()> {
let this = self;
unsafe { (windows_core::Interface::vtable(this).RemoveDismissed)(windows_core::Interface::as_raw(this), cookie).ok() }
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,73 +117,73 @@ impl AppExtensionCatalog {
(windows_core::Interface::vtable(this).RequestRemovePackageAsync)(windows_core::Interface::as_raw(this), core::mem::transmute_copy(packagefullname), &mut result__).and_then(|| windows_core::Type::from_abi(result__))
}
}
pub fn PackageInstalled<P0>(&self, handler: P0) -> windows_core::Result<super::super::Foundation::EventRegistrationToken>
pub fn PackageInstalled<P0>(&self, handler: P0) -> windows_core::Result<i64>
where
P0: windows_core::Param<super::super::Foundation::TypedEventHandler<AppExtensionCatalog, AppExtensionPackageInstalledEventArgs>>,
{
let this = self;
unsafe {
let mut result__ = core::mem::zeroed();
(windows_core::Interface::vtable(this).PackageInstalled)(windows_core::Interface::as_raw(this), handler.param().abi(), &mut result__).map(|| core::mem::transmute(result__))
(windows_core::Interface::vtable(this).PackageInstalled)(windows_core::Interface::as_raw(this), handler.param().abi(), &mut result__).map(|| result__)
}
}
pub fn RemovePackageInstalled(&self, token: super::super::Foundation::EventRegistrationToken) -> windows_core::Result<()> {
pub fn RemovePackageInstalled(&self, token: i64) -> windows_core::Result<()> {
let this = self;
unsafe { (windows_core::Interface::vtable(this).RemovePackageInstalled)(windows_core::Interface::as_raw(this), token).ok() }
}
pub fn PackageUpdating<P0>(&self, handler: P0) -> windows_core::Result<super::super::Foundation::EventRegistrationToken>
pub fn PackageUpdating<P0>(&self, handler: P0) -> windows_core::Result<i64>
where
P0: windows_core::Param<super::super::Foundation::TypedEventHandler<AppExtensionCatalog, AppExtensionPackageUpdatingEventArgs>>,
{
let this = self;
unsafe {
let mut result__ = core::mem::zeroed();
(windows_core::Interface::vtable(this).PackageUpdating)(windows_core::Interface::as_raw(this), handler.param().abi(), &mut result__).map(|| core::mem::transmute(result__))
(windows_core::Interface::vtable(this).PackageUpdating)(windows_core::Interface::as_raw(this), handler.param().abi(), &mut result__).map(|| result__)
}
}
pub fn RemovePackageUpdating(&self, token: super::super::Foundation::EventRegistrationToken) -> windows_core::Result<()> {
pub fn RemovePackageUpdating(&self, token: i64) -> windows_core::Result<()> {
let this = self;
unsafe { (windows_core::Interface::vtable(this).RemovePackageUpdating)(windows_core::Interface::as_raw(this), token).ok() }
}
pub fn PackageUpdated<P0>(&self, handler: P0) -> windows_core::Result<super::super::Foundation::EventRegistrationToken>
pub fn PackageUpdated<P0>(&self, handler: P0) -> windows_core::Result<i64>
where
P0: windows_core::Param<super::super::Foundation::TypedEventHandler<AppExtensionCatalog, AppExtensionPackageUpdatedEventArgs>>,
{
let this = self;
unsafe {
let mut result__ = core::mem::zeroed();
(windows_core::Interface::vtable(this).PackageUpdated)(windows_core::Interface::as_raw(this), handler.param().abi(), &mut result__).map(|| core::mem::transmute(result__))
(windows_core::Interface::vtable(this).PackageUpdated)(windows_core::Interface::as_raw(this), handler.param().abi(), &mut result__).map(|| result__)
}
}
pub fn RemovePackageUpdated(&self, token: super::super::Foundation::EventRegistrationToken) -> windows_core::Result<()> {
pub fn RemovePackageUpdated(&self, token: i64) -> windows_core::Result<()> {
let this = self;
unsafe { (windows_core::Interface::vtable(this).RemovePackageUpdated)(windows_core::Interface::as_raw(this), token).ok() }
}
pub fn PackageUninstalling<P0>(&self, handler: P0) -> windows_core::Result<super::super::Foundation::EventRegistrationToken>
pub fn PackageUninstalling<P0>(&self, handler: P0) -> windows_core::Result<i64>
where
P0: windows_core::Param<super::super::Foundation::TypedEventHandler<AppExtensionCatalog, AppExtensionPackageUninstallingEventArgs>>,
{
let this = self;
unsafe {
let mut result__ = core::mem::zeroed();
(windows_core::Interface::vtable(this).PackageUninstalling)(windows_core::Interface::as_raw(this), handler.param().abi(), &mut result__).map(|| core::mem::transmute(result__))
(windows_core::Interface::vtable(this).PackageUninstalling)(windows_core::Interface::as_raw(this), handler.param().abi(), &mut result__).map(|| result__)
}
}
pub fn RemovePackageUninstalling(&self, token: super::super::Foundation::EventRegistrationToken) -> windows_core::Result<()> {
pub fn RemovePackageUninstalling(&self, token: i64) -> windows_core::Result<()> {
let this = self;
unsafe { (windows_core::Interface::vtable(this).RemovePackageUninstalling)(windows_core::Interface::as_raw(this), token).ok() }
}
pub fn PackageStatusChanged<P0>(&self, handler: P0) -> windows_core::Result<super::super::Foundation::EventRegistrationToken>
pub fn PackageStatusChanged<P0>(&self, handler: P0) -> windows_core::Result<i64>
where
P0: windows_core::Param<super::super::Foundation::TypedEventHandler<AppExtensionCatalog, AppExtensionPackageStatusChangedEventArgs>>,
{
let this = self;
unsafe {
let mut result__ = core::mem::zeroed();
(windows_core::Interface::vtable(this).PackageStatusChanged)(windows_core::Interface::as_raw(this), handler.param().abi(), &mut result__).map(|| core::mem::transmute(result__))
(windows_core::Interface::vtable(this).PackageStatusChanged)(windows_core::Interface::as_raw(this), handler.param().abi(), &mut result__).map(|| result__)
}
}
pub fn RemovePackageStatusChanged(&self, token: super::super::Foundation::EventRegistrationToken) -> windows_core::Result<()> {
pub fn RemovePackageStatusChanged(&self, token: i64) -> windows_core::Result<()> {
let this = self;
unsafe { (windows_core::Interface::vtable(this).RemovePackageStatusChanged)(windows_core::Interface::as_raw(this), token).ok() }
}
Expand Down Expand Up @@ -451,16 +451,16 @@ pub struct IAppExtensionCatalog_Vtbl {
#[cfg(not(feature = "Foundation_Collections"))]
FindAllAsync: usize,
pub RequestRemovePackageAsync: unsafe extern "system" fn(*mut core::ffi::c_void, *mut core::ffi::c_void, *mut *mut core::ffi::c_void) -> windows_core::HRESULT,
pub PackageInstalled: unsafe extern "system" fn(*mut core::ffi::c_void, *mut core::ffi::c_void, *mut super::super::Foundation::EventRegistrationToken) -> windows_core::HRESULT,
pub RemovePackageInstalled: unsafe extern "system" fn(*mut core::ffi::c_void, super::super::Foundation::EventRegistrationToken) -> windows_core::HRESULT,
pub PackageUpdating: unsafe extern "system" fn(*mut core::ffi::c_void, *mut core::ffi::c_void, *mut super::super::Foundation::EventRegistrationToken) -> windows_core::HRESULT,
pub RemovePackageUpdating: unsafe extern "system" fn(*mut core::ffi::c_void, super::super::Foundation::EventRegistrationToken) -> windows_core::HRESULT,
pub PackageUpdated: unsafe extern "system" fn(*mut core::ffi::c_void, *mut core::ffi::c_void, *mut super::super::Foundation::EventRegistrationToken) -> windows_core::HRESULT,
pub RemovePackageUpdated: unsafe extern "system" fn(*mut core::ffi::c_void, super::super::Foundation::EventRegistrationToken) -> windows_core::HRESULT,
pub PackageUninstalling: unsafe extern "system" fn(*mut core::ffi::c_void, *mut core::ffi::c_void, *mut super::super::Foundation::EventRegistrationToken) -> windows_core::HRESULT,
pub RemovePackageUninstalling: unsafe extern "system" fn(*mut core::ffi::c_void, super::super::Foundation::EventRegistrationToken) -> windows_core::HRESULT,
pub PackageStatusChanged: unsafe extern "system" fn(*mut core::ffi::c_void, *mut core::ffi::c_void, *mut super::super::Foundation::EventRegistrationToken) -> windows_core::HRESULT,
pub RemovePackageStatusChanged: unsafe extern "system" fn(*mut core::ffi::c_void, super::super::Foundation::EventRegistrationToken) -> windows_core::HRESULT,
pub PackageInstalled: unsafe extern "system" fn(*mut core::ffi::c_void, *mut core::ffi::c_void, *mut i64) -> windows_core::HRESULT,
pub RemovePackageInstalled: unsafe extern "system" fn(*mut core::ffi::c_void, i64) -> windows_core::HRESULT,
pub PackageUpdating: unsafe extern "system" fn(*mut core::ffi::c_void, *mut core::ffi::c_void, *mut i64) -> windows_core::HRESULT,
pub RemovePackageUpdating: unsafe extern "system" fn(*mut core::ffi::c_void, i64) -> windows_core::HRESULT,
pub PackageUpdated: unsafe extern "system" fn(*mut core::ffi::c_void, *mut core::ffi::c_void, *mut i64) -> windows_core::HRESULT,
pub RemovePackageUpdated: unsafe extern "system" fn(*mut core::ffi::c_void, i64) -> windows_core::HRESULT,
pub PackageUninstalling: unsafe extern "system" fn(*mut core::ffi::c_void, *mut core::ffi::c_void, *mut i64) -> windows_core::HRESULT,
pub RemovePackageUninstalling: unsafe extern "system" fn(*mut core::ffi::c_void, i64) -> windows_core::HRESULT,
pub PackageStatusChanged: unsafe extern "system" fn(*mut core::ffi::c_void, *mut core::ffi::c_void, *mut i64) -> windows_core::HRESULT,
pub RemovePackageStatusChanged: unsafe extern "system" fn(*mut core::ffi::c_void, i64) -> windows_core::HRESULT,
}
windows_core::imp::define_interface!(IAppExtensionCatalog2, IAppExtensionCatalog2_Vtbl, 0x50056eba_58b6_4147_b5a5_8feca6dfb49d);
impl windows_core::RuntimeType for IAppExtensionCatalog2 {
Expand Down
Loading
Loading