From: hyunho Date: Mon, 19 Aug 2019 01:30:55 +0000 (+0900) Subject: Add get display status api for base frame comp X-Git-Tag: submit/tizen/20190830.041902~6^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F01%2F212201%2F4;p=platform%2Fcore%2Fappfw%2Fcomponent-based-application.git Add get display status api for base frame comp - base_frame_get_display_status Change-Id: I2e212d5692d40b3ee40f50f88f42fcae7bfc1257 Signed-off-by: hyunho --- diff --git a/component_based/base/api/base_frame_component.h b/component_based/base/api/base_frame_component.h index 3ba90e5..bf5cc1c 100644 --- a/component_based/base/api/base_frame_component.h +++ b/component_based/base/api/base_frame_component.h @@ -31,6 +31,8 @@ typedef struct frame_window_s *frame_window_h; int base_frame_create_window(frame_window_h *handle, int id, void *raw); int base_frame_window_get_id(frame_window_h handle, int *id); int base_frame_window_get_raw(frame_window_h handle, void **raw); +int base_frame_get_display_status( + component_h context, component_display_status_e *display_status); typedef frame_window_h (*base_frame_component_create_cb)( component_h context, diff --git a/component_based/base/stub.cc b/component_based/base/stub.cc index 8e2690a..fcc1578 100644 --- a/component_based/base/stub.cc +++ b/component_based/base/stub.cc @@ -545,6 +545,38 @@ extern "C" EXPORT_API int base_frame_window_get_raw(frame_window_h handle, return COMPONENT_ERROR_NONE; } +extern "C" EXPORT_API int base_frame_get_display_status( + component_h context, component_display_status_e* display_status) { + if (context == nullptr || display_status == nullptr) { + LOGE("Invalid parameter"); + return COMPONENT_ERROR_INVALID_PARAMETER; + } + + component_based::Component* component = + static_cast(context); + if (component->GetType() != component_based::Component::Type::Frame) { + LOGE("Invalid parameter"); + return COMPONENT_ERROR_INVALID_PARAMETER; + } + + ::StubFrameComponent* frame_component = + dynamic_cast<::StubFrameComponent*>(component); + if (frame_component == nullptr) { + LOGE("Invalid parameter"); + return COMPONENT_ERROR_INVALID_PARAMETER; + } + + auto status = frame_component->GetDisplayStatus(); + if (status == component_based::FrameComponent::DisplayStatus::Unknown) { + LOGE("Invalid context"); + return COMPONENT_ERROR_INVALID_CONTEXT; + } + + *display_status = static_cast(status); + + return COMPONENT_ERROR_NONE; +} + extern "C" EXPORT_API int component_based_app_base_main(int argc, char** argv, component_based_app_base_lifecycle_callback_s *callback, void* user_data) { if (argc < 1 || argv == nullptr || !callback || !callback->create) {