{"window:lower", A11yEvent::EVENT_WINDOW_LOWER},
{"window:resize", A11yEvent::EVENT_WINDOW_RESIZE},
{"window:move", A11yEvent::EVENT_WINDOW_MOVE},
- {"window:renderpost", A11yEvent::EVENT_WINDOW_RENDER_POST},
+ {"window:post-render", A11yEvent::EVENT_WINDOW_RENDER_POST},
{"object:text-changed:insert", A11yEvent::EVENT_TEXT_CHANGED_INSERT},
{"object:text-changed:delete", A11yEvent::EVENT_TEXT_CHANGED_DELETE},
{"object:state-changed:VISIBLE", A11yEvent::EVENT_STATE_CHANGED_VISIBLE},
GThread *AtspiAccessibleWatcher::mTimerThread = nullptr;
std::chrono::system_clock::time_point AtspiAccessibleWatcher::mStartTime;
IdleEventState AtspiAccessibleWatcher::isIdle = IdleEventState::IDLE_LISTEN_READY;
-static const unsigned int WAIT_FOR_IDLE_MILLI_SEC = 3000; // 3sec
+static const unsigned int WAIT_FOR_IDLE_MILLI_SEC = 1000; // 1sec
int AtspiAccessibleWatcher::mRenderCount = 10;
static bool iShowingNode(AtspiAccessible *node)
return NULL;
}
+void AtspiAccessibleWatcher::processCallback(char *type, char *name, char *pkg)
+{
+ mMutex.lock();
+ auto a11yEvent = std::make_shared<A11yEventInfo>(std::string(type), std::string(name), std::string(pkg));
+ mEventQueue.push_back(a11yEvent);
+ mMutex.unlock();
+
+ if (this->mHandlers.count(a11yEvent->getEvent())) {
+ auto &list = this->mHandlers[a11yEvent->getEvent()];
+ auto it = list.begin();
+
+ while (it != list.end())
+ {
+ LOGI("Callback call type %s pkg %s", type, pkg);
+ auto handler = *it;
+ bool res = (*handler)(std::string(pkg));
+ if (!res) it = list.erase(it);
+ else ++it;
+ }
+ }
+
+}
+
void AtspiAccessibleWatcher::onAtspiEvents(AtspiEvent *event, void *watcher)
{
if (!event->source)
if (name) free(name);
return;
}
+ else if (isIdle == IdleEventState::IDLE_LISTEN_DONE && !strncmp(event->type, "window:post-render", 18))
+ return;
AtspiAccessible *app = AtspiWrapper::Atspi_accessible_get_application(event->source, NULL);
if (name && app)
else
pkg = strdup("");
- mMutex.lock();
- auto a11yEvent = std::make_shared<A11yEventInfo>(std::string(event->type), std::string(name), std::string(pkg));
- mEventQueue.push_back(a11yEvent);
- mMutex.unlock();
-
- if (instance->mHandlers.count(a11yEvent->getEvent())) {
- auto &list = instance->mHandlers[a11yEvent->getEvent()];
- auto it = list.begin();
-
- while (it != list.end())
- {
- LOGI("Callback call type %s pkg %s", event->type, pkg);
- auto handler = *it;
- bool res = (*handler)(std::string(pkg));
- if (!res) it = list.erase(it);
- else ++it;
- }
- }
+ instance->processCallback(event->type, name, pkg);
if (!strcmp(event->type, "object:state-changed:defunct")) {
instance->onObjectDefunct(
if (isIdle == IdleEventState::IDLE_LISTEN_DONE)
{
isIdle = IdleEventState::IDLE_LISTEN_READY;
+ processCallback((char *)"window:post-render", (char *)"", (char *)"");
return true;
} else
{