libaurum: Introduce new moveTo API 45/309845/4
authorHosang Kim <hosang12.kim@samsung.com>
Wed, 17 Apr 2024 07:22:15 +0000 (16:22 +0900)
committerHosang Kim <hosang12.kim@samsung.com>
Mon, 22 Apr 2024 07:24:48 +0000 (16:24 +0900)
Change-Id: I5eed0a5290d1a0252bc168efd0be85563f235526

16 files changed:
libaurum/inc/Accessibility/AccessibleNode.h
libaurum/inc/Impl/Accessibility/AtspiAccessibleNode.h
libaurum/inc/Impl/Accessibility/AtspiWrapper.h
libaurum/inc/Impl/Accessibility/MockAccessibleNode.h
libaurum/inc/UiObject.h
libaurum/src/Impl/Accessibility/AtspiAccessibleNode.cc
libaurum/src/Impl/Accessibility/AtspiWrapper.cc
libaurum/src/Impl/Accessibility/MockAccessibleNode.cc
libaurum/src/UiObject.cc
org.tizen.aurum-bootstrap/inc/AurumServiceImpl.h
org.tizen.aurum-bootstrap/inc/Commands/Commands.h
org.tizen.aurum-bootstrap/inc/Commands/MoveToCommand.h [new file with mode: 0644]
org.tizen.aurum-bootstrap/meson.build
org.tizen.aurum-bootstrap/src/AurumServiceImpl.cc
org.tizen.aurum-bootstrap/src/Commands/MoveToCommand.cc [new file with mode: 0644]
protocol/aurum.proto

index 3dcc22f76c4e289b0ba47cd5cbf4ad778ec68a46..9a8766d3c2516d77a99a936173b75c07e7bc2194 100644 (file)
@@ -465,6 +465,11 @@ public:
      */
     virtual bool setFocus() = 0;
 
+    /**
+     * @copydoc UiObject::moveTo()
+     */
+    virtual bool moveTo() = 0;
+
     /**
      * @copydoc UIObject::updateTextMinBoundingRect()
      */
index 43d20f66c4adb3ad655a816c30b7162ac119d74d..33d03d2b5f079420b43660f247358c332a7b21ee 100644 (file)
@@ -161,6 +161,11 @@ public:
      */
     bool setFocus() override;
 
+    /**
+     * @copydoc UiObject::moveTo()
+     */
+    bool moveTo() override;
+
     /**
      * @copydoc AccessibleNode::refresh()
      */
index 6e84b2a488b521b44480c27dff3cf8788a0347e4..38022ea09b526bfe05cb294013f8b8d685de29f0 100644 (file)
@@ -61,6 +61,7 @@ public:
     static AtspiAccessible *Atspi_accessible_get_application (AtspiAccessible *node, GError **error);
     static void Atspi_accessible_clear_cache (AtspiAccessible *node);
     static gboolean Atspi_component_grab_focus(AtspiComponent *obj, GError **error);
+    static gboolean Atspi_component_grab_highlight(AtspiComponent *obj, GError **error);
     static void Atspi_accessible_set_cache_mask(AtspiAccessible *node, AtspiCache mask);
     static AtspiValue *Atspi_accessible_get_value(AtspiAccessible *node);
     static gdouble Atspi_value_get_minimum_value(AtspiValue *iface, GError **error);
index 4f2d02d58e38439434f165a8bb335f0454410142..8c137104ca3d122e0ec44f1a6d07933ba7425e07 100644 (file)
@@ -163,6 +163,12 @@ public:
      */
     bool setFocus() override;
 
+    /**
+     * @brief TBD
+     * @since_tizen 9.0
+     */
+    bool moveTo() override;
+
     /**
      * @brief TBD
      * @since_tizen 7.0
index f9904bdcc11827e6d3dece768d45c76e48be4fa9..51f58a948d3886e3d3fcbdfad523c3524ceb753b 100644 (file)
@@ -691,6 +691,13 @@ public:
      */
     bool setFocus() const;
 
+    /**
+     * @brief Moves to object.
+     *
+     * @since_tizen 9.0
+     */
+    bool moveTo() const;
+
     /**
      * @brief Updates object's information from atspi server.
      *
index 29ff6dce2d230844172b2146c1249ca5c876a993..451946b97d606c37f0e5429cd6bfc30700e59e64 100644 (file)
@@ -340,6 +340,18 @@ bool AtspiAccessibleNode::setFocus()
         return false;
 }
 
+bool AtspiAccessibleNode::moveTo()
+{
+    AtspiComponent *component = AtspiWrapper::Atspi_accessible_get_component_iface(mNode);
+    if (component) {
+        bool ret = AtspiWrapper::Atspi_component_grab_highlight(component, NULL);
+        g_object_unref(component);
+        return ret;
+    }
+    else
+        return false;
+}
+
 void AtspiAccessibleNode::refresh(bool updateAll)
 {
     AtspiWrapper::Atspi_accessible_clear_cache(mNode);
index f18867df9c33947eb0b93540d3ba0ca68ce20cd0..d1b3b62b4815bed0a52ff7fadf4c5fbcb783c93c 100644 (file)
@@ -177,6 +177,12 @@ gboolean AtspiWrapper::Atspi_component_grab_focus(AtspiComponent *obj, GError **
     return atspi_component_grab_focus(obj, error);
 }
 
+gboolean AtspiWrapper::Atspi_component_grab_highlight(AtspiComponent *obj, GError **error)
+{
+    std::unique_lock<std::recursive_mutex> lock(mMutex);
+    return atspi_component_grab_highlight(obj, error);
+}
+
 void AtspiWrapper::Atspi_accessible_set_cache_mask(AtspiAccessible *node, AtspiCache mask)
 {
     std::unique_lock<std::recursive_mutex> lock(mMutex);
index df9bd223619b8368a4df923d0a4fea989341d051..e8aa1d51aeee7e4d01e58b900137153c94d18ff3 100644 (file)
@@ -198,6 +198,11 @@ bool MockAccessibleNode::setFocus()
     return false;
 }
 
+bool MockAccessibleNode::moveTo()
+{
+    return false;
+}
+
 void MockAccessibleNode::updateTextMinBoundingRect()
 {
 }
index 4b200c2412e1f482954bfc4e985e2a8ca0e347af..a1f6e0c29b25dc84ba9326c0c30d5bd62b2ee5d7 100644 (file)
@@ -442,6 +442,11 @@ bool UiObject::setFocus() const
     return mNode->setFocus();
 }
 
+bool UiObject::moveTo() const
+{
+    return mNode->moveTo();
+}
+
 bool UiObject::isValid() const
 {
     return mNode->isValid();
index dc7a6ce554f69db6dd9ca057714081bdce7952e3..04159cc00536f4bdb4dfcbff561d35ec373825f5 100644 (file)
@@ -132,6 +132,9 @@ public:
     ::grpc::Status getAngle(::grpc::ServerContext *context,
                             const ::aurum::ReqGetAngle *request,
                             ::aurum::RspGetAngle *response) override;
+    ::grpc::Status moveTo(::grpc::ServerContext *context,
+                            const ::aurum::ReqMoveTo *request,
+                            ::aurum::RspMoveTo *response) override;
 public:
     int WAIT_TIMEOUT_MS;
 };
index a98c138a51d932629e8092cfb653026f141c5cbe..bedd09687b5773a90933ce2cfeb7852ef6adbc69 100644 (file)
@@ -42,6 +42,7 @@
 #include "Commands/GetScreenSizeCommand.h"
 #include "Commands/ActionAndWaitEventCommand.h"
 #include "Commands/SetFocusCommand.h"
+#include "Commands/MoveToCommand.h"
 #include "Commands/GetActiveAppToolkitNameCommand.h"
 #include "Commands/GetTextMinBoundingRectCommand.h"
 #include "Commands/SetXMLSyncCommand.h"
diff --git a/org.tizen.aurum-bootstrap/inc/Commands/MoveToCommand.h b/org.tizen.aurum-bootstrap/inc/Commands/MoveToCommand.h
new file mode 100644 (file)
index 0000000..40d96cf
--- /dev/null
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2023 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *               http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+
+#include "bootstrap.h"
+
+class MoveToCommand : public Command {
+private:
+    const ::aurum::ReqMoveTo *mRequest;
+    ::aurum::RspMoveTo *mResponse;
+
+public:
+    MoveToCommand(const ::aurum::ReqMoveTo *request,
+                   ::aurum::RspMoveTo *response);
+    ::grpc::Status execute() override;
+};
index eb3876b8fe33d5caae873dd0a379a336bbcc12fe..9a9b29b5d141c056826585c64e30bf9528bfcf21 100644 (file)
@@ -45,6 +45,7 @@ bootstrap_svr_src += [
    files('src/Commands/GetScreenSizeCommand.cc'),
    files('src/Commands/ActionAndWaitEventCommand.cc'),
    files('src/Commands/SetFocusCommand.cc'),
+   files('src/Commands/MoveToCommand.cc'),
    files('src/Commands/GetActiveAppToolkitNameCommand.cc'),
    files('src/Commands/GetTextMinBoundingRectCommand.cc'),
    files('src/Commands/SetXMLSyncCommand.cc'),
index ad9aa135715e296284da7ede13ff50d509573970..1b3fa2f105bdaef48dd316ea8b9c064b2c46bb8a 100644 (file)
@@ -303,4 +303,12 @@ aurumServiceImpl::~aurumServiceImpl()
 {
     std::unique_ptr<GetAngleCommand> cmd = std::make_unique<GetAngleCommand>(request, response);
     return execute(cmd.get(), true);
+}
+
+::grpc::Status aurumServiceImpl::moveTo(::grpc::ServerContext *context,
+                                         const ::aurum::ReqMoveTo *request,
+                                         ::aurum::RspMoveTo *response)
+{
+    std::unique_ptr<MoveToCommand> cmd = std::make_unique<MoveToCommand>(request, response);
+    return execute(cmd.get(), true);
 }
\ No newline at end of file
diff --git a/org.tizen.aurum-bootstrap/src/Commands/MoveToCommand.cc b/org.tizen.aurum-bootstrap/src/Commands/MoveToCommand.cc
new file mode 100644 (file)
index 0000000..6503639
--- /dev/null
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2023 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *               http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+
+#include "MoveToCommand.h"
+#include "UiObject.h"
+
+MoveToCommand::MoveToCommand(const ::aurum::ReqMoveTo *request,
+                               ::aurum::RspMoveTo *response)
+    : mRequest{request}, mResponse{response}
+{
+}
+
+::grpc::Status MoveToCommand::execute()
+{
+    LOGI("MoveTo --------------- ");
+
+    bool ret = false;
+
+    ObjectMapper *mObjMap = ObjectMapper::getInstance();
+    std::shared_ptr<UiObject> obj = mObjMap->getElement(mRequest->elementid());
+    if (obj) ret = obj->moveTo();
+
+    if (ret) mResponse->set_status(::aurum::RspStatus::OK);
+    else mResponse->set_status(::aurum::RspStatus::ERROR);
+
+    return grpc::Status::OK;
+}
index 39a2635ae6cf681ddb5d744522666a95aaf61752..9ee7ae43018e4843febdf07eeb80cfef747d4046 100644 (file)
@@ -38,6 +38,7 @@ service Bootstrap {
    rpc setTimeout(ReqSetTimeout) returns (RspSetTimeout) {}
    rpc setXMLSync(ReqSetXMLSync) returns (RspSetXMLSync) {}
    rpc getAngle(ReqGetAngle) returns (RspGetAngle) {}
+   rpc moveTo(ReqMoveTo) returns (RspMoveTo) {}
 }
 
 // ------------------------------------ //
@@ -633,6 +634,14 @@ message RspSetFocus {
    RspStatus status = 1;
 }
 
+message ReqMoveTo {
+   string elementId = 1;
+}
+
+message RspMoveTo {
+   RspStatus status = 1;
+}
+
 message ReqGetActiveAppToolkitName {
 }