From e6494a0c49aedae3cfade6caca66f2616e6e5e83 Mon Sep 17 00:00:00 2001 From: Jaeho Lee Date: Tue, 20 Nov 2012 18:07:36 +0900 Subject: [PATCH] fixed rotation bug --- packaging/app-core.spec | 2 +- src/appcore-rotation.c | 66 ++++++++----------------------------------------- src/appcore.c | 2 +- 3 files changed, 12 insertions(+), 58 deletions(-) diff --git a/packaging/app-core.spec b/packaging/app-core.spec index c4ec025..4158c12 100644 --- a/packaging/app-core.spec +++ b/packaging/app-core.spec @@ -2,7 +2,7 @@ Name: app-core Summary: Application basic Version: 1.2 -Release: 34 +Release: 36 Group: TO_BE/FILLED_IN License: Apache License, Version 2.0 Source0: app-core-%{version}.tar.gz diff --git a/src/appcore-rotation.c b/src/appcore-rotation.c index 78b60ba..e876439 100755 --- a/src/appcore-rotation.c +++ b/src/appcore-rotation.c @@ -79,10 +79,6 @@ static struct rot_evt re_to_rm[] = { }, }; -static enum appcore_rm changed_m; -static void *changed_data; -static Ecore_Event_Handler *changed_handle; - static enum appcore_rm __get_mode(int event_data) { int i; @@ -100,34 +96,12 @@ static enum appcore_rm __get_mode(int event_data) return m; } -static Eina_Bool __property(void *data, int type, void *event) -{ - Ecore_X_Event_Window_Property *ev = event; - - if (!ev) - return ECORE_CALLBACK_PASS_ON; - - if (ev->atom == ATOM_ROTATION_LOCK) { - _DBG("[APP %d] Rotation: %d -> %d, cb_set : %d", getpid(), rot.mode, changed_m, rot.cb_set); - if (rot.cb_set && rot.mode != changed_m) { - rot.callback(changed_m, changed_data); - rot.mode = changed_m; - } - - ecore_event_handler_del(changed_handle); - changed_handle = NULL; - } - - return ECORE_CALLBACK_PASS_ON; -} - static void __changed_cb(unsigned int event_type, sensor_event_data_t *event, void *data) { int *cb_event_data; enum appcore_rm m; int ret; - int val; if (rot.lock) return; @@ -145,22 +119,10 @@ static void __changed_cb(unsigned int event_type, sensor_event_data_t *event, if (rot.callback) { if (rot.cb_set && rot.mode != m) { - ret = ecore_x_window_prop_card32_get(root, ATOM_ROTATION_LOCK, &val, 1); - - _DBG("[APP %d] Rotation: %d -> %d, val : %d, ret : %d", getpid(), rot.mode, m, val, ret); - if (!val || ret < 1) { - rot.callback(m, data); - rot.mode = m; - } else { - changed_data = data; - if(changed_handle) { - ecore_event_handler_del(changed_handle); - changed_handle = NULL; - } - changed_handle = ecore_event_handler_add(ECORE_X_EVENT_WINDOW_PROPERTY, __property, NULL); - } + _DBG("[APP %d] Rotation: %d -> %d", getpid(), rot.mode, m); + rot.callback(m, data); + rot.mode = m; } - changed_m = m; } } @@ -169,11 +131,15 @@ static void __lock_cb(keynode_t *node, void *data) int r; enum appcore_rm m; int ret; - int val; rot.lock = vconf_keynode_get_bool(node); if (rot.lock) { + m = APPCORE_RM_PORTRAIT_NORMAL; + if (rot.mode != m) { + rot.callback(m, data); + rot.mode = m; + } _DBG("[APP %d] Rotation locked", getpid()); return; } @@ -185,21 +151,9 @@ static void __lock_cb(keynode_t *node, void *data) _DBG("[APP %d] Rotmode prev %d -> curr %d", getpid(), rot.mode, m); if (!r && rot.mode != m) { - if(!val) { - rot.callback(m, data); - rot.mode = m; - } else { - changed_data = data; - if(changed_handle) { - ecore_event_handler_del(changed_handle); - changed_handle = NULL; - } - changed_handle = ecore_event_handler_add(ECORE_X_EVENT_WINDOW_PROPERTY, __property, NULL); - } + rot.callback(m, data); + rot.mode = m; } - - if(!r) - changed_m = m; } } } diff --git a/src/appcore.c b/src/appcore.c index fa316b8..9e08062 100755 --- a/src/appcore.c +++ b/src/appcore.c @@ -40,7 +40,7 @@ #define SQLITE_FLUSH_MAX (1024*1024) #define PKGNAME_MAX 256 -#define PATH_APP_ROOT "/opt/apps" +#define PATH_APP_ROOT "/opt/usr/apps" #define PATH_RO_APP_ROOT "/usr/apps" #define PATH_RES "/res" #define PATH_LOCALE "/locale" -- 2.7.4