summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHyunho Kang <hhstark.kang@samsung.com>2016-08-19 11:16:26 +0900
committerHyunho Kang <hhstark.kang@samsung.com>2016-08-22 13:52:24 +0900
commitae0d3f9e99c4742e61f93a65d0f11f1c5add3193 (patch)
tree08425598c65e27182bff97acd984c57789a59ee0
parentc2cb38b3694ed3803ac8e20b9e3abdd892e40ac5 (diff)
downloadwidget-service-ae0d3f9e99c4742e61f93a65d0f11f1c5add3193.tar.gz
widget-service-ae0d3f9e99c4742e61f93a65d0f11f1c5add3193.tar.bz2
widget-service-ae0d3f9e99c4742e61f93a65d0f11f1c5add3193.zip
Load resolution info from .ini file
Change-Id: I8a2d8d1f4fa958bdc320ee83f8908f940a5ac76b Signed-off-by: Hyunho Kang <hhstark.kang@samsung.com>
-rw-r--r--CMakeLists.txt29
-rw-r--r--data/device/wayland.mobile.320x480.resolution.ini1
-rw-r--r--data/device/wayland.mobile.360x360.resolution.ini1
-rw-r--r--data/device/wayland.mobile.360x480.resolution.ini1
-rw-r--r--data/device/wayland.mobile.480x800.resolution.ini1
-rw-r--r--data/device/wayland.mobile.540x960.resolution.ini1
-rw-r--r--data/device/wayland.mobile.resolution.ini1
-rw-r--r--data/device/wayland.wearable.360x360.resolution.ini1
-rw-r--r--data/device/wayland.wearable.360x480.resolution.ini1
-rw-r--r--data/device/wayland.wearable.resolution.ini1
-rw-r--r--data/emulator/wayland.mobile.320x480.resolution.ini1
-rw-r--r--data/emulator/wayland.mobile.360x360.resolution.ini1
-rw-r--r--data/emulator/wayland.mobile.360x480.resolution.ini1
-rw-r--r--data/emulator/wayland.mobile.480x800.resolution.ini1
-rw-r--r--data/emulator/wayland.mobile.540x960.resolution.ini1
-rw-r--r--data/emulator/wayland.mobile.resolution.ini1
-rw-r--r--data/emulator/wayland.wearable.360x360.resolution.ini1
-rw-r--r--data/emulator/wayland.wearable.360x480.resolution.ini1
-rw-r--r--data/emulator/wayland.wearable.resolution.ini1
-rw-r--r--include/debug.h1
-rw-r--r--packaging/libwidget_service.spec17
-rw-r--r--src/widget_service.c149
22 files changed, 211 insertions, 3 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 215c621..dc4b925 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -29,6 +29,8 @@ pkg_check_modules(pkgs REQUIRED
libtzplatform-config
uuid
cynara-client
+ ecore-wayland
+ iniparser
)
FOREACH(flag ${pkgs_CFLAGS})
@@ -77,6 +79,33 @@ INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/widget_errno.h DESTINATION inc
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/widget_conf.h DESTINATION include/${PROJECT_NAME})
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/widget_instance.h DESTINATION include/${PROJECT_NAME})
+INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/${TARGET}/${PROFILE}.conf.ini DESTINATION /usr/share/${PROJECT_NAME} RENAME "conf.ini" PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ)
+INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/${TARGET}/${PROFILE}.resolution.ini DESTINATION /usr/share/${PROJECT_NAME} RENAME "resolution.ini" PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ)
+
+INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/${TARGET}/wayland.mobile.320x480.conf.ini DESTINATION /usr/share/${PROJECT_NAME}/320x480 RENAME "conf.ini" PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ)
+INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/${TARGET}/wayland.mobile.320x480.resolution.ini DESTINATION /usr/share/${PROJECT_NAME}/320x480 RENAME "resolution.ini" PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ)
+
+INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/${TARGET}/wayland.mobile.480x800.conf.ini DESTINATION /usr/share/${PROJECT_NAME}/480x800 RENAME "conf.ini" PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ)
+INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/${TARGET}/wayland.mobile.480x800.resolution.ini DESTINATION /usr/share/${PROJECT_NAME}/480x800 RENAME "resolution.ini" PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ)
+
+INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/${TARGET}/wayland.wearable.360x480.conf.ini DESTINATION /usr/share/${PROJECT_NAME}/360x480 RENAME "conf.ini" PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ)
+INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/${TARGET}/wayland.wearable.360x480.resolution.ini DESTINATION /usr/share/${PROJECT_NAME}/360x480 RENAME "resolution.ini" PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ)
+
+INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/${TARGET}/wayland.wearable.360x360.conf.ini DESTINATION /usr/share/${PROJECT_NAME}/360x360 RENAME "conf.ini" PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ)
+INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/${TARGET}/wayland.wearable.360x360.resolution.ini DESTINATION /usr/share/${PROJECT_NAME}/360x360 RENAME "resolution.ini" PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ)
+
+INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/${TARGET}/wayland.mobile.conf.ini DESTINATION /usr/share/${PROJECT_NAME}/720x1280 RENAME "conf.ini" PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ)
+INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/${TARGET}/wayland.mobile.resolution.ini DESTINATION /usr/share/${PROJECT_NAME}/720x1280 RENAME "resolution.ini" PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ)
+
+INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/${TARGET}/wayland.wearable.conf.ini DESTINATION /usr/share/${PROJECT_NAME}/320x320 RENAME "conf.ini" PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ)
+INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/${TARGET}/wayland.wearable.resolution.ini DESTINATION /usr/share/${PROJECT_NAME}/320x320 RENAME "resolution.ini" PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ)
+
+INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/${TARGET}/wayland.mobile.540x960.conf.ini DESTINATION /usr/share/${PROJECT_NAME}/540x960 RENAME "conf.ini" PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ)
+INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/${TARGET}/wayland.mobile.540x960.resolution.ini DESTINATION /usr/share/${PROJECT_NAME}/540x960 RENAME "resolution.ini" PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ)
+
+INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/${TARGET}/${PROFILE}.conf.ini DESTINATION /usr/share/${PROJECT_NAME} RENAME "conf.ini" PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ)
+INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/${TARGET}/${PROFILE}.resolution.ini DESTINATION /usr/share/${PROJECT_NAME} RENAME "resolution.ini" PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ)
+
ADD_SUBDIRECTORY(parser)
# End of a file
diff --git a/data/device/wayland.mobile.320x480.resolution.ini b/data/device/wayland.mobile.320x480.resolution.ini
index c848adf..b3a3c24 100644
--- a/data/device/wayland.mobile.320x480.resolution.ini
+++ b/data/device/wayland.mobile.320x480.resolution.ini
@@ -1,3 +1,4 @@
+[resolution]
1x1=0x0
2x1=0x0
2x2=0x0
diff --git a/data/device/wayland.mobile.360x360.resolution.ini b/data/device/wayland.mobile.360x360.resolution.ini
index e69de29..2eea5c6 100644
--- a/data/device/wayland.mobile.360x360.resolution.ini
+++ b/data/device/wayland.mobile.360x360.resolution.ini
@@ -0,0 +1 @@
+[resolution] \ No newline at end of file
diff --git a/data/device/wayland.mobile.360x480.resolution.ini b/data/device/wayland.mobile.360x480.resolution.ini
index e69de29..2eea5c6 100644
--- a/data/device/wayland.mobile.360x480.resolution.ini
+++ b/data/device/wayland.mobile.360x480.resolution.ini
@@ -0,0 +1 @@
+[resolution] \ No newline at end of file
diff --git a/data/device/wayland.mobile.480x800.resolution.ini b/data/device/wayland.mobile.480x800.resolution.ini
index 63ad36e..4a99956 100644
--- a/data/device/wayland.mobile.480x800.resolution.ini
+++ b/data/device/wayland.mobile.480x800.resolution.ini
@@ -1,3 +1,4 @@
+[resolution]
1x1=126x126
2x1=0x0
2x2=0x0
diff --git a/data/device/wayland.mobile.540x960.resolution.ini b/data/device/wayland.mobile.540x960.resolution.ini
index 31566cf..c548e6c 100644
--- a/data/device/wayland.mobile.540x960.resolution.ini
+++ b/data/device/wayland.mobile.540x960.resolution.ini
@@ -1,3 +1,4 @@
+[resolution]
1x1=130x150
2x1=264x150
2x2=264x304
diff --git a/data/device/wayland.mobile.resolution.ini b/data/device/wayland.mobile.resolution.ini
index e2b5a17..ddc9a69 100644
--- a/data/device/wayland.mobile.resolution.ini
+++ b/data/device/wayland.mobile.resolution.ini
@@ -1,3 +1,4 @@
+[resolution]
1x1=175x175
2x1=354x175
2x2=354x354
diff --git a/data/device/wayland.wearable.360x360.resolution.ini b/data/device/wayland.wearable.360x360.resolution.ini
index b54c8a9..a86b0dd 100644
--- a/data/device/wayland.wearable.360x360.resolution.ini
+++ b/data/device/wayland.wearable.360x360.resolution.ini
@@ -1,3 +1,4 @@
+[resolution]
1x1=170x170
2x1=0x0
2x2=360x360
diff --git a/data/device/wayland.wearable.360x480.resolution.ini b/data/device/wayland.wearable.360x480.resolution.ini
index fea1ffa..dca0ab4 100644
--- a/data/device/wayland.wearable.360x480.resolution.ini
+++ b/data/device/wayland.wearable.360x480.resolution.ini
@@ -1,3 +1,4 @@
+[resolution]
1x1=170x170
2x1=0x0
2x2=360x480
diff --git a/data/device/wayland.wearable.resolution.ini b/data/device/wayland.wearable.resolution.ini
index b9e7561..e698e60 100644
--- a/data/device/wayland.wearable.resolution.ini
+++ b/data/device/wayland.wearable.resolution.ini
@@ -1,3 +1,4 @@
+[resolution]
1x1=320x320
2x1=0x0
2x2=320x320
diff --git a/data/emulator/wayland.mobile.320x480.resolution.ini b/data/emulator/wayland.mobile.320x480.resolution.ini
index c848adf..b3a3c24 100644
--- a/data/emulator/wayland.mobile.320x480.resolution.ini
+++ b/data/emulator/wayland.mobile.320x480.resolution.ini
@@ -1,3 +1,4 @@
+[resolution]
1x1=0x0
2x1=0x0
2x2=0x0
diff --git a/data/emulator/wayland.mobile.360x360.resolution.ini b/data/emulator/wayland.mobile.360x360.resolution.ini
index e69de29..2eea5c6 100644
--- a/data/emulator/wayland.mobile.360x360.resolution.ini
+++ b/data/emulator/wayland.mobile.360x360.resolution.ini
@@ -0,0 +1 @@
+[resolution] \ No newline at end of file
diff --git a/data/emulator/wayland.mobile.360x480.resolution.ini b/data/emulator/wayland.mobile.360x480.resolution.ini
index e69de29..2eea5c6 100644
--- a/data/emulator/wayland.mobile.360x480.resolution.ini
+++ b/data/emulator/wayland.mobile.360x480.resolution.ini
@@ -0,0 +1 @@
+[resolution] \ No newline at end of file
diff --git a/data/emulator/wayland.mobile.480x800.resolution.ini b/data/emulator/wayland.mobile.480x800.resolution.ini
index 63ad36e..4a99956 100644
--- a/data/emulator/wayland.mobile.480x800.resolution.ini
+++ b/data/emulator/wayland.mobile.480x800.resolution.ini
@@ -1,3 +1,4 @@
+[resolution]
1x1=126x126
2x1=0x0
2x2=0x0
diff --git a/data/emulator/wayland.mobile.540x960.resolution.ini b/data/emulator/wayland.mobile.540x960.resolution.ini
index 31566cf..c548e6c 100644
--- a/data/emulator/wayland.mobile.540x960.resolution.ini
+++ b/data/emulator/wayland.mobile.540x960.resolution.ini
@@ -1,3 +1,4 @@
+[resolution]
1x1=130x150
2x1=264x150
2x2=264x304
diff --git a/data/emulator/wayland.mobile.resolution.ini b/data/emulator/wayland.mobile.resolution.ini
index e2b5a17..ddc9a69 100644
--- a/data/emulator/wayland.mobile.resolution.ini
+++ b/data/emulator/wayland.mobile.resolution.ini
@@ -1,3 +1,4 @@
+[resolution]
1x1=175x175
2x1=354x175
2x2=354x354
diff --git a/data/emulator/wayland.wearable.360x360.resolution.ini b/data/emulator/wayland.wearable.360x360.resolution.ini
index b54c8a9..a86b0dd 100644
--- a/data/emulator/wayland.wearable.360x360.resolution.ini
+++ b/data/emulator/wayland.wearable.360x360.resolution.ini
@@ -1,3 +1,4 @@
+[resolution]
1x1=170x170
2x1=0x0
2x2=360x360
diff --git a/data/emulator/wayland.wearable.360x480.resolution.ini b/data/emulator/wayland.wearable.360x480.resolution.ini
index fea1ffa..dca0ab4 100644
--- a/data/emulator/wayland.wearable.360x480.resolution.ini
+++ b/data/emulator/wayland.wearable.360x480.resolution.ini
@@ -1,3 +1,4 @@
+[resolution]
1x1=170x170
2x1=0x0
2x2=360x480
diff --git a/data/emulator/wayland.wearable.resolution.ini b/data/emulator/wayland.wearable.resolution.ini
index b9e7561..e698e60 100644
--- a/data/emulator/wayland.wearable.resolution.ini
+++ b/data/emulator/wayland.wearable.resolution.ini
@@ -1,3 +1,4 @@
+[resolution]
1x1=320x320
2x1=0x0
2x2=320x320
diff --git a/include/debug.h b/include/debug.h
index c1cfa3d..d181176 100644
--- a/include/debug.h
+++ b/include/debug.h
@@ -47,5 +47,6 @@ extern FILE *__file_log_fp;
#define _I LOGI
#endif
+#undef EAPI
#define EAPI __attribute__((visibility("default")))
/* End of a file */
diff --git a/packaging/libwidget_service.spec b/packaging/libwidget_service.spec
index 61f8f6d..575b1fa 100644
--- a/packaging/libwidget_service.spec
+++ b/packaging/libwidget_service.spec
@@ -26,6 +26,8 @@ BuildRequires: pkgconfig(libxml-2.0)
BuildRequires: pkgconfig(aul)
BuildRequires: pkgconfig(cynara-client)
BuildRequires: pkgconfig(pkgmgr-installer)
+BuildRequires: pkgconfig(ecore-wayland)
+BuildRequires: pkgconfig(iniparser)
%if "%{model_build_feature_widget}" == "0"
ExclusiveArch:
@@ -48,10 +50,22 @@ cp %{SOURCE1001} .
%build
+%if %{with emulator}
+export TARGET=emulator
+%else
+export TARGET=device
+%endif
+
+%if "%{profile}" != "wearable"
+export PROFILE=wayland.mobile
+%else
+export PROFILE=wayland.wearable
+%endif
+
sqlite3 .widget.db < ./parser/widget.sql
MAJORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $1}'`
-%cmake . -DFULLVER=%{version} -DMAJORVER=${MAJORVER}
+%cmake . -DFULLVER=%{version} -DMAJORVER=${MAJORVER} -DPROFILE=${PROFILE} -DTARGET=${TARGET}
make %{?jobs:-j%jobs}
%install
@@ -83,6 +97,7 @@ chsmack -a "User::Home" %{_sysconfdir}/skel/.applications/dbspace/.widget.db
%{TZ_SYS_DB}/.widget.db
%{TZ_SYS_DB}/.widget.db-journal
%{_bindir}/widget_test
+%{_datarootdir}/widget_service/*
%files devel
%manifest %{name}.manifest
diff --git a/src/widget_service.c b/src/widget_service.c
index 3f29147..ca00c2f 100644
--- a/src/widget_service.c
+++ b/src/widget_service.c
@@ -13,17 +13,19 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
+#include <ctype.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdbool.h>
#include <unistd.h>
#include <sys/types.h>
+#include <iniparser.h>
#include <glib.h>
#include <sqlite3.h>
+#include <Ecore_Wayland.h>
#include <aul.h>
#include <tzplatform_config.h>
#include <pkgmgr-info.h>
@@ -40,10 +42,17 @@
#include "widget_service.h"
#include "widget_service_internal.h"
+#define MAX_COLUMN 80
#define MAX_BUF_SIZE 4096
#define SMACK_LABEL_LEN 255
+#define RESOLUTION_PATH_FORMAT "/usr/share/widget_service/%dx%d/resolution.ini"
+#define RESOLUTION_PATH_DEFAULT "/usr/share/widget_service/resolution.ini"
+#define RESOLUTION_SECTION_NAME "resolution"
+#define RESOLUTION_FORMAT "%dx%d"
+
static GList *lifecycle_cbs;
+static bool _is_resolution_loaded = false;
static inline bool _is_widget_feature_enabled(void)
{
@@ -180,7 +189,6 @@ static void _get_column_int(sqlite3_stmt *stmt, int idx, int *i)
*i = sqlite3_column_int(stmt, idx);
}
-/* TODO: get pixel size type from configuration file */
#define WIDGET_SIZE_TYPE_MAX 13
static int size_list[WIDGET_SIZE_TYPE_MAX][5] = {
{ 1, 1, 175, 175, WIDGET_SIZE_TYPE_1x1 }, /*!< 1x1 */
@@ -198,10 +206,132 @@ static int size_list[WIDGET_SIZE_TYPE_MAX][5] = {
{ 0, 0, 720, 1280, WIDGET_SIZE_TYPE_FULL }, /*!< 0x0 */
};
+static char *_resolution_file_path(void)
+{
+ char *path;
+ int length;
+ int w, h;
+
+ length = strlen(RESOLUTION_PATH_FORMAT) + 12;
+ path = calloc(1, length);
+ if (!path) {
+ _E("calloc: %d\n", errno);
+ return NULL;
+ }
+
+ ecore_wl_screen_size_get(&w, &h);
+ _D("screen size : %d %d", w, h);
+
+ snprintf(path, length, RESOLUTION_PATH_FORMAT, w, h);
+ _D("Selected conf file: %s", path);
+ if (access(path, F_OK) != 0) {
+ _E("Fallback to default, access: %d", errno);
+ strncpy(path, RESOLUTION_PATH_DEFAULT, length);
+ if (access(path, F_OK) != 0) {
+ _E("Serious error - there is no conf file, use default setting: %d\n", errno);
+ free(path);
+ path = NULL;
+ }
+ }
+
+ return path;
+}
+
+static void _resolution_update_size_list(int width_type, int height_type, int width, int height)
+{
+ int idx = 0;
+
+ if (width_type == 1 && height_type == 1) {
+ idx = 0;
+ } else if (width_type == 2 && height_type == 1) {
+ idx = 1;
+ } else if (width_type == 2 && height_type == 2) {
+ idx = 2;
+ } else if (width_type == 4 && height_type == 1) {
+ idx = 3;
+ } else if (width_type == 4 && height_type == 2) {
+ idx = 4;
+ } else if (width_type == 4 && height_type == 3) {
+ idx = 5;
+ } else if (width_type == 4 && height_type == 4) {
+ idx = 6;
+ } else if (width_type == 4 && height_type == 5) {
+ idx = 7;
+ } else if (width_type == 4 && height_type == 6) {
+ idx = 8;
+ } else if (width_type == 21 && height_type == 21) {
+ idx = 9;
+ } else if (width_type == 23 && height_type == 21) {
+ idx = 10;
+ } else if (width_type == 23 && height_type == 23) {
+ idx = 11;
+ } else if (width_type == 0 && height_type == 0) {
+ idx = 12;
+ } else {
+ _E("Unknown size type: %dx%d (%dx%d)\n", width_type, height_type, width, height);
+ return;
+ }
+
+ size_list[idx][2] = width;
+ size_list[idx][3] = height;
+}
+
+static int _resolution_update_from_file(void)
+{
+ int width_type = 0;
+ int height_type = 0;
+ int width = 0;
+ int height = 0;
+ char *type_str;
+ char *size_str;
+ dictionary *dic;
+ char *file_path = NULL;
+ int key_num;
+ char **key_list;
+ char key_format[MAX_COLUMN];
+ int i;
+
+ file_path = _resolution_file_path();
+ if (file_path == NULL)
+ return WIDGET_ERROR_OUT_OF_MEMORY;
+
+ dic = iniparser_load(file_path);
+ if (dic == NULL) {
+ _E("fail to load [%s] ", file_path);
+ return WIDGET_ERROR_IO_ERROR;
+ }
+ snprintf(key_format, sizeof(key_format), "%s:%s",
+ RESOLUTION_SECTION_NAME, RESOLUTION_FORMAT);
+ key_num = iniparser_getsecnkeys(dic, RESOLUTION_SECTION_NAME);
+ key_list = iniparser_getseckeys(dic, RESOLUTION_SECTION_NAME);
+ for (i = 0; i < key_num; i++) {
+ type_str = key_list[i];
+ size_str = iniparser_getstring(dic, type_str, NULL);
+ if (sscanf(type_str, key_format, &width_type, &height_type) != 2) {
+ _E("Invalid syntax: [%s]", type_str);
+ continue;
+ }
+
+ if (sscanf(size_str, "%dx%d", &width, &height) != 2) {
+ _E("Invalid syntax: [%s]", size_str);
+ continue;
+ }
+ _resolution_update_size_list(width_type, height_type, width, height);
+ }
+ iniparser_freedict(dic);
+
+ return WIDGET_ERROR_NONE;
+}
+
static int _get_supported_size_type(int width, int height, int *type)
{
int i;
+ if (!_is_resolution_loaded) {
+ _resolution_update_from_file();
+ _is_resolution_loaded = true;
+ }
+
for (i = 0; i < WIDGET_SIZE_TYPE_MAX; i++) {
if (width == size_list[i][2] && height == size_list[i][3])
break;
@@ -221,6 +351,11 @@ static int _get_supported_size(int type, int *width, int *height)
{
int i;
+ if (!_is_resolution_loaded) {
+ _resolution_update_from_file();
+ _is_resolution_loaded = true;
+ }
+
for (i = 0; i < WIDGET_SIZE_TYPE_MAX; i++) {
if (type == size_list[i][4])
break;
@@ -242,6 +377,11 @@ static int _convert_to_support_size(int *width, int *height, int count)
int i;
int j;
+ if (!_is_resolution_loaded) {
+ _resolution_update_from_file();
+ _is_resolution_loaded = true;
+ }
+
for (j = 0; j < count; j++) {
for (i = 0; i < WIDGET_SIZE_TYPE_MAX; i++) {
if (size_list[i][0] == width[j] &&
@@ -263,6 +403,11 @@ static int _convert_to_support_size_ratio(int width, int height, int *w, int *h)
{
int i;
+ if (!_is_resolution_loaded) {
+ _resolution_update_from_file();
+ _is_resolution_loaded = true;
+ }
+
for (i = 0; i < WIDGET_SIZE_TYPE_MAX; i++) {
if (size_list[i][2] == width &&
size_list[i][3] == height)