SET(VERSION ${FULLVER})
INCLUDE(FindPkgConfig)
-SET(requires "glib-2.0 bundle dlog ecore-wl2 appcore-multiwindow capi-appfw-app-control aul capi-appfw-app-common")
-SET(pc_requires "ecore-wl2 appcore-multiwindow capi-appfw-app-control component-based-app-control aul")
+SET(requires "glib-2.0 bundle dlog ecore-wl2 appcore-multiwindow capi-appfw-app-control aul capi-appfw-app-common widget_service screen_connector_provider")
+SET(pc_requires "ecore-wl2 appcore-multiwindow capi-appfw-app-control component-based-app-control aul widget_service screen_connector_provider
+")
pkg_check_modules(component-based-core-base REQUIRED ${requires})
class Factory {
public:
virtual std::unique_ptr<Component> Create(std::string comp_id,
- std::string inst_id) = 0;
+ std::string inst_id,
+ tizen_base::Bundle& start_data) = 0;
};
Component(std::string comp_id, std::string inst_id);
#include <app_control_internal.h>
#include <bundle_internal.h>
#include <glib.h>
+#include <screen_connector_provider.h>
#include <algorithm>
#include <memory>
if (new_inst == "true")
multi_inst_list_.push_back(inst_id);
+ tizen_base::Bundle start_data(b, false, false);
std::unique_ptr<Component> component = fac_map_[comp_id]->Create(comp_id,
- inst_id);
+ inst_id, start_data);
if (component == nullptr || component.get() == nullptr) {
LOGE("Fail to create component");
return;
}
+
inst_map_[inst_id] = std::move(component);
appcore_multiwindow_base_instance_run(comp_id.c_str(), inst_id.c_str(),
nullptr);
return true;
}
+bool ComponentManager::BindWidget(const std::string& inst_id,
+ std::unique_ptr<IWindow> win) {
+ appcore_multiwindow_base_instance_h context =
+ appcore_multiwindow_base_instance_find(inst_id.c_str());
+ if (!context) {
+ LOGE("Failed to find instance(%s)", inst_id.c_str());
+ return false;
+ }
+
+ win_map_[inst_id] = std::move(win);
+ Ecore_Wl2_Window* wl_win = GetWl2Window(inst_id);
+ if (!wl_win) {
+ LOGE("Failed to get wayland window(%s)", inst_id.c_str());
+ return false;
+ }
+
+ struct wl_surface* surface = ecore_wl2_window_surface_get(wl_win);
+ screen_connector_provider_remote_enable(inst_id.c_str(), surface);
+ appcore_multiwindow_base_window_bind(context, wl_win);
+ LOGI("Bind instance(%s)", inst_id.c_str());
+ return true;
+}
+
void ComponentManager::Unbind(const std::string& inst_id) {
auto win_iter = win_map_.find(inst_id);
if (win_iter == win_map_.end()) {
void ExitAtIdle(const std::string& inst_id);
void ExitAll();
bool Bind(const std::string& inst_id, std::unique_ptr<IWindow> win);
+ bool BindWidget(const std::string& inst_id, std::unique_ptr<IWindow> win);
void Unbind(const std::string& inst_id);
std::string GetInstanceID(int win_id);
const IWindow* GetWindow(const std::string& inst_id);
class Factory : public Component::Factory {
public:
std::unique_ptr<Component> Create(std::string comp_id,
- std::string inst_id) override {
+ std::string inst_id,
+ tizen_base::Bundle& start_data) override {
return std::unique_ptr<Component>(
new (std::nothrow) FrameComponent(
std::move(comp_id), std::move(inst_id)));
class Factory : public Component::Factory {
public:
std::unique_ptr<Component> Create(std::string comp_id,
- std::string inst_id) override {
+ std::string inst_id,
+ tizen_base::Bundle& start_data) override {
return std::unique_ptr<Component>(
new (std::nothrow) ServiceComponent(
std::move(comp_id), std::move(inst_id)));
}
std::unique_ptr<component_based::Component> Create(std::string comp_id,
- std::string inst_id) override {
+ std::string inst_id, tizen_base::Bundle& start_data) override {
return std::unique_ptr<component_based::Component>(
new (std::nothrow) StubBaseComponent(std::move(comp_id),
std::move(inst_id), cb_, user_data_));
}
std::unique_ptr<component_based::Component> Create(std::string comp_id,
- std::string inst_id) override {
+ std::string inst_id, tizen_base::Bundle& start_data) override {
return std::unique_ptr<component_based::Component>(
new (std::nothrow) StubFrameComponent(
std::move(comp_id), std::move(inst_id), cb_, user_data_));
}
std::unique_ptr<component_based::Component> Create(std::string comp_id,
- std::string inst_id) override {
+ std::string inst_id, tizen_base::Bundle& start_data) override {
return std::unique_ptr<component_based::Component>(
new (std::nothrow) StubServiceComponent(std::move(comp_id),
std::move(inst_id), cb_, user_data_));
--- /dev/null
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ *
+ * 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 <app_common.h>
+#include <aul.h>
+#include <aul_comp_status.h>
+#include <widget_instance.h>
+#include <glib.h>
+#include <aul_widget.h>
+#include <screen_connector_provider.h>
+#include <app_control_internal.h>
+
+#include <memory>
+
+#include "component_based/base/component_manager_internal.h"
+#include "component_based/base/dlog_internal.h"
+#include "component_based/base/widget_component.h"
+#include "component_based/base/widget_component_implementation.h"
+
+#define STATUS_FOREGROUND "fg"
+#define STATUS_BACKGROUND "bg"
+
+namespace component_based {
+
+WidgetComponent::Impl::Impl(WidgetComponent* parent)
+ : parent_(parent) {
+}
+
+WidgetComponent::WidgetComponent(std::string comp_id, std::string inst_id,
+ tizen_base::Bundle& start_data)
+ : Component::Component(std::move(comp_id),
+ std::move(inst_id)), impl_(new Impl(this)) {
+ char pkgid[256] = {0, };
+ if (aul_app_get_pkgid_bypid(getpid(), pkgid, sizeof(pkgid)) == 0)
+ impl_->pkgid_ = std::string(pkgid);
+
+ impl_->viewer_endpoint_ = start_data.GetString(AUL_K_WIDGET_VIEWER);
+ std::string width_str = start_data.GetString(WIDGET_K_WIDTH);
+ std::string height_str = start_data.GetString(WIDGET_K_HEIGHT);
+
+ if (!width_str.empty()) {
+ impl_->width_ = std::stoi(width_str);
+ impl_->height_ = std::stoi(height_str);
+ }
+
+ std::vector<unsigned char> period_v = start_data.GetByte("__WIDGET_PERIOD__");
+ if (period_v.size() > 0) {
+ impl_->period_ = *reinterpret_cast<const uint16_t*>(&period_v[0]);
+ impl_->period_timer_ = g_timeout_add_seconds(
+ impl_->period_, impl_->PeriodTimeoutCb, this);
+ }
+}
+
+WidgetComponent::~WidgetComponent() {
+ if (impl_->period_timer_)
+ g_source_remove(impl_->period_timer_);
+}
+
+const IWindow* WidgetComponent::GetWindow() {
+ auto& mgr = internal::ComponentManager::GetInst();
+ return mgr.GetWindow(GetInstanceID());
+}
+
+bool WidgetComponent::Impl::SendStatus(int status, tizen_base::Bundle extra) {
+ int lifecycle;
+ int ret = aul_widget_send_status_to_viewer(parent_->GetComponentID().c_str(),
+ parent_->GetInstanceID().c_str(), viewer_endpoint_.c_str(),
+ status, -1, extra.GetCount() != 0 ? extra.GetHandle() : nullptr);
+ if (ret != 0)
+ return false;
+
+ lifecycle = widget_instance_convert_event_to_lifecycle_status(status);
+ if (lifecycle > -1) {
+ ret = aul_widget_send_status_to_service(
+ parent_->GetComponentID().c_str(), parent_->GetInstanceID().c_str(),
+ pkgid_.c_str(), lifecycle);
+ if (ret != 0)
+ return false;
+ }
+ return true;
+}
+
+void WidgetComponent::Impl::SetPendingUpdate(bool pending) {
+ pending_update_ = pending;
+}
+
+bool WidgetComponent::Impl::GetPendingUpdate() {
+ return pending_update_;
+}
+
+void WidgetComponent::Impl::ClearUpdateTimer() {
+ g_source_remove(period_timer_);
+ period_timer_ = 0;
+}
+
+gboolean WidgetComponent::Impl::PeriodTimeoutCb(gpointer user_data) {
+ WidgetComponent* wc = static_cast<WidgetComponent*>(user_data);
+ if (!wc) {
+ LOGE("Can't find the instance");
+ return G_SOURCE_REMOVE;
+ }
+ if (wc->GetState() != State::Running) {
+ wc->impl_->SetPendingUpdate(true);
+ wc->impl_->ClearUpdateTimer();
+ } else {
+ tizen_base::Bundle data;
+ wc->OnUpdate(data, false);
+ }
+
+ return G_SOURCE_CONTINUE;
+}
+
+bool WidgetComponent::OnBaseCreate() {
+ screen_connector_provider_init();
+ std::unique_ptr<IWindow> win = OnCreate(impl_->width_, impl_->height_);
+ if (win == nullptr) {
+ LOGE("OnCreate() returns nullptr");
+ impl_->SendStatus(WIDGET_INSTANCE_EVENT_CREATE_ABORTED);
+ return false;
+ }
+
+ auto& mgr = internal::ComponentManager::GetInst();
+ if (!mgr.BindWidget(GetInstanceID(), std::move(win))) {
+ LOGE("Bind window fail");
+ if (!impl_->SendStatus(WIDGET_INSTANCE_EVENT_CREATE_ABORTED))
+ LOGE("Fail to send abort event");
+ return false;
+ }
+
+ LOGD("%s is created", GetInstanceID().c_str());
+ if (!impl_->SendStatus(WIDGET_INSTANCE_EVENT_CREATE)) {
+ LOGE("Fail to send create event");
+ return false;
+ }
+ return true;
+}
+
+void WidgetComponent::OnBaseDestroy() {
+}
+
+void WidgetComponent::Impl::ResizeProcess(tizen_base::Bundle data) {
+ std::string width_str = data.GetString(WIDGET_K_WIDTH);
+ std::string height_str = data.GetString(WIDGET_K_HEIGHT);
+
+ if (!width_str.empty()) {
+ width_ = std::stoi(width_str);
+ height_ = std::stoi(height_str);
+ }
+ parent_->OnResize(width_, height_);
+ SendStatus(WIDGET_INSTANCE_EVENT_SIZE_CHANGED);
+}
+
+void WidgetComponent::Impl::UpdateProcess(tizen_base::Bundle data) {
+ std::string force = data.GetString("__WIDGET_FORCE__");
+ std::string update_data = data.GetString("__WIDGET_CONTENT_INFO__");
+ if (parent_->GetState() != State::Running) {
+ pending_update_data_ = update_data;
+ pending_update_ = true;
+ } else {
+ tizen_base::Bundle data(update_data);
+ parent_->OnUpdate(data, force == "true");
+ SendStatus(WIDGET_INSTANCE_EVENT_UPDATE);
+ }
+}
+
+void WidgetComponent::Impl::DestroyProcess(tizen_base::Bundle data) {
+ parent_->OnDestroy(false);
+ aul_widget_instance_del(parent_->GetComponentID().c_str(),
+ parent_->GetInstanceID().c_str());
+ SendStatus(WIDGET_INSTANCE_EVENT_DESTROY);
+ parent_->Finish();
+}
+
+void WidgetComponent::Impl::TerminateProcess(tizen_base::Bundle data) {
+ parent_->OnDestroy(true);
+ aul_widget_instance_del(parent_->GetComponentID().c_str(),
+ parent_->GetInstanceID().c_str());
+ SendStatus(WIDGET_INSTANCE_EVENT_EXTRA_UPDATED,
+ parent_->GetContent());
+ SendStatus(WIDGET_INSTANCE_EVENT_TERMINATE);
+ parent_->Finish();
+}
+
+void WidgetComponent::Impl::PeriodProcess(tizen_base::Bundle data) {
+ ClearUpdateTimer();
+ std::vector<unsigned char> period_v = data.GetByte("__WIDGET_PERIOD__");
+ if (period_v.size() > 0) {
+ period_ = *reinterpret_cast<const uint16_t*>(&period_v[0]);
+ period_timer_ = g_timeout_add_seconds(
+ period_, PeriodTimeoutCb, this);
+ }
+}
+
+void WidgetComponent::OnBaseStart(AppControl control, bool restarted) {
+ bundle* raw_data;
+ app_control_to_bundle(control.GetHandle(), &raw_data);
+ tizen_base::Bundle data(raw_data, true, true);
+ std::string op = data.GetString("__WIDGET_OP__");
+ if (op == "resize") {
+ impl_->ResizeProcess(data);
+ return;
+ } else if (op == "update") {
+ impl_->UpdateProcess(data);
+ return;
+ } else if (op == "destroy") {
+ impl_->DestroyProcess(data);
+ return;
+ } else if (op == "terminate") {
+ impl_->TerminateProcess(data);
+ return;
+ } else if (op == "resume") {
+ OnBaseResume();
+ return;
+ } else if (op == "pause") {
+ OnBasePause();
+ return;
+ } else if (op == "period") {
+ impl_->PeriodProcess(data);
+ return;
+ }
+ std::string content_str = data.GetString("__WIDGET_CONTENT_INFO__");
+ if (!content_str.empty()) {
+ tizen_base::Bundle content(content_str);
+ OnBaseRestoreContent(content);
+ } else {
+ OnBaseRestoreContent(GetContent());
+ }
+ OnStart(restarted);
+}
+
+void WidgetComponent::OnBaseResume() {
+ if (GetState() == State::Paused ||
+ GetState() == State::Started ||
+ GetState() == State::Stopped) {
+ if (impl_->pending_update_) {
+ tizen_base::Bundle update_data;
+ if (!impl_->pending_update_data_.empty())
+ update_data = tizen_base::Bundle(impl_->pending_update_data_.c_str());
+ OnUpdate(update_data, false);
+ impl_->SendStatus(WIDGET_INSTANCE_EVENT_UPDATE);
+ impl_->period_timer_ = g_timeout_add_seconds(impl_->period_,
+ impl_->PeriodTimeoutCb, this);
+ }
+
+ OnResume();
+ SetState(State::Running);
+ aul_comp_status_update(GetInstanceID().c_str(), COMP_STATUS_RESUMED);
+ impl_->SendStatus(WIDGET_INSTANCE_EVENT_RESUME);
+ aul_widget_instance_change_status(
+ GetComponentID().c_str(), STATUS_FOREGROUND);
+ }
+}
+
+void WidgetComponent::OnBasePause() {
+ if (GetState() == State::Running) {
+ OnPause();
+ SetState(State::Paused);
+ aul_comp_status_update(GetInstanceID().c_str(), COMP_STATUS_PAUSED);
+ impl_->SendStatus(WIDGET_INSTANCE_EVENT_PAUSE);
+ aul_widget_instance_change_status(
+ GetComponentID().c_str(), STATUS_BACKGROUND);
+ }
+ OnBaseStop();
+}
+
+void WidgetComponent::OnBaseStop() {
+ OnStop();
+ tizen_base::Bundle content = GetContent();
+ OnBaseSaveContent(content);
+ SetContent(std::move(content));
+}
+
+void WidgetComponent::OnBaseRestoreContent(tizen_base::Bundle content) {
+}
+
+void WidgetComponent::OnBaseSaveContent(tizen_base::Bundle& content) {
+}
+
+// LCOV_EXCL_START
+void WidgetComponent::OnBaseAction(std::string action, AppControl app_control) {
+}
+// LCOV_EXCL_STOP
+
+// LCOV_EXCL_START
+void WidgetComponent::OnBaseDeviceOrientationChanged(
+ DeviceOrientation::Orientation orientation) {
+}
+// LCOV_EXCL_STOP
+
+// LCOV_EXCL_START
+void WidgetComponent::OnBaseLanguageChanged(std::string language) {
+}
+// LCOV_EXCL_STOP
+
+// LCOV_EXCL_START
+void WidgetComponent::OnBaseRegionFormatChanged(std::string region) {
+}
+// LCOV_EXCL_STOP
+
+// LCOV_EXCL_START
+void WidgetComponent::OnBaseLowBattery(LowBattery::Status status) {
+}
+// LCOV_EXCL_STOP
+
+// LCOV_EXCL_START
+void WidgetComponent::OnBaseLowMemory(LowMemory::Status status) {
+}
+// LCOV_EXCL_STOP
+
+// LCOV_EXCL_START
+void WidgetComponent::OnBaseSuspendedStateChanged(SuspendedState::State state) {
+}
+// LCOV_EXCL_STOP
+
+std::unique_ptr<IWindow> WidgetComponent::OnCreate(int width, int height) {
+ return nullptr;
+}
+
+void WidgetComponent::OnStart(bool restarted) {
+}
+
+void WidgetComponent::OnResume() {
+}
+
+void WidgetComponent::OnPause() {
+}
+
+void WidgetComponent::OnStop() {
+}
+
+void WidgetComponent::OnDestroy(bool permanent) {
+}
+
+void WidgetComponent::OnUpdate(tizen_base::Bundle data, bool force) {
+}
+
+void WidgetComponent::OnResize(int w, int h) {
+}
+
+} // namespace component_based
--- /dev/null
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ *
+ * 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.
+ */
+
+#ifndef COMPONENT_BASED_BASE_WIDGET_COMPONENT_H_
+#define COMPONENT_BASED_BASE_WIDGET_COMPONENT_H_
+
+#include <string>
+
+#include "component_based/base/component.h"
+#include "component_based/base/window_interface.h"
+
+#ifndef EXPORT_API
+#define EXPORT_API __attribute__((visibility("default")))
+#endif
+
+namespace component_based {
+
+class EXPORT_API WidgetComponent : public Component {
+ public:
+ class Factory : public Component::Factory {
+ public:
+ std::unique_ptr<Component> Create(std::string comp_id,
+ std::string inst_id,
+ tizen_base::Bundle& start_data) override {
+ return std::unique_ptr<Component>(
+ new (std::nothrow) WidgetComponent(
+ std::move(comp_id), std::move(inst_id), start_data));
+ }
+ };
+
+ enum class DisplayStatus {
+ Unknown,
+ On,
+ Off,
+ };
+
+ class WidgetType : public Type {
+ public:
+ enum {
+ Hash = 0x3333
+ };
+
+ int GetHash() const override {
+ return Hash;
+ }
+
+ std::string GetName() const override {
+ return "widget";
+ }
+ };
+
+ std::unique_ptr<Type> GetType() const override {
+ return std::unique_ptr<Type>(new WidgetType());
+ }
+
+ WidgetComponent(std::string comp_id, std::string inst_id,
+ tizen_base::Bundle& start_data);
+ virtual ~WidgetComponent();
+
+ DisplayStatus GetDisplayStatus();
+ const IWindow* GetWindow();
+
+ bool OnBaseCreate() override;
+ void OnBaseDestroy() override;
+ void OnBaseStart(AppControl control, bool restarted) override;
+ void OnBaseResume() override;
+ void OnBasePause() override;
+ void OnBaseStop() override;
+ void OnBaseRestoreContent(tizen_base::Bundle content) override;
+ void OnBaseSaveContent(tizen_base::Bundle& content) override;
+ void OnBaseAction(std::string action, AppControl app_control) override;
+ void OnBaseDeviceOrientationChanged(
+ DeviceOrientation::Orientation orientation) override;
+ void OnBaseLanguageChanged(std::string language) override;
+ void OnBaseRegionFormatChanged(std::string region) override;
+ void OnBaseLowBattery(LowBattery::Status status) override;
+ void OnBaseLowMemory(LowMemory::Status status) override;
+ void OnBaseSuspendedStateChanged(SuspendedState::State state) override;
+
+ virtual std::unique_ptr<IWindow> OnCreate(int w, int h);
+ virtual void OnStart(bool restarted);
+ virtual void OnResume();
+ virtual void OnPause();
+ virtual void OnStop();
+ virtual void OnDestroy(bool permanent);
+ virtual void OnUpdate(tizen_base::Bundle data, bool force);
+ virtual void OnResize(int width, int height);
+
+ int GetWidth();
+ int GetHeight();
+
+ private:
+ class Impl;
+ std::unique_ptr<Impl> impl_;
+};
+
+} // namespace component_based
+
+#endif // COMPONENT_BASED_BASE_WIDGET_COMPONENT_H_
--- /dev/null
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ *
+ * 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.
+ */
+
+#ifndef COMPONENT_BASED_BASE_WIDGET_COMPONENT_IMPLEMENTATION_H_
+#define COMPONENT_BASED_BASE_WIDGET_COMPONENT_IMPLEMENTATION_H_
+
+#include <app_control.h>
+#include <bundle_cpp.h>
+
+#include <string>
+#include <map>
+#include <memory>
+
+#include "component_based/base/widget_component.h"
+
+namespace component_based {
+
+class WidgetComponent::Impl {
+ public:
+ virtual ~Impl() = default;
+
+ private:
+ friend class WidgetComponent;
+ Impl(WidgetComponent* parent);
+
+ private:
+ static gboolean PeriodTimeoutCb(gpointer user_data);
+ void ResizeProcess(tizen_base::Bundle data);
+ void UpdateProcess(tizen_base::Bundle data);
+ void DestroyProcess(tizen_base::Bundle data);
+ void TerminateProcess(tizen_base::Bundle data);
+ void PeriodProcess(tizen_base::Bundle data);
+ bool SendStatus(int status, tizen_base::Bundle extra = tizen_base::Bundle());
+ void SetPendingUpdate(bool update);
+ bool GetPendingUpdate();
+ void ClearUpdateTimer();
+
+ private:
+ WidgetComponent* parent_;
+ int width_;
+ int height_;
+ std::string viewer_endpoint_;
+ std::string pkgid_;
+ int period_;
+ guint period_timer_;
+ bool pending_update_;
+ std::string pending_update_data_;
+};
+
+} // namespace component_base
+
+#endif // COMPONENT_BASED_BASE_WIDGET_COMPONENT_IMPLEMENTATION_H_
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../base/)
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../base/api/)
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/api/)
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/)
AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR} SOURCES)
ADD_LIBRARY(${PROJECT_NAME} SHARED ${SOURCES})
--- /dev/null
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ *
+ * 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 <Ecore_Wl2.h>
+
+#include <memory>
+
+#include "elm_widget_window.h"
+
+namespace component_based {
+
+ElmWidgetWindow::ElmWidgetWindow(std::string id)
+ : ElmWindow::ElmWindow(id) {
+ int rots[3] = {0};
+ Evas_Object* win = static_cast<Evas_Object*>(GetRaw());
+ elm_win_wm_rotation_preferred_rotation_set(win, -1);
+ elm_win_wm_rotation_available_rotations_set(win, rots, 1);
+ Ecore_Wl2_Window* wl_win = ecore_evas_wayland2_window_get(
+ ecore_evas_ecore_evas_get(evas_object_evas_get(win)));
+ ecore_wl2_window_class_set(wl_win, id.c_str());
+ elm_win_aux_hint_add(win, "wm.policy.win.user.geometry", "1");
+
+ std::string plug_id = id + ":" + std::to_string(getpid());
+ evas_object_data_set(win, "___PLUGID", strdup(plug_id.c_str()));
+ evas_object_event_callback_add(
+ win, EVAS_CALLBACK_DEL, WinDelCb, NULL);
+}
+
+ElmWidgetWindow::ElmWidgetWindow(Evas_Object* win)
+ : ElmWindow::ElmWindow(win) {
+}
+
+ElmWidgetWindow::~ElmWidgetWindow() = default;
+
+void ElmWidgetWindow::WinDelCb(void* data, Evas* e,
+ Evas_Object* obj, void* event_info) {
+ char* plug_id;
+ plug_id = static_cast<char*>(evas_object_data_del(obj, "___PLUGID"));
+ free(plug_id);
+}
+
+} // namespace component_based
--- /dev/null
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ *
+ * 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.
+ */
+
+#ifndef COMPONENT_BASED_EFL_BASE_ELM_WIDGET_WINDOW_H_
+#define COMPONENT_BASED_EFL_BASE_ELM_WIDGET_WINDOW_H_
+
+#include <Elementary.h>
+
+#include <string>
+
+#include "elm_window.h"
+
+#ifndef EXPORT_API
+#define EXPORT_API __attribute__((visibility("default")))
+#endif
+
+namespace component_based {
+
+class EXPORT_API ElmWidgetWindow : public ElmWindow {
+ public:
+ ElmWidgetWindow(std::string id);
+ ElmWidgetWindow(Evas_Object* win);
+ virtual ~ElmWidgetWindow();
+ private:
+ static void WinDelCb(void* data, Evas* e, Evas_Object* obj, void* event_info);
+};
+
+} // namespace component_based
+
+#endif // COMPONENT_BASED_EFL_BASE_ELM_WIDGET_WINDOW_H_
}
std::unique_ptr<component_based::Component> Create(std::string comp_id,
- std::string inst_id) override {
+ std::string inst_id, tizen_base::Bundle& start_data) override {
return std::unique_ptr<component_based::Component>(
new (std::nothrow) StubFrameComponent(
std::move(comp_id), std::move(inst_id), cb_, user_data_));
}
std::unique_ptr<component_based::Component> Create(std::string comp_id,
- std::string inst_id) override {
+ std::string inst_id, tizen_base::Bundle& start_data) override {
return std::unique_ptr<component_based::Component>(
new (std::nothrow) StubServiceComponent(std::move(comp_id),
std::move(inst_id), cb_, user_data_));
BuildRequires: pkgconfig(aul)
BuildRequires: pkgconfig(elementary)
BuildRequires: pkgconfig(capi-appfw-app-common)
+BuildRequires: pkgconfig(widget_service)
+BuildRequires: pkgconfig(screen_connector_provider)
%if 0%{?gcov:1}
BuildRequires: lcov
capi-appfw-app-common
aul
elementary
+ widget_service
+ screen_connector_provider
)
FOREACH(flag ${component-based_unittests_CFLAGS})
class Factory : public component_based::Component::Factory {
public:
std::unique_ptr<component_based::Component> Create(std::string comp_id,
- std::string inst_id) override {
+ std::string inst_id, tizen_base::Bundle& start_data) override {
return std::unique_ptr<component_based::Component>(
new SimpleFrameComp(std::move(comp_id), std::move(inst_id)));
}
class Factory : public component_based::Component::Factory {
public:
std::unique_ptr<component_based::Component> Create(std::string comp_id,
- std::string inst_id) override {
+ std::string inst_id, tizen_base::Bundle& start_data) override {
return std::unique_ptr<component_based::Component>(
new SimpleFrameComp(std::move(comp_id), std::move(inst_id)));
}
class Factory : public component_based::Component::Factory {
public:
std::unique_ptr<component_based::Component> Create(
- std::string comp_id, std::string inst_id) override {
+ std::string comp_id, std::string inst_id,
+ tizen_base::Bundle& start_data) override {
return std::unique_ptr<component_based::Component>(
new ServiceComp(std::move(comp_id), std::move(inst_id)));
}