Skip to content

Commit

Permalink
Remove the Uia backend.
Browse files Browse the repository at this point in the history
While the new Win32 backend isn't nearly as featured as the Uia
backend, I don't feel that it's worth maintaining further, and I
may as well remove it while no one is using it.

This enables getting rid of a lot of dependencies.
  • Loading branch information
madewokherd committed Mar 4, 2024
1 parent da1cae6 commit 74f5e96
Show file tree
Hide file tree
Showing 19 changed files with 75 additions and 5,311 deletions.
69 changes: 65 additions & 4 deletions xalia/Interop/Win32.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#if WINDOWS
using Interop.UIAutomationClient;
using Microsoft.Win32.SafeHandles;
using System;
using System.Collections.Generic;
Expand Down Expand Up @@ -350,15 +349,15 @@ public static extern IntPtr SetWinEventHook(uint eventMin, uint eventMax, IntPtr
public const int NAVDIR_FIRSTCHILD = 7;
public const int NAVDIR_LASTCHILD = 8;

public static bool AccessibleNavigate(ref Accessibility.IAccessible acc, ref int child_id, int navdir)
public static bool AccessibleNavigate(ref IAccessible acc, ref int child_id, int navdir)
{
var result = acc.accNavigate(navdir, child_id);
if (result is null)
return false;
if (result is int i)
child_id = i;
else
acc = (Accessibility.IAccessible)result;
acc = (IAccessible)result;
return true;
}

Expand All @@ -369,7 +368,7 @@ public static extern int AccessibleObjectFromEvent(IntPtr hwnd, int dwId, int dw

[DllImport(OLEACC_LIB, CallingConvention = CallingConvention.Winapi)]
public static extern int ObjectFromLresult(IntPtr lResult,
[MarshalAs(UnmanagedType.LPStruct)] Guid riid, IntPtr wParam, out Accessibility.IAccessible ppvObject);
[MarshalAs(UnmanagedType.LPStruct)] Guid riid, IntPtr wParam, out IAccessible ppvObject);

[ComImport, Guid("6d5140c1-7436-11ce-8034-00aa006009fa")]
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
Expand Down Expand Up @@ -397,6 +396,68 @@ public struct IA2Locale
[MarshalAs(UnmanagedType.BStr)] public string variant;
}

[ComImport, Guid("618736e0-3c3d-11cf-810c-00aa00389b71")]
[InterfaceType(ComInterfaceType.InterfaceIsDual)]
public interface IAccessible
{
// IAccessible methods
[return: MarshalAs(UnmanagedType.IDispatch)]
object get_accParent();

int get_accChildCount();

[return: MarshalAs(UnmanagedType.IDispatch)]
object get_accChild([MarshalAs(UnmanagedType.Struct)] object varChildId);

[return: MarshalAs(UnmanagedType.BStr)]
string get_accName([MarshalAs(UnmanagedType.Struct)] object varID);

[return: MarshalAs(UnmanagedType.BStr)]
string get_accValue([MarshalAs(UnmanagedType.Struct)] object varID);

[return: MarshalAs(UnmanagedType.BStr)]
string get_accDescription([MarshalAs(UnmanagedType.Struct)] object varID);

[return: MarshalAs(UnmanagedType.Struct)]
object get_accRole([MarshalAs(UnmanagedType.Struct)] object varID);

[return: MarshalAs(UnmanagedType.Struct)]
object get_accState([MarshalAs(UnmanagedType.Struct)] object varID);

[return: MarshalAs(UnmanagedType.BStr)]
string get_accHelp([MarshalAs(UnmanagedType.Struct)] object varID);

long get_accHelpTopic([MarshalAs(UnmanagedType.BStr)] out string helpfile, [MarshalAs(UnmanagedType.Struct)] object varID);

[return: MarshalAs(UnmanagedType.BStr)]
string get_accKeyboardShortcut([MarshalAs(UnmanagedType.Struct)] object varID);

[return: MarshalAs(UnmanagedType.Struct)]
object get_accFocus();

[return: MarshalAs(UnmanagedType.Struct)]
object get_accSelection();

[return: MarshalAs(UnmanagedType.BStr)]
string get_accDefaultAction([MarshalAs(UnmanagedType.Struct)] object varID);

void accSelect(long flagsSelect, [MarshalAs(UnmanagedType.Struct)] object varID);

void accLocation(out int left, out int top, out int width, out int height, [MarshalAs(UnmanagedType.Struct)] object varID);

[return: MarshalAs(UnmanagedType.Struct)]
object accNavigate(long dir, [MarshalAs(UnmanagedType.Struct)] object varStart);

[return: MarshalAs(UnmanagedType.Struct)]
object accHitTest(long left, long top);

void accDoDefaultAction([MarshalAs(UnmanagedType.Struct)] object varID);

void set_accName([MarshalAs(UnmanagedType.Struct)] object varID, [MarshalAs(UnmanagedType.BStr)] string name);

void set_accValue([MarshalAs(UnmanagedType.Struct)] object varID, [MarshalAs(UnmanagedType.BStr)] string value);
}

[ComImport, Guid("e89f726e-c4f4-4c19-bb19-b647d7fa8478")]
[InterfaceType(ComInterfaceType.InterfaceIsDual)]
public interface IAccessible2
Expand Down
17 changes: 1 addition & 16 deletions xalia/MainClass.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@
using Xalia.Gudl;
using Xalia.Ui;
using Xalia.UiDom;
#if WINDOWS
using Xalia.Uia;
#endif
using Xalia.Sdl;

using static SDL2.SDL;
Expand Down Expand Up @@ -58,23 +55,11 @@ static async Task Init(GudlStatement[] config)

#if WINDOWS
if (connection == null &&
((Environment.GetEnvironmentVariable("XALIA_EXPERIMENTAL_WIN32") ?? "0") != "0"))
((Environment.GetEnvironmentVariable("XALIA_USE_WIN32") ?? (Utils.IsWindows() ? "1" : "0")) != "0"))
{
connection = new UiDomRoot(config, application);
new Win32Connection(connection);
}

if (connection == null &&
(Environment.GetEnvironmentVariable("XALIA_USE_UIA2") ?? "0") != "0")
{
connection = new UiaConnection(false, config, application);
}

if (connection == null &&
(Environment.GetEnvironmentVariable("XALIA_USE_UIA3") ?? (Utils.IsWindows() ? "1" : "0")) != "0")
{
connection = new UiaConnection(true, config, application);
}
#endif

if (connection == null)
Expand Down
123 changes: 0 additions & 123 deletions xalia/Uia/UiaAdjustScrollContainer.cs

This file was deleted.

Loading

0 comments on commit 74f5e96

Please sign in to comment.