* @see ScreenScannerManager
* @see ScanningProperties
*/
+
+void PointScanner::getAtPoint(const std::shared_ptr<NavigationElement> &root, Point pt, std::function<void(Optional<std::shared_ptr<UIElement>>)> callback)
+{
+ auto elem = root->getAtPoint(pt);
+ if (elem) {
+ auto atspi = Singleton<UniversalSwitch>::instance().getAtspi();
+ auto application = elem->getApplicationCategory();
+ atspi->getAtPoint(pt, Atspi::CoordType::Screen, elem->getVisibleRoot(),
+ [ = ](DBus::ValueOrError<std::shared_ptr<AtspiAccessible>> elem) {
+ auto uiElem = std::make_shared<UIElement>(elem ? std::move(std::get<0>(elem)) : nullptr, pt, application);
+ callback(std::move(uiElem));
+ });
+ } else {
+ auto uiElem = std::make_shared<UIElement>(nullptr, pt, UIElement::ApplicationCategory::OTHER);
+ callback(std::move(uiElem));
+ }
+}
+
class PointScannerImpl : public ScreenScanner
{
public:
state = State::END;
DEBUG("Scanning complete");
- {
- auto elem = rootNavigationElement->getAtPoint(intersectionPoint);
- if (elem) {
- auto atspi = Singleton<UniversalSwitch>::instance().getAtspi();
- auto application = elem->getApplicationCategory();
- atspi->getAtPoint(intersectionPoint, Atspi::CoordType::Screen, elem->getVisibleRoot(),
- [ = ](DBus::ValueOrError<std::shared_ptr<AtspiAccessible>> elem) {
- auto uiElem = std::make_shared<UIElement>(elem ? std::move(std::get<0>(elem)) : nullptr, intersectionPoint, application);
- callback(std::move(uiElem));
- });
- } else {
- auto uiElem = std::make_shared<UIElement>(nullptr, intersectionPoint, UIElement::ApplicationCategory::OTHER);
- callback(std::move(uiElem));
- }
- }
+ PointScanner::getAtPoint(rootNavigationElement, intersectionPoint, std::move(callback));
return;
case State::END: