Add mm_display_interface_get_screen_size() 35/281035/3 accepted/tizen_7.0_unified accepted/tizen_7.0_unified_hotfix accepted/tizen_8.0_unified accepted/tizen_unified tizen tizen_7.0 tizen_7.0_hotfix tizen_8.0 accepted/tizen/7.0/unified/20221110.062225 accepted/tizen/7.0/unified/hotfix/20221116.105415 accepted/tizen/8.0/unified/20231005.093441 accepted/tizen/unified/20220915.173209 accepted/tizen/unified/20220916.022058 accepted/tizen/unified/20220916.022136 accepted/tizen/unified/20220919.012408 accepted/tizen/unified/20220919.012609 tizen_7.0_m2_release tizen_8.0_m2_release
authorSangchul Lee <sc11.lee@samsung.com>
Thu, 8 Sep 2022 07:07:38 +0000 (16:07 +0900)
committerSangchul Lee <sc11.lee@samsung.com>
Thu, 8 Sep 2022 10:11:30 +0000 (19:11 +0900)
[Version] 0.0.14
[Issue Type] API

Change-Id: I6c65456059b5cbc48bce916f08adcb61a1f23c04
Signed-off-by: Sangchul Lee <sc11.lee@samsung.com>
configure.ac
packaging/libmm-display.spec
src/include/mm_display.h
src/include/mm_display_interface.h
src/include/mm_display_interface_private.h
src/mm_display.c
src/mm_display_interface.c

index 2612b76..3d1e4cc 100644 (file)
@@ -61,6 +61,10 @@ PKG_CHECK_MODULES(ECORE_WL2, ecore-wl2)
 AC_SUBST(ECORE_WL2_CFLAGS)
 AC_SUBST(ECORE_WL2_LIBS)
 
+PKG_CHECK_MODULES(ELEMENTARY, elementary)
+AC_SUBST(ELEMENTARY_CFLAGS)
+AC_SUBST(ELEMENTARY_LIBS)
+
 PKG_CHECK_MODULES(TIZEN_EXTENSION_CLIENT, tizen-extension-client)
 AC_SUBST(TIZEN_EXTENSION_CLIENT_CFLAGS)
 AC_SUBST(TIZEN_EXTENSION_CLIENT_LIBS)
index 9b33bda..7485287 100644 (file)
@@ -1,6 +1,6 @@
 Name:       libmm-display
 Summary:    Multimedia framework display library
-Version:    0.0.13
+Version:    0.0.14
 Release:    0
 Group:      Multimedia/Libraries
 License:    Apache-2.0
@@ -16,6 +16,7 @@ BuildRequires:  pkgconfig(capi-media-tool)
 BuildRequires:  pkgconfig(evas)
 BuildRequires:  pkgconfig(ecore-evas)
 BuildRequires:  pkgconfig(ecore-wl2)
+BuildRequires:  pkgconfig(elementary)
 BuildRequires:  pkgconfig(tizen-extension-client)
 BuildRequires:  pkgconfig(mm-evas-renderer)
 %if "%{gtests}" == "1"
index 0d5821e..7d7d0ea 100644 (file)
@@ -51,6 +51,7 @@ int mm_display_set_display_mainloop_sync(mm_display_h handle, mm_display_type_e
 
 int mm_display_get_type(mm_display_h handle, mm_display_type_e *type);
 int mm_display_get_window_rect(mm_display_h handle, MMRectType *window_rect);
+int mm_display_get_screen_size(int *width, int *height);
 
 #ifdef TIZEN_FEATURE_EVAS_RENDERER
 int mm_display_evas_set_rotation(mm_display_h handle, int rotation);
index b567ded..0032ff8 100644 (file)
@@ -46,6 +46,7 @@ int mm_display_interface_set_display_mainloop_sync(mm_display_interface_h handle
 
 int mm_display_interface_get_type(mm_display_interface_h handle, mm_display_type_e *type);
 int mm_display_interface_get_window_rect(mm_display_interface_h handle, MMRectType *window_rect);
+int mm_display_interface_get_screen_size(mm_display_interface_h handle, int *width, int *height);
 
 int mm_display_interface_evas_set_rotation(mm_display_interface_h handle, int rotation);
 int mm_display_interface_evas_get_rotation(mm_display_interface_h handle, int *rotation);
index 7602c22..e8f5339 100644 (file)
@@ -37,6 +37,7 @@ typedef struct mm_display_interface {
        int (*set_display_mainloop_sync)(void *, mm_display_type_e, void *, int *);
        int (*get_type)(void *, mm_display_type_e *);
        int (*get_window_rect)(void *, MMRectType *);
+       int (*get_screen_size)(int *, int *);
        int (*evas_set_rotation)(void *, int);
        int (*evas_get_rotation)(void *, int *);
        int (*evas_set_visible)(void *, bool);
index 9605c0a..a79a6bb 100644 (file)
@@ -23,6 +23,7 @@
 #include <Ecore_Evas.h>
 #include <Ecore_Wl2.h>
 #include <tizen-extension-client-protocol.h>
+#include <Elementary.h>
 #ifdef TIZEN_FEATURE_EVAS_RENDERER
 #include <mm_evas_renderer.h>
 #endif /* TIZEN_FEATURE_EVAS_RENDERER */
@@ -440,6 +441,27 @@ int mm_display_get_window_rect(mm_display_h handle, MMRectType *window_rect)
        return MM_ERROR_NONE;
 }
 
+int mm_display_get_screen_size(int *width, int *height)
+{
+       Evas_Object *eo;
+
+       if (!width || !height) {
+               LOGE("invalid argument, width[%p] height[%p]", width, height);
+               return MM_ERROR_INVALID_ARGUMENT;
+       }
+
+       /* This function returns the resolution when the device rotation angle is "0" regardless of the actual rotation direction of the device. */
+       eo = elm_win_add(NULL, "get_screen_size", ELM_WIN_BASIC);
+       if (!eo) {
+               LOGE("failed to elm_win_add()");
+               return MM_ERROR_COMMON_INTERNAL; /* FIXME: this could be changed to another one after making MM_ERROR_DISPLAY_CLASS */
+       }
+
+       elm_win_screen_size_get(eo, NULL, NULL, width, height);
+       LOGD("screen size: %d x %d", *width, *height);
+
+       return MM_ERROR_NONE;
+}
 
 #ifdef TIZEN_FEATURE_EVAS_RENDERER
 int mm_display_evas_set_rotation(mm_display_h handle, int rotation)
index 6f807bf..6d86351 100644 (file)
@@ -80,6 +80,7 @@ int mm_display_interface_init(mm_display_interface_h *handle)
        sym_ret &= g_module_symbol(module, "mm_display_set_display_mainloop_sync", (gpointer *)&new_interface->set_display_mainloop_sync);
        sym_ret &= g_module_symbol(module, "mm_display_get_type", (gpointer *)&new_interface->get_type);
        sym_ret &= g_module_symbol(module, "mm_display_get_window_rect", (gpointer *)&new_interface->get_window_rect);
+       sym_ret &= g_module_symbol(module, "mm_display_get_screen_size", (gpointer *)&new_interface->get_screen_size);
 #ifdef TIZEN_FEATURE_EVAS_RENDERER
        sym_ret &= g_module_symbol(module, "mm_display_evas_set_rotation", (gpointer *)&new_interface->evas_set_rotation);
        sym_ret &= g_module_symbol(module, "mm_display_evas_get_rotation", (gpointer *)&new_interface->evas_get_rotation);
@@ -215,6 +216,17 @@ int mm_display_interface_get_window_rect(mm_display_interface_h handle, MMRectTy
        return interface->get_window_rect(interface->dp_handle, window_rect);
 }
 
+int mm_display_interface_get_screen_size(mm_display_interface_h handle, int *width, int *height)
+{
+       DECLARE_CHECK_INTERFACE_HANDLE(handle);
+
+       if (!interface->get_screen_size) {
+               LOGE("NULL function pointer");
+               return MM_ERROR_UNKNOWN;
+       }
+
+       return interface->get_screen_size(width, height);
+}
 
 int mm_display_interface_evas_set_rotation(mm_display_interface_h handle, int rotation)
 {