libaurum: Support EVENT_WINDOW_RENDER_POST event for application 93/292693/1
authorWoochan Lee <wc0917.lee@samsung.com>
Thu, 11 May 2023 09:18:16 +0000 (18:18 +0900)
committerWoochan Lee <wc0917.lee@samsung.com>
Thu, 11 May 2023 09:20:21 +0000 (18:20 +0900)
Signed-off-by: Woochan Lee <wc0917.lee@samsung.com>
Change-Id: I56fee29e6ae23175cc205e83841e28371eea1ebb

libaurum/inc/Impl/Accessibility/AtspiAccessibleWatcher.h
libaurum/src/A11yEvent.cc
libaurum/src/Impl/Accessibility/AtspiAccessibleWatcher.cc
libaurum/src/Impl/TizenDeviceImpl.cc

index cefbf64..e827d95 100644 (file)
@@ -173,6 +173,7 @@ private:
     void appendApp(AtspiAccessibleWatcher *instance, AtspiAccessible *app, char *pkg);
     void removeApp(AtspiAccessibleWatcher *instance, AtspiAccessible *app, char *pkg);
     void setXMLsync();
+    void processCallback(char *type, char *name, char *pkg);
 
 private:
     GDBusProxy *mDbusProxy;
index f594804..42053af 100644 (file)
@@ -51,7 +51,7 @@ static std::unordered_map<std::string,A11yEvent> const table = { {"window:create
                                                                                                                                 {"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},
index 9774412..0eba532 100644 (file)
@@ -42,7 +42,7 @@ GMainLoop *AtspiAccessibleWatcher::mLoop = nullptr;
 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)
@@ -248,6 +248,29 @@ gpointer AtspiAccessibleWatcher::timerThread(gpointer data)
     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)
@@ -280,6 +303,8 @@ void AtspiAccessibleWatcher::onAtspiEvents(AtspiEvent *event, void *watcher)
         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)
@@ -300,24 +325,7 @@ void AtspiAccessibleWatcher::onAtspiEvents(AtspiEvent *event, void *watcher)
     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(
@@ -431,6 +439,7 @@ bool AtspiAccessibleWatcher::executeAndWaitForEvents(const Runnable *cmd, const
         if (isIdle == IdleEventState::IDLE_LISTEN_DONE)
         {
             isIdle = IdleEventState::IDLE_LISTEN_READY;
+            processCallback((char *)"window:post-render", (char *)"", (char *)"");
             return true;
         } else
         {
index a9ef8ad..768b63b 100644 (file)
@@ -247,6 +247,7 @@ bool TizenDeviceImpl::pressPower(KeyRequestType type)
 
 bool TizenDeviceImpl::pressKeyCode(std::string keycode, KeyRequestType type)
 {
+    LOGI("pressKeyCode(%s)", keycode.c_str());
     if (type == KeyRequestType::STROKE)
         return strokeKeyCode(keycode, INTV_SHORTSTROKE);
     else if (type == KeyRequestType::LONG_STROKE)