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

Added a (very) basic tree walking functionality for Mac #49

Merged
merged 8 commits into from
Jan 23, 2024
Merged

Conversation

alice
Copy link
Collaborator

@alice alice commented Jan 18, 2024

No description provided.

Copy link
Collaborator

@spectranaut spectranaut left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This all looks good and works for me! A few questions, and I wonder about next steps


%include <std_unique_ptr.i>
%unique_ptr(mac_inspect::AXAPINode)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wow was this move necessary to get this to work? you mentioned you were having trouble with the shared pointer

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmmm, I thought it was, but I just moved it back, and it still worked. It looks like the actual fix was prefixing AXAPINode with mac_inspect:: in the %unique_ptr macro.

chars = ns_chars ? ns_chars : "";
}
return std::string(chars);
}

AXAPINode::AXAPINode(AXUIElementRef ax_element) : ax_element_(ax_element) {}
AXAPINode::AXAPINode(AXUIElementRef ax_ui_element)
: ax_ui_element_(ax_ui_element) {}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just curious the motivation for this name change?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just making it match the platform type name more closely, because I was confusing myself :)

(AXUIElementRef)CFArrayGetValueAtIndex(children_ref, index);
if (!child_ref)
return nullptr;
return AXAPINodePtr(new AXAPINode(child_ref));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So I think all of these helper functions, ultimately, might only be implemented in AxapiNodeImpl, like the AtspiNodeImpl: https://github.com/Igalia/AXAccess/pull/43/files#diff-3d31a27d5b501604330a8b1dd58434d1a6848428ec6b28afdefc85002e1e439b

And ultimately a goal for the test suite is to surface AXUIElementCopyAttributeValue almost directly, in order to test?

I wonder if the next step is to for you to copy the outline presented in Edu's PR?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also I wonder if "GetChildCount" and "GetChildAt" are the right abstractions for the "cross platform" part of the API.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[...] And ultimately a goal for the test suite is to surface AXUIElementCopyAttributeValue almost directly, in order to test?

Yeah, makes sense!

I wonder if the next step is to for you to copy the outline presented in Edu's PR?

Yeah, once that change lands I can work on making the Mac version of NodeImpl, moving these functions over there and making this a much thinner wrapper around the Mac APIs.

Also I wonder if "GetChildCount" and "GetChildAt" are the right abstractions for the "cross platform" part of the API.

Yeah, good question. Do you think potentially returning a std::vector<NodePtr> might be more ergonomic?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It just seems to make more sense from a scripting language perspective. We can change it at a future time!

@spectranaut spectranaut merged commit 10e059f into main Jan 23, 2024
@alice alice deleted the mac_tree branch February 1, 2024 03:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants