appcore passes system event information to application.
Change-Id: Iad10469457c96c331dd260415f5238e6978419ba
Signed-off-by: Jiwoong Im <jiwoong.im@samsung.com>
*
*/
int appcore_set_event_callback(enum appcore_event event,
- int (*cb)(void *), void *data);
+ int (*cb)(void *, void *), void *data);
/**
* @par Description:
* @endcode
*
*/
-int appcore_set_rotation_cb(int (*cb) (enum appcore_rm, void *),
+int appcore_set_rotation_cb(int (*cb) (void *event_info, enum appcore_rm, void *),
void *data);
/**
* Appcore system event operation
*/
struct sys_op {
- int (*func) (void *);
+ int (*func) (void *, void *);
void *data;
};
int appcore_resume_rotation_cb(void);
struct ui_wm_rotate {
- int (*set_rotation_cb) (int (*cb) (enum appcore_rm, void *), void *data);
+ int (*set_rotation_cb) (int (*cb) (void *event_info, enum appcore_rm, void *), void *data);
int (*unset_rotation_cb) (void);
int (*get_rotation_state) (enum appcore_rm *curr);
int (*pause_rotation_cb) (void);
/* WM_ROTATE */
int wm_rot_supported;
int rot_started;
- int (*rot_cb) (enum appcore_rm, void *);
+ int (*rot_cb) (void *event_info, enum appcore_rm, void *);
void *rot_cb_data;
enum appcore_rm rot_mode;
};
ui->rot_mode = rm;
if (APPCORE_RM_UNKNOWN != rm) {
- ui->rot_cb(rm, ui->rot_cb_data);
+ ui->rot_cb((void *)&rm, rm, ui->rot_cb_data);
}
}
}
/* WM_ROTATE */
-static int __wm_set_rotation_cb(int (*cb) (enum appcore_rm, void *), void *data)
+static int __wm_set_rotation_cb(int (*cb) (void *event_info, enum appcore_rm, void *), void *data)
{
if (cb == NULL) {
errno = EINVAL;
struct rot_s {
int handle;
- int (*callback) (enum appcore_rm, void *);
+ int (*callback) (void *event_info, enum appcore_rm, void *);
enum appcore_rm mode;
int lock;
void *cbdata;
if (rot.callback) {
if (rot.cb_set && rot.mode != m) {
_DBG("[APP %d] Rotation: %d -> %d", getpid(), rot.mode, m);
- rot.callback(m, data);
+ rot.callback((void *)&m, m, data);
rot.mode = m;
}
}
if (rot.lock) {
m = APPCORE_RM_PORTRAIT_NORMAL;
if (rot.mode != m) {
- rot.callback(m, data);
+ rot.callback((void *)&m, m, data);
rot.mode = m;
}
_DBG("[APP %d] Rotation locked", getpid());
_DBG("[APP %d] Rotmode prev %d -> curr %d", getpid(),
rot.mode, m);
if (!r && rot.mode != m) {
- rot.callback(m, data);
+ rot.callback((void *)&m, m, data);
rot.mode = m;
}
}
rot.lock = 0;
}
-EXPORT_API int appcore_set_rotation_cb(int (*cb) (enum appcore_rm, void *),
+EXPORT_API int appcore_set_rotation_cb(int (*cb) (void *evnet_info, enum appcore_rm, void *),
void *data)
{
if (rot.wm_rotate) {
r = appcore_get_rotation_state(&m);
_DBG("[APP %d] Rotmode prev %d -> curr %d", getpid(), rot.mode, m);
if (!r && rot.mode != m && rot.lock == 0) {
- rot.callback(m, rot.cbdata);
+ rot.callback((void *)&m, m, rot.cbdata);
rot.mode = m;
}
}
return r;
}
-static int __sys_do(struct appcore *ac, enum sys_event event)
+static int __sys_do(struct appcore *ac, void *event_info, enum sys_event event)
{
struct sys_op *op;
if (op->func == NULL)
return __sys_do_default(ac, event);
- return op->func(op->data);
+ return op->func(event_info, op->data);
}
static int __sys_lowmem_post(void *data, void *evt)
val = vconf_keynode_get_int(key);
if (val >= VCONFKEY_SYSMAN_LOW_MEMORY_SOFT_WARNING)
- return __sys_do(data, SE_LOWMEM);
+ return __sys_do(data, (void *)&val, SE_LOWMEM);
return 0;
}
/* VCONFKEY_SYSMAN_BAT_CRITICAL_LOW or VCONFKEY_SYSMAN_POWER_OFF */
if (val <= VCONFKEY_SYSMAN_BAT_CRITICAL_LOW)
- return __sys_do(data, SE_LOWBAT);
+ return __sys_do(data, (void *)&val, SE_LOWBAT);
return 0;
}
static int __sys_langchg(void *data, void *evt)
{
- return __sys_do(data, SE_LANGCHG);
+ keynode_t *key = evt;
+ char *val;
+
+ val = vconf_keynode_get_str(key);
+
+ return __sys_do(data, (void *)val, SE_LANGCHG);
}
static int __sys_regionchg_pre(void *data, void *evt)
static int __sys_regionchg(void *data, void *evt)
{
- return __sys_do(data, SE_REGIONCHG);
+ keynode_t *key = evt;
+ char *val = NULL;
+ const char *name;
+
+ name = vconf_keynode_get_name(key);
+ if (!strcmp(name, VCONFKEY_REGIONFORMAT))
+ val = vconf_keynode_get_str(key);
+
+ return __sys_do(data, (void *)val, SE_REGIONCHG);
}
static void __vconf_do(struct evt_ops *eo, keynode_t * key, void *data)
}
EXPORT_API int appcore_set_event_callback(enum appcore_event event,
- int (*cb) (void *), void *data)
+ int (*cb) (void *, void *), void *data)
{
struct appcore *ac = &core;
struct sys_op *op;