-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[GeneratedComInterface]
based Windows automation (#16543)
* Move automation interfaces to the Avalonia.Win32.Automation with DisableRuntimeMarshalling and use [GeneratedComInterface] marshalling * Various fixes for the new windows accessibility * Numerge Avalonia.Win32.Automation into Avalonia.Win32 * Suppress Avalonia.Win32 API warnings, these interfaces never were part of the public API * Fix IRawElementProviderSimple2 definition on legacy COM interop * Some changes after review * More consistent COM method names * Fix folder hierarchy * Rewrite SafeArrayMarshaller to use arrays as managed type * Add ManagedObjectWrapper where's possible * Throw an exception for unsupported SafeArrayRef scenario --------- Co-authored-by: Julien Lebosquain <[email protected]>
- Loading branch information
Showing
77 changed files
with
2,134 additions
and
977 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,214 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<!-- https://learn.microsoft.com/en-us/dotnet/fundamentals/package-validation/diagnostic-ids --> | ||
<Suppressions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> | ||
<Suppression> | ||
<DiagnosticId>CP0001</DiagnosticId> | ||
<Target>T:Avalonia.Win32.Interop.Automation.DockPosition</Target> | ||
<Left>baseline/netstandard2.0/Avalonia.Win32.dll</Left> | ||
<Right>target/netstandard2.0/Avalonia.Win32.dll</Right> | ||
</Suppression> | ||
<Suppression> | ||
<DiagnosticId>CP0001</DiagnosticId> | ||
<Target>T:Avalonia.Win32.Interop.Automation.IDockProvider</Target> | ||
<Left>baseline/netstandard2.0/Avalonia.Win32.dll</Left> | ||
<Right>target/netstandard2.0/Avalonia.Win32.dll</Right> | ||
</Suppression> | ||
<Suppression> | ||
<DiagnosticId>CP0001</DiagnosticId> | ||
<Target>T:Avalonia.Win32.Interop.Automation.IExpandCollapseProvider</Target> | ||
<Left>baseline/netstandard2.0/Avalonia.Win32.dll</Left> | ||
<Right>target/netstandard2.0/Avalonia.Win32.dll</Right> | ||
</Suppression> | ||
<Suppression> | ||
<DiagnosticId>CP0001</DiagnosticId> | ||
<Target>T:Avalonia.Win32.Interop.Automation.IGridItemProvider</Target> | ||
<Left>baseline/netstandard2.0/Avalonia.Win32.dll</Left> | ||
<Right>target/netstandard2.0/Avalonia.Win32.dll</Right> | ||
</Suppression> | ||
<Suppression> | ||
<DiagnosticId>CP0001</DiagnosticId> | ||
<Target>T:Avalonia.Win32.Interop.Automation.IGridProvider</Target> | ||
<Left>baseline/netstandard2.0/Avalonia.Win32.dll</Left> | ||
<Right>target/netstandard2.0/Avalonia.Win32.dll</Right> | ||
</Suppression> | ||
<Suppression> | ||
<DiagnosticId>CP0001</DiagnosticId> | ||
<Target>T:Avalonia.Win32.Interop.Automation.IInvokeProvider</Target> | ||
<Left>baseline/netstandard2.0/Avalonia.Win32.dll</Left> | ||
<Right>target/netstandard2.0/Avalonia.Win32.dll</Right> | ||
</Suppression> | ||
<Suppression> | ||
<DiagnosticId>CP0001</DiagnosticId> | ||
<Target>T:Avalonia.Win32.Interop.Automation.IMultipleViewProvider</Target> | ||
<Left>baseline/netstandard2.0/Avalonia.Win32.dll</Left> | ||
<Right>target/netstandard2.0/Avalonia.Win32.dll</Right> | ||
</Suppression> | ||
<Suppression> | ||
<DiagnosticId>CP0001</DiagnosticId> | ||
<Target>T:Avalonia.Win32.Interop.Automation.IRangeValueProvider</Target> | ||
<Left>baseline/netstandard2.0/Avalonia.Win32.dll</Left> | ||
<Right>target/netstandard2.0/Avalonia.Win32.dll</Right> | ||
</Suppression> | ||
<Suppression> | ||
<DiagnosticId>CP0001</DiagnosticId> | ||
<Target>T:Avalonia.Win32.Interop.Automation.IRawElementProviderAdviseEvents</Target> | ||
<Left>baseline/netstandard2.0/Avalonia.Win32.dll</Left> | ||
<Right>target/netstandard2.0/Avalonia.Win32.dll</Right> | ||
</Suppression> | ||
<Suppression> | ||
<DiagnosticId>CP0001</DiagnosticId> | ||
<Target>T:Avalonia.Win32.Interop.Automation.IRawElementProviderFragment</Target> | ||
<Left>baseline/netstandard2.0/Avalonia.Win32.dll</Left> | ||
<Right>target/netstandard2.0/Avalonia.Win32.dll</Right> | ||
</Suppression> | ||
<Suppression> | ||
<DiagnosticId>CP0001</DiagnosticId> | ||
<Target>T:Avalonia.Win32.Interop.Automation.IRawElementProviderFragmentRoot</Target> | ||
<Left>baseline/netstandard2.0/Avalonia.Win32.dll</Left> | ||
<Right>target/netstandard2.0/Avalonia.Win32.dll</Right> | ||
</Suppression> | ||
<Suppression> | ||
<DiagnosticId>CP0001</DiagnosticId> | ||
<Target>T:Avalonia.Win32.Interop.Automation.IRawElementProviderSimple</Target> | ||
<Left>baseline/netstandard2.0/Avalonia.Win32.dll</Left> | ||
<Right>target/netstandard2.0/Avalonia.Win32.dll</Right> | ||
</Suppression> | ||
<Suppression> | ||
<DiagnosticId>CP0001</DiagnosticId> | ||
<Target>T:Avalonia.Win32.Interop.Automation.IRawElementProviderSimple2</Target> | ||
<Left>baseline/netstandard2.0/Avalonia.Win32.dll</Left> | ||
<Right>target/netstandard2.0/Avalonia.Win32.dll</Right> | ||
</Suppression> | ||
<Suppression> | ||
<DiagnosticId>CP0001</DiagnosticId> | ||
<Target>T:Avalonia.Win32.Interop.Automation.IScrollItemProvider</Target> | ||
<Left>baseline/netstandard2.0/Avalonia.Win32.dll</Left> | ||
<Right>target/netstandard2.0/Avalonia.Win32.dll</Right> | ||
</Suppression> | ||
<Suppression> | ||
<DiagnosticId>CP0001</DiagnosticId> | ||
<Target>T:Avalonia.Win32.Interop.Automation.IScrollProvider</Target> | ||
<Left>baseline/netstandard2.0/Avalonia.Win32.dll</Left> | ||
<Right>target/netstandard2.0/Avalonia.Win32.dll</Right> | ||
</Suppression> | ||
<Suppression> | ||
<DiagnosticId>CP0001</DiagnosticId> | ||
<Target>T:Avalonia.Win32.Interop.Automation.ISelectionItemProvider</Target> | ||
<Left>baseline/netstandard2.0/Avalonia.Win32.dll</Left> | ||
<Right>target/netstandard2.0/Avalonia.Win32.dll</Right> | ||
</Suppression> | ||
<Suppression> | ||
<DiagnosticId>CP0001</DiagnosticId> | ||
<Target>T:Avalonia.Win32.Interop.Automation.ISelectionProvider</Target> | ||
<Left>baseline/netstandard2.0/Avalonia.Win32.dll</Left> | ||
<Right>target/netstandard2.0/Avalonia.Win32.dll</Right> | ||
</Suppression> | ||
<Suppression> | ||
<DiagnosticId>CP0001</DiagnosticId> | ||
<Target>T:Avalonia.Win32.Interop.Automation.ISynchronizedInputProvider</Target> | ||
<Left>baseline/netstandard2.0/Avalonia.Win32.dll</Left> | ||
<Right>target/netstandard2.0/Avalonia.Win32.dll</Right> | ||
</Suppression> | ||
<Suppression> | ||
<DiagnosticId>CP0001</DiagnosticId> | ||
<Target>T:Avalonia.Win32.Interop.Automation.ITableItemProvider</Target> | ||
<Left>baseline/netstandard2.0/Avalonia.Win32.dll</Left> | ||
<Right>target/netstandard2.0/Avalonia.Win32.dll</Right> | ||
</Suppression> | ||
<Suppression> | ||
<DiagnosticId>CP0001</DiagnosticId> | ||
<Target>T:Avalonia.Win32.Interop.Automation.ITableProvider</Target> | ||
<Left>baseline/netstandard2.0/Avalonia.Win32.dll</Left> | ||
<Right>target/netstandard2.0/Avalonia.Win32.dll</Right> | ||
</Suppression> | ||
<Suppression> | ||
<DiagnosticId>CP0001</DiagnosticId> | ||
<Target>T:Avalonia.Win32.Interop.Automation.ITextProvider</Target> | ||
<Left>baseline/netstandard2.0/Avalonia.Win32.dll</Left> | ||
<Right>target/netstandard2.0/Avalonia.Win32.dll</Right> | ||
</Suppression> | ||
<Suppression> | ||
<DiagnosticId>CP0001</DiagnosticId> | ||
<Target>T:Avalonia.Win32.Interop.Automation.ITextRangeProvider</Target> | ||
<Left>baseline/netstandard2.0/Avalonia.Win32.dll</Left> | ||
<Right>target/netstandard2.0/Avalonia.Win32.dll</Right> | ||
</Suppression> | ||
<Suppression> | ||
<DiagnosticId>CP0001</DiagnosticId> | ||
<Target>T:Avalonia.Win32.Interop.Automation.IToggleProvider</Target> | ||
<Left>baseline/netstandard2.0/Avalonia.Win32.dll</Left> | ||
<Right>target/netstandard2.0/Avalonia.Win32.dll</Right> | ||
</Suppression> | ||
<Suppression> | ||
<DiagnosticId>CP0001</DiagnosticId> | ||
<Target>T:Avalonia.Win32.Interop.Automation.ITransformProvider</Target> | ||
<Left>baseline/netstandard2.0/Avalonia.Win32.dll</Left> | ||
<Right>target/netstandard2.0/Avalonia.Win32.dll</Right> | ||
</Suppression> | ||
<Suppression> | ||
<DiagnosticId>CP0001</DiagnosticId> | ||
<Target>T:Avalonia.Win32.Interop.Automation.IValueProvider</Target> | ||
<Left>baseline/netstandard2.0/Avalonia.Win32.dll</Left> | ||
<Right>target/netstandard2.0/Avalonia.Win32.dll</Right> | ||
</Suppression> | ||
<Suppression> | ||
<DiagnosticId>CP0001</DiagnosticId> | ||
<Target>T:Avalonia.Win32.Interop.Automation.IWindowProvider</Target> | ||
<Left>baseline/netstandard2.0/Avalonia.Win32.dll</Left> | ||
<Right>target/netstandard2.0/Avalonia.Win32.dll</Right> | ||
</Suppression> | ||
<Suppression> | ||
<DiagnosticId>CP0001</DiagnosticId> | ||
<Target>T:Avalonia.Win32.Interop.Automation.NavigateDirection</Target> | ||
<Left>baseline/netstandard2.0/Avalonia.Win32.dll</Left> | ||
<Right>target/netstandard2.0/Avalonia.Win32.dll</Right> | ||
</Suppression> | ||
<Suppression> | ||
<DiagnosticId>CP0001</DiagnosticId> | ||
<Target>T:Avalonia.Win32.Interop.Automation.ProviderOptions</Target> | ||
<Left>baseline/netstandard2.0/Avalonia.Win32.dll</Left> | ||
<Right>target/netstandard2.0/Avalonia.Win32.dll</Right> | ||
</Suppression> | ||
<Suppression> | ||
<DiagnosticId>CP0001</DiagnosticId> | ||
<Target>T:Avalonia.Win32.Interop.Automation.RowOrColumnMajor</Target> | ||
<Left>baseline/netstandard2.0/Avalonia.Win32.dll</Left> | ||
<Right>target/netstandard2.0/Avalonia.Win32.dll</Right> | ||
</Suppression> | ||
<Suppression> | ||
<DiagnosticId>CP0001</DiagnosticId> | ||
<Target>T:Avalonia.Win32.Interop.Automation.SupportedTextSelection</Target> | ||
<Left>baseline/netstandard2.0/Avalonia.Win32.dll</Left> | ||
<Right>target/netstandard2.0/Avalonia.Win32.dll</Right> | ||
</Suppression> | ||
<Suppression> | ||
<DiagnosticId>CP0001</DiagnosticId> | ||
<Target>T:Avalonia.Win32.Interop.Automation.SynchronizedInputType</Target> | ||
<Left>baseline/netstandard2.0/Avalonia.Win32.dll</Left> | ||
<Right>target/netstandard2.0/Avalonia.Win32.dll</Right> | ||
</Suppression> | ||
<Suppression> | ||
<DiagnosticId>CP0001</DiagnosticId> | ||
<Target>T:Avalonia.Win32.Interop.Automation.TextPatternRangeEndpoint</Target> | ||
<Left>baseline/netstandard2.0/Avalonia.Win32.dll</Left> | ||
<Right>target/netstandard2.0/Avalonia.Win32.dll</Right> | ||
</Suppression> | ||
<Suppression> | ||
<DiagnosticId>CP0001</DiagnosticId> | ||
<Target>T:Avalonia.Win32.Interop.Automation.TextUnit</Target> | ||
<Left>baseline/netstandard2.0/Avalonia.Win32.dll</Left> | ||
<Right>target/netstandard2.0/Avalonia.Win32.dll</Right> | ||
</Suppression> | ||
<Suppression> | ||
<DiagnosticId>CP0001</DiagnosticId> | ||
<Target>T:Avalonia.Win32.Interop.Automation.WindowInteractionState</Target> | ||
<Left>baseline/netstandard2.0/Avalonia.Win32.dll</Left> | ||
<Right>target/netstandard2.0/Avalonia.Win32.dll</Right> | ||
</Suppression> | ||
<Suppression> | ||
<DiagnosticId>CP0001</DiagnosticId> | ||
<Target>T:Avalonia.Win32.Interop.Automation.WindowVisualState</Target> | ||
<Left>baseline/netstandard2.0/Avalonia.Win32.dll</Left> | ||
<Right>target/netstandard2.0/Avalonia.Win32.dll</Right> | ||
</Suppression> | ||
</Suppressions> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 3 additions & 3 deletions
6
...tomation/AutomationNode.ExpandCollapse.cs → ...tomation/AutomationNode.ExpandCollapse.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
src/Windows/Avalonia.Win32.Automation/AutomationNode.RangeValue.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
using Avalonia.Automation.Provider; | ||
using UIA = Avalonia.Win32.Automation.Interop; | ||
|
||
namespace Avalonia.Win32.Automation | ||
{ | ||
internal partial class AutomationNode : UIA.IRangeValueProvider | ||
{ | ||
double UIA.IRangeValueProvider.GetValue() => InvokeSync<IRangeValueProvider, double>(x => x.Value); | ||
bool UIA.IRangeValueProvider.GetIsReadOnly() => InvokeSync<IRangeValueProvider, bool>(x => x.IsReadOnly); | ||
double UIA.IRangeValueProvider.GetMaximum() => InvokeSync<IRangeValueProvider, double>(x => x.Maximum); | ||
double UIA.IRangeValueProvider.GetMinimum() => InvokeSync<IRangeValueProvider, double>(x => x.Minimum); | ||
double UIA.IRangeValueProvider.GetLargeChange() => 1; | ||
double UIA.IRangeValueProvider.GetSmallChange() => 1; | ||
|
||
public void SetValue(double value) => InvokeSync<IRangeValueProvider>(x => x.SetValue(value)); | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
src/Windows/Avalonia.Win32.Automation/AutomationNode.Scroll.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
using Avalonia.Automation.Provider; | ||
using UIA = Avalonia.Win32.Automation.Interop; | ||
|
||
namespace Avalonia.Win32.Automation | ||
{ | ||
internal partial class AutomationNode : UIA.IScrollProvider, UIA.IScrollItemProvider | ||
{ | ||
bool UIA.IScrollProvider.GetHorizontallyScrollable() => InvokeSync<IScrollProvider, bool>(x => x.HorizontallyScrollable); | ||
double UIA.IScrollProvider.GetHorizontalScrollPercent() => InvokeSync<IScrollProvider, double>(x => x.HorizontalScrollPercent); | ||
double UIA.IScrollProvider.GetHorizontalViewSize() => InvokeSync<IScrollProvider, double>(x => x.HorizontalViewSize); | ||
bool UIA.IScrollProvider.GetVerticallyScrollable() => InvokeSync<IScrollProvider, bool>(x => x.VerticallyScrollable); | ||
double UIA.IScrollProvider.GetVerticalScrollPercent() => InvokeSync<IScrollProvider, double>(x => x.VerticalScrollPercent); | ||
double UIA.IScrollProvider.GetVerticalViewSize() => InvokeSync<IScrollProvider, double>(x => x.VerticalViewSize); | ||
|
||
void UIA.IScrollProvider.Scroll(ScrollAmount horizontalAmount, ScrollAmount verticalAmount) | ||
{ | ||
InvokeSync<IScrollProvider>(x => x.Scroll(horizontalAmount, verticalAmount)); | ||
} | ||
|
||
void UIA.IScrollProvider.SetScrollPercent(double horizontalPercent, double verticalPercent) | ||
{ | ||
InvokeSync<IScrollProvider>(x => x.SetScrollPercent(horizontalPercent, verticalPercent)); | ||
} | ||
|
||
void UIA.IScrollItemProvider.ScrollIntoView() | ||
{ | ||
InvokeSync(() => Peer.BringIntoView()); | ||
} | ||
} | ||
} |
Oops, something went wrong.