This command can sets focus to specific ui object.
sample usage : ret = stub.setFocus(ReqSetFocus(elementId="ID"))
Change-Id: I3d4fbe61620dabc2b5e309f65d6963a97a58e473
*/
virtual void updateExtents() = 0;
+ /**
+ * @copydoc UiObject::setFocus()
+ */
+ virtual bool setFocus() = 0;
+
/**
* @brief Updates Node information from atspi server.
*
*/
void updateExtents() override;
+ /**
+ * @copydoc UiObject::setFocus()
+ */
+ bool setFocus() override;
+
/**
* @copydoc AccessibleNode::refresh()
*/
static gboolean Atspi_editable_text_insert_text(AtspiEditableText *, int pos, const gchar *text, int len, GError **error);
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);
private:
static std::recursive_mutex mMutex;
*/
void updateExtents() override;
+ /**
+ * @brief TBD
+ * @since_tizen 7.0
+ */
+ bool setFocus() override;
+
/**
* @brief TBD
* @since_tizen 6.5
*/
void updateExtents() const;
+ /**
+ * @brief Sets focus to object.
+ *
+ * @since_tizen 7.0
+ */
+ bool setFocus() const;
+
/**
* @brief Updates object's information from atspi server.
*
}
}
+bool AtspiAccessibleNode::setFocus()
+{
+ AtspiComponent *component = AtspiWrapper::Atspi_accessible_get_component_iface(mNode);
+ if (component) {
+ bool ret = AtspiWrapper::Atspi_component_grab_focus(component, NULL);
+ g_object_unref(component);
+ return ret;
+ }
+ else
+ return false;
+}
+
void AtspiAccessibleNode::refresh()
{
AtspiWrapper::Atspi_accessible_clear_cache(mNode);
std::unique_lock<std::recursive_mutex> lock(mMutex);
return atspi_accessible_clear_cache(node);
}
+
+gboolean AtspiWrapper::Atspi_component_grab_focus(AtspiComponent *obj, GError **error)
+{
+ std::unique_lock<std::recursive_mutex> lock(mMutex);
+ return atspi_component_grab_focus(obj, error);
+}
{
}
+bool MockAccessibleNode::setFocus()
+{
+ return false;
+}
+
void MockAccessibleNode::refresh()
{
}
mNode->updateExtents();
}
+bool UiObject::setFocus() const
+{
+ return mNode->setFocus();
+}
+
bool UiObject::isValid() const
{
return mNode->isValid();
::grpc::Status actionAndWaitEvent(::grpc::ServerContext *context,
const ::aurum::ReqActionAndWaitEvent *request,
::aurum::RspActionAndWaitEvent *response) override;
+ ::grpc::Status setFocus(::grpc::ServerContext *context,
+ const ::aurum::ReqSetFocus *request,
+ ::aurum::RspSetFocus *response) override;
};
#endif
#include "Commands/DumpObjectTreeCommand.h"
#include "Commands/GetScreenSizeCommand.h"
#include "Commands/ActionAndWaitEventCommand.h"
+#include "Commands/SetFocusCommand.h"
--- /dev/null
+/*
+ * Copyright (c) 2022 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 <gio/gio.h>
+#include <grpcpp/grpcpp.h>
+#include "Commands/Command.h"
+#include "ObjectMapper.h"
+#include <aurum.grpc.pb.h>
+#include "config.h"
+
+class SetFocusCommand : public Command {
+private:
+ const ::aurum::ReqSetFocus *mRequest;
+ ::aurum::RspSetFocus *mResponse;
+
+public:
+ SetFocusCommand(const ::aurum::ReqSetFocus *request,
+ ::aurum::RspSetFocus *response);
+ ::grpc::Status execute() override;
+};
files('src/Commands/DumpObjectTreeCommand.cc'),
files('src/Commands/GetScreenSizeCommand.cc'),
files('src/Commands/ActionAndWaitEventCommand.cc'),
+ files('src/Commands/SetFocusCommand.cc'),
]
bootstrap_svr_dep = [
std::unique_ptr<ActionAndWaitEventCommand> cmd = std::make_unique<ActionAndWaitEventCommand>(request, response);
return execute(cmd.get(), true);
}
+
+::grpc::Status aurumServiceImpl::setFocus(::grpc::ServerContext *context,
+ const ::aurum::ReqSetFocus *request,
+ ::aurum::RspSetFocus *response)
+{
+ std::unique_ptr<SetFocusCommand> cmd = std::make_unique<SetFocusCommand>(request, response);
+ return execute(cmd.get(), true);
+}
--- /dev/null
+/*
+ * Copyright (c) 2022 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"
+#include "SetFocusCommand.h"
+#include "UiObject.h"
+
+SetFocusCommand::SetFocusCommand(const ::aurum::ReqSetFocus *request,
+ ::aurum::RspSetFocus *response)
+ : mRequest{request}, mResponse{response}
+{
+}
+
+::grpc::Status SetFocusCommand::execute()
+{
+ LOGI("SetFocus --------------- ");
+
+ ObjectMapper *mObjMap = ObjectMapper::getInstance();
+ std::shared_ptr<UiObject> obj = mObjMap->getElement(mRequest->elementid());
+ if (obj && obj->setFocus()) {
+ return grpc::Status::OK;
+ }
+
+ return grpc::Status::CANCELLED;
+}
rpc dumpObjectTree(ReqDumpObjectTree) returns (RspDumpObjectTree) {}
rpc getScreenSize(ReqGetScreenSize) returns (RspGetScreenSize) {}
rpc actionAndWaitEvent(ReqActionAndWaitEvent) returns (RspActionAndWaitEvent) {}
+ rpc setFocus(ReqSetFocus) returns (RspSetFocus) {}
}
// ------------------------------------ //
message RspActionAndWaitEvent {
RspStatus status = 1;
+}
+
+message ReqSetFocus {
+ string elementId = 1;
+}
+
+message RspSetFocus {
+ RspStatus status = 1;
}
\ No newline at end of file