h->root = std::move(root);
h->keyboardRoot = std::move(keyboardRoot);
h->rootName = std::move(name);
+ h->rootAddress = h->root ? Atspi::getUniqueId(h->root->getObject()) : "";
};
updateContextInfo(nav->getCurrentVisibleRoot(), nav->getCurrentKeyboardVisibleRoot(), nav->getCurrentNavigationContext());
contextChangedHandle = nav->registerCb<NavigationCallbackType::ContextChanged>(std::move(updateContextInfo));
auto generateWheelTurnFunction = [&]() {
return EvaluationValueFunction{ [&](bool clockwise, int multiplicity) -> EvaluationValue {
- if (multiplicity <= 0)
- throw EvaluationFailure{} << "Invalid multiplicity (must be more that 0)";
+ if (multiplicity <= 0)
+ throw EvaluationFailure{} << "Invalid multiplicity (must be more that 0)";
- auto delay = multiplicity > 1 ? 0.75 : 0;
+ auto delay = multiplicity > 1 ? 0.75 : 0;
- executeOnMainThread([&]()
- {
- utils::generateWheelTurn(clockwise, multiplicity, delay);
- });
+ executeOnMainThread([&]()
+ {
+ utils::generateWheelTurn(clockwise, multiplicity, delay);
+ });
- int await = 1000 * (multiplicity * delay);
- std::this_thread::sleep_for(std::chrono::milliseconds{ await });
+ int await = 1000 * (multiplicity * delay);
+ std::this_thread::sleep_for(std::chrono::milliseconds{ await });
- return EvaluationValue{};
- }, { {"clockwise", true}, {"multiplicity", 1} } };
+ return EvaluationValue{};
+ }, { {"clockwise", true}, {"multiplicity", 1} } };
};
variables["TURN_WHEEL"] = generateWheelTurnFunction();
}
{
auto h = self->contextInfo.lock();
this->currentContextName = h->rootName;
+ this->currentContextAddress = h->rootAddress;
}
private:
void prepare() override
{
auto h = self->contextInfo.lock();
currentContextName = h->rootName;
+ currentContextAddress = h->rootAddress;
}
void joinImpl() override
{
auto h = self->contextInfo.lock();
auto pred = [&]() {
- if (currentContextName != h->rootName) {
- self->outputStream() << "context name changed from '" << currentContextName << "', to '" << h->rootName << "'\n";
+ if (currentContextAddress != h->rootAddress) {
+ self->outputStream() << "context name changed from " <<
+ "'" << currentContextName << "' (" << currentContextAddress << "), to " <<
+ "'" << h->rootName << "' (" << h->rootAddress << "), while looking for '" << name << "'\n";
currentContextName = h->rootName;
- if (name.empty()) {
+ currentContextAddress = h->rootAddress;
+ if (name.empty())
return true;
- }
}
return !name.empty() && name == h->rootName;
};
}
std::string name, currentContextName;
+ std::string currentContextAddress;
};
void BatchExecutor::insertWaits()