From aa571989175382b34b9a9d1f0542ce4a47daf378 Mon Sep 17 00:00:00 2001 From: SukhyungKang Date: Tue, 17 Jan 2023 10:24:26 +0900 Subject: [PATCH] Add get window position api Change-Id: I49018a1775f37f6df439ee2a03648f1c3931ba95 Signed-off-by: SukhyungKang --- include/app.h | 15 +++++++++++++++ src/app_main.cc | 11 +++++++++++ 2 files changed, 26 insertions(+) diff --git a/include/app.h b/include/app.h index 45cd791..5bb63f5 100644 --- a/include/app.h +++ b/include/app.h @@ -204,6 +204,21 @@ int ui_app_add_event_handler(app_event_handler_h *event_handler, app_event_type_ */ int ui_app_remove_event_handler(app_event_handler_h event_handler); +/** + * @brief Gets the window position of application. + * @since_tizen 7.5 + * @param[out] x x position of application's left top + * @param[out] y y position of application's left top + * @param[out] w width of application + * @param[out] h height of application + * @return @c 0 on success, + * otherwise a negative error value + * @retval #APP_ERROR_NONE Successful + * @retval #APP_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #APP_ERROR_NOT_SUPPORTED Not supported + */ +int ui_app_get_window_position(int *x, int *y, int *w, int *h); + /** * @} diff --git a/src/app_main.cc b/src/app_main.cc index 1b32780..8935d0a 100644 --- a/src/app_main.cc +++ b/src/app_main.cc @@ -265,3 +265,14 @@ API int ui_app_remove_event_handler(app_event_handler_h event_handler) { delete eb; return APP_ERROR_NONE; } + +API int ui_app_get_window_position(int *x, int *y, int *w, int *h) { + if (x == nullptr || y == nullptr || w == nullptr || h == nullptr) + return APP_ERROR_INVALID_PARAMETER; + + if (__context.get() == nullptr || + __context->GetWindowPosition(x, y, w, h) < 0) + return APP_ERROR_NOT_SUPPORTED; + + return APP_ERROR_NONE; +} -- 2.7.4