Add get window position api 19/286919/3
authorSukhyungKang <shine.kang@samsung.com>
Tue, 17 Jan 2023 01:24:26 +0000 (10:24 +0900)
committerSukhyungKang <shine.kang@samsung.com>
Thu, 2 Feb 2023 06:36:43 +0000 (15:36 +0900)
Change-Id: I49018a1775f37f6df439ee2a03648f1c3931ba95
Signed-off-by: SukhyungKang <shine.kang@samsung.com>
include/app.h
src/app_main.cc

index 45cd791..5bb63f5 100644 (file)
@@ -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);
+
 
 /**
  * @}
index 1b32780..8935d0a 100644 (file)
@@ -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;
+}