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

Client-side support for new UIA events #4898

Merged
merged 2 commits into from
Jul 23, 2021
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
Original file line number Diff line number Diff line change
Expand Up @@ -308,8 +308,9 @@ internal ITextRangeProvider TextRangeFromTextPointers(ITextPointer rangeStart, I
rangeEnd = rangeStart;
}

// return the resulting range
return new TextRangeAdaptor(this, rangeStart, rangeEnd, _textPeer);
// return the resulting range, wrapped so that it's ready for use by UIA
ITextRangeProvider textRange = new TextRangeAdaptor(this, rangeStart, rangeEnd, _textPeer);
return TextRangeProviderWrapper.WrapArgument(textRange, _textPeer);
}

#endregion Internal Methods
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -689,6 +689,19 @@ internal static AutomationEventArgs GetUiaEventArgs(IntPtr argsAddr)
int[] runtimeId = ArrayFromIntPtr(wcargs._pRuntimeId, wcargs._cRuntimeIdLen);
return new WindowClosedEventArgs(runtimeId);
}

case EventArgsType.Notification:
{
UiaNotificationEventArgs nargs = (UiaNotificationEventArgs)Marshal.PtrToStructure(argsAddr, typeof(UiaNotificationEventArgs));
return new NotificationEventArgs(nargs._notificationKind, nargs._notificationProcessing,
Marshal.PtrToStringUni(nargs._displayString), Marshal.PtrToStringUni(nargs._activityId));
}

case EventArgsType.ActiveTextPositionChanged:
{
UiaActiveTextPositionChangedEventArgs atpcargs = (UiaActiveTextPositionChangedEventArgs)Marshal.PtrToStructure(argsAddr, typeof(UiaActiveTextPositionChangedEventArgs));
return new ActiveTextPositionChangedEventArgs(atpcargs._textRange);
}
}

Debug.Assert(false, "Unknown event type from core:" + args._type);
Expand Down Expand Up @@ -1448,7 +1461,11 @@ private enum EventArgsType
PropertyChanged,
StructureChanged,
AsyncContentLoaded,
WindowClosed
WindowClosed,
TextEditTextChanged,
Changes,
Notification,
ActiveTextPositionChanged
}

[StructLayout(LayoutKind.Sequential)]
Expand Down Expand Up @@ -1498,6 +1515,25 @@ private struct UiaWindowClosedEventArgs
internal int _cRuntimeIdLen;
}

[StructLayout(LayoutKind.Sequential)]
private struct UiaNotificationEventArgs
{
internal EventArgsType _type;
internal int _eventId;
internal AutomationNotificationKind _notificationKind;
internal AutomationNotificationProcessing _notificationProcessing;
internal IntPtr _displayString;
internal IntPtr _activityId;
}

[StructLayout(LayoutKind.Sequential)]
private struct UiaActiveTextPositionChangedEventArgs
{
internal EventArgsType _type;
internal int _eventId;
internal ITextRangeProvider _textRange;
}

#endregion Private types

//------------------------------------------------------
Expand Down