summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHwankyu Jhun <h.jhun@samsung.com>2015-11-17 17:50:28 -0800
committerGerrit Code Review <gerrit@review.vlan103.tizen.org>2015-11-17 17:50:28 -0800
commit4bdaf122f91ef664e3f6482cd1df1e1c0663fcb2 (patch)
treefe15cc8312c20703ba513aeb2ed46dd825c31550
parenteb377fe9c8ed16e8ce421e169af8268161368129 (diff)
parentb8defb1496f169338e3b806cd9c8c90e1e9c174a (diff)
downloadapp-core-4bdaf122f91ef664e3f6482cd1df1e1c0663fcb2.tar.gz
app-core-4bdaf122f91ef664e3f6482cd1df1e1c0663fcb2.tar.bz2
app-core-4bdaf122f91ef664e3f6482cd1df1e1c0663fcb2.zip
-rw-r--r--include/appcore-common.h72
-rw-r--r--include/appcore-internal.h13
-rw-r--r--src/appcore-X.c14
-rw-r--r--src/appcore-efl.c8
-rw-r--r--src/appcore-i18n.c17
-rw-r--r--src/appcore-rotation.c45
-rw-r--r--src/appcore-util.c2
7 files changed, 81 insertions, 90 deletions
diff --git a/include/appcore-common.h b/include/appcore-common.h
index e3d8304..a130336 100644
--- a/include/appcore-common.h
+++ b/include/appcore-common.h
@@ -143,10 +143,10 @@ struct appcore_ops {
*
* @par Typical use case:
* To do something when predefined events (enum appcore_event) occur, use this API
- *
+ *
* @par Method of function operation:
* Using Heynoti subscription, Vconf changed callback, and AUL, Appcore invokes the registered callback function.
- *
+ *
* @par Important notes:
* Only one callback function can be set. If <I>cb</I> is NULL, unset the callback function about the event.\n
* Default behavior is performed when the specified event callback doesn't have registered.
@@ -155,7 +155,7 @@ struct appcore_ops {
* @param[in] cb callback function
* @param[in] data callback function data
*
- * @return 0 on success, -1 on error (<I>errno</I> set)
+ * @return 0 on success, -1 on error (<I>errno</I> set)
*
* @par Errors:
* EINVAL - Invalid event type
@@ -221,18 +221,18 @@ int appcore_set_event_callback(enum appcore_event event,
*
* @par Typical use case:
* To do something when the rotation mode is changed, use this API
- *
+ *
* @par Method of function operation:
* Appcore receives rotation change from Sensor framework. When Appcore receive the change, it invokes the registered callback function.
- *
+ *
* @par Important notes:
* Locks the rotation mode, the registered callback is not invoked.
*
* @param[in] cb callback function
* @param[in] data callback function data
*
- * @return 0 on success, -1 on error (<I>errno</I> set)
- *
+ * @return 0 on success, -1 on error (<I>errno</I> set)
+ *
* @par Errors:
* EINVAL - <I>cb</I> is NULL
* EALREADY - rotation callback function already registered
@@ -275,7 +275,7 @@ int appcore_set_rotation_cb(int (*cb) (void *event_info, enum appcore_rm, void *
* This function unsets a callback function for rotation events.
*
* @return 0 on success, -1 on error
- *
+ *
* @pre Callback is set by appcore_set_rotation_cb().
* @post None.
* @see appcore_set_rotation_cb(), appcore_get_rotation_state()
@@ -312,12 +312,12 @@ int appcore_unset_rotation_cb(void);
*
* @par Method of function operation:
* This function gets the current rotation mode from Sensor framework.
- *
+ *
* @param[out] curr current rotation mode\n
* If Sensor framework is not working, curr is set to APPCORE_RM_UNKNOWN.
*
- * @return 0 on success, -1 on error (<I>errno</I> set)
- *
+ * @return 0 on success, -1 on error (<I>errno</I> set)
+ *
* @par Errors:
* EINVAL - <I>curr</I> is NULL
*
@@ -337,7 +337,7 @@ int appcore_unset_rotation_cb(void);
enum appcore_rm curr;
...
-
+
r = appcore_get_rotation_state(&curr);
if (r == -1) {
// add exception handling
@@ -358,12 +358,12 @@ int appcore_get_rotation_state(enum appcore_rm *curr);
*
* @par Method of function operation:
* This function gets the current time format from vconf.
- *
+ *
* @param[out] timeformat current time format\n
* If vconf is not working, timeformat is set to APPCORE_TIME_FORMAT_UNKNOWN.
*
- * @return 0 on success, -1 on error (<I>errno</I> set)
- *
+ * @return 0 on success, -1 on error (<I>errno</I> set)
+ *
* @par Errors:
* EINVAL - <I>timeformat</I> is NULL
*
@@ -383,7 +383,7 @@ int appcore_get_rotation_state(enum appcore_rm *curr);
enum appcore_time_format timeformat;
...
-
+
r = appcore_get_timeformat(&timeformat);
if (r == -1) {
// add exception handling
@@ -404,18 +404,18 @@ int appcore_get_timeformat(enum appcore_time_format *timeformat);
*
* @par Typical use case:
* This function provides convenience for using gettext.
- *
+ *
* @par Method of function operation:
* Calls setlocale(), bindtextdomain() and textdomain() internally.
- *
+ *
* @par Corner cases/exceptions:
* If <I>dirname</I> is NULL, the previously set base directory is used. Typically, it is /usr/share/locale.
*
* @param[in] domainname a message domain name(text domain name) \n Must be a non-empty string.
- * @param[in] dirname the base directory for message catalogs belonging to the specified domain \n
+ * @param[in] dirname the base directory for message catalogs belonging to the specified domain \n
+ *
+ * @return 0 on success, -1 on error (<I>errno</I> set)
*
- * @return 0 on success, -1 on error (<I>errno</I> set)
- *
* @par Errors:
* EINVAL - <I>domain</I> is NULL
*
@@ -437,7 +437,7 @@ int appcore_get_timeformat(enum appcore_time_format *timeformat);
r = appcore_set_i18n("i18n_example", NULL);
if (r == -1) {
- // add exception handling
+ // add exception handling
}
...
}
@@ -448,18 +448,18 @@ int appcore_set_i18n(const char *domainname, const char *dirname);
/**
* @par Description:
- * Set the measuring start time
+ * Set the measuring start time
*
* @par Purpose:
* To measure the time, the start time should be set. This function set the start point.
*
* @par Typical use case:
* It is used to measure the time for doing something. \n
- * This function set the start point. And, appcore_measure_time() returns
+ * This function set the start point. And, appcore_measure_time() returns
* the elapsed time from the start point.
*
* @see appcore_measure_time()
- *
+ *
* @par Method of function operation:
* Store the current time to the internal variable.
*
@@ -499,7 +499,7 @@ void appcore_measure_start(void);
* This function returns the elapsed time from the start point set by appcore_measure_start().
*
* @see appcore_measure_start()
- *
+ *
* @par Method of function operation:
* This function subtracts the current time from the start point.
*
@@ -544,7 +544,7 @@ int appcore_measure_time(void);
* This function returns the elapsed time from a time specified in environment variable.
*
* @see appcore_measure_start()
- *
+ *
* @par Method of function operation:
* This function subtracts the current time from a time specified in environment variable.
*
@@ -552,7 +552,7 @@ int appcore_measure_time(void);
* If <I>envnm</I> is NULL, "APP_START_TIME" set by launcher is used.
* If the environment variable is not set or invalid format, returns 0.
*
- * @param[in] envnm environment variable name which has
+ * @param[in] envnm environment variable name which has
* the start time (format: "%u %u", seconds, micro seconds)
*
* @return Milliseconds from a time specified in environment variable
@@ -570,9 +570,9 @@ int appcore_measure_time(void);
{
...
- // do something
+ // do something
- printf("it takes %d msec from APP_START\n",
+ printf("it takes %d msec from APP_START\n",
appcore_measure_time_from("APP_START_TIME"));
...
}
@@ -589,7 +589,7 @@ struct ui_ops;
/**
* @par Description:
* Appcore init. Internal use only
- *
+ *
* @par Important notes:
* Except special case, NEVER use this. Use the appcore EFL or GTK instead of this.
*
@@ -616,7 +616,7 @@ int appcore_init(const char *name, const struct ui_ops *ops,
/**
* @par Description:
* Appcore exit. Internal use only.
- *
+ *
* @par Important notes:
* Except special case, NEVER use this.
*
@@ -641,9 +641,9 @@ void appcore_exit(void);
* sqlite3_release_memory() if sqlite3 is used, and malloc_trim(). Also, trims native stack.
*
* @par Important notes:
- * Currently, this function is automatically called in the following 2 cases:\n
+ * Currently, this function is automatically called in the following 2 cases:\n
* (1) when the application enters into the pause state and\n
- * (2) when low memory event is invoked and the application is on pause.\n
+ * (2) when low memory event is invoked and the application is on pause.\n
* Developers can use this function when they want extra memory flush utility.
*
* @return 0 on success, -1 on error
@@ -678,8 +678,8 @@ int appcore_flush_memory(void);
/**
* @par Description:
* Set a open callback
- * Only when application is running, if aul_open api is called, then this callback function is called.
- * If your open_cb function return -1, then appcore doesn't raise window.
+ * Only when application is running, if aul_open api is called, then this callback function is called.
+ * If your open_cb function return -1, then appcore doesn't raise window.
*
* @param[in] cb callback function
* @param[in] data callback function data
diff --git a/include/appcore-internal.h b/include/appcore-internal.h
index 0e3c0d8..7bd3db8 100644
--- a/include/appcore-internal.h
+++ b/include/appcore-internal.h
@@ -179,17 +179,20 @@ int appcore_pause_rotation_cb(void);
int appcore_resume_rotation_cb(void);
struct ui_wm_rotate {
- 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);
- int (*resume_rotation_cb) (void);
+ 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);
+ int (*resume_rotation_cb) (void);
};
int appcore_set_wm_rotation(struct ui_wm_rotate* wm_rotate);
void appcore_group_attach();
void appcore_group_lower();
unsigned int appcore_get_main_window(void);
+#if defined(WAYLAND)
+unsigned int appcore_get_main_surface(void);
+#endif
void appcore_get_app_core(struct appcore **ac);
#ifdef _APPFW_FEATURE_BACKGROUND_MANAGEMENT
int _appcore_init_suspend_dbus_handler(void *data);
diff --git a/src/appcore-X.c b/src/appcore-X.c
index 7faa260..b87f3bf 100644
--- a/src/appcore-X.c
+++ b/src/appcore-X.c
@@ -106,18 +106,18 @@ static int __find_win(Display *d, Window *win, pid_t pid)
static void __add_win_list(Eina_List **list, Window *win)
{
- Window w;
+ void *w;
Eina_List *l;
if (!list || !win)
return;
EINA_LIST_FOREACH(*list, l, w) {
- if (w == *win)
+ if ((Window)w == *win)
return;
}
- *list = eina_list_append(*list, *win);
+ *list = eina_list_append(*list, (void *)*win);
}
static void __foreach_win(Eina_List **list, Display *d, Window *win, pid_t pid)
@@ -134,23 +134,23 @@ static void __foreach_win(Eina_List **list, Display *d, Window *win, pid_t pid)
r = XQueryTree(d, *win, &root, &parent, &child, &n);
if (r) {
- for (i = 0; i < n; i++) {
+ for (i = 0; i < n; i++)
__foreach_win(list, d, &child[i], pid);
- }
+
XFree(child);
}
}
static int __iconify_win(Eina_List *list, Display *d)
{
- Window w;
+ void *w;
Eina_List *l;
if (!list || !d)
return -1;
EINA_LIST_FOREACH(list, l, w) {
- XIconifyWindow(d, w, 0);
+ XIconifyWindow(d, (Window)w, 0);
}
return 0;
diff --git a/src/appcore-efl.c b/src/appcore-efl.c
index 7542cd1..a261aa4 100644
--- a/src/appcore-efl.c
+++ b/src/appcore-efl.c
@@ -128,7 +128,9 @@ struct win_node {
bool bfobscured;
};
+#if defined(X11)
static struct ui_wm_rotate wm_rotate;
+#endif
static Eina_Bool __visibility_cb(void *data, int type, void *event);
static void _send_to_resourced(enum proc_status_type type)
@@ -699,8 +701,6 @@ static Eina_Bool __show_cb(void *data, int type, void *event)
#elif defined(X11)
Ecore_X_Event_Window_Show *ev;
- int ret;
- Ecore_X_Window parent;
ev = event;
@@ -793,7 +793,7 @@ static Eina_Bool __visibility_cb(void *data, int type, void *event)
}
-#ifdef X11
+#if defined(X11)
/* WM_ROTATE */
static Eina_Bool __cmsg_cb(void *data, int type, void *event)
{
@@ -1018,6 +1018,7 @@ static void __unset_data(struct ui_priv *ui)
memset(ui, 0, sizeof(struct ui_priv));
}
+#if defined(X11)
/* WM_ROTATE */
static int __wm_set_rotation_cb(int (*cb) (void *event_info, enum appcore_rm, void *), void *data)
{
@@ -1087,6 +1088,7 @@ static struct ui_wm_rotate wm_rotate = {
__wm_pause_rotation_cb,
__wm_resume_rotation_cb
};
+#endif
EXPORT_API int appcore_efl_init(const char *name, int *argc, char ***argv,
struct appcore_ops *ops)
diff --git a/src/appcore-i18n.c b/src/appcore-i18n.c
index ef2c95b..ae853f6 100644
--- a/src/appcore-i18n.c
+++ b/src/appcore-i18n.c
@@ -68,9 +68,9 @@ void update_region(void)
setenv("LC_MEASUREMENT", region, 1);
setenv("LC_IDENTIFICATION", region, 1);
r = setlocale(LC_ALL, "");
- if (r == NULL) {
+ if (r == NULL)
_DBG("*****appcore setlocale=%s\n", r);
- }
+
free(region);
}
}
@@ -90,27 +90,20 @@ static int __set_i18n(const char *domain, const char *dir)
r = setlocale(LC_ALL, vconf_get_str(VCONFKEY_LANGSET));
_DBG("*****appcore setlocale=%s\n", r);
}
- if (r == NULL) {
+ if (r == NULL)
_ERR("appcore: setlocale() error");
- }
- //_retvm_if(r == NULL, -1, "appcore: setlocale() error");
r = bindtextdomain(domain, dir);
- if (r == NULL) {
+ if (r == NULL)
_ERR("appcore: bindtextdomain() error");
- }
- //_retvm_if(r == NULL, -1, "appcore: bindtextdomain() error");
r = textdomain(domain);
- if (r == NULL) {
+ if (r == NULL)
_ERR("appcore: textdomain() error");
- }
- //_retvm_if(r == NULL, -1, "appcore: textdomain() error");
return 0;
}
-
EXPORT_API int appcore_set_i18n(const char *domainname, const char *dirname)
{
int r;
diff --git a/src/appcore-rotation.c b/src/appcore-rotation.c
index f0280f0..fec0ed5 100644
--- a/src/appcore-rotation.c
+++ b/src/appcore-rotation.c
@@ -33,15 +33,15 @@
#include <Ecore_X.h>
#include <X11/Xlib.h>
-/*Fixme: to be added for wayland works*/
-#define _MAKE_ATOM(a, s) \
- do { \
- a = ecore_x_atom_get(s); \
- if (!a) \
- _ERR("##s creation failed.\n"); \
- } while(0)
+/* Fixme: to be added for wayland works */
+#define _MAKE_ATOM(a, s) \
+ do { \
+ a = ecore_x_atom_get(s); \
+ if (!a) \
+ _ERR("##s creation failed.\n"); \
+ } while (0)
-#define STR_ATOM_ROTATION_LOCK "_E_ROTATION_LOCK"
+#define STR_ATOM_ROTATION_LOCK "_E_ROTATION_LOCK"
static Ecore_X_Atom ATOM_ROTATION_LOCK = 0;
static Ecore_X_Window root;
@@ -106,7 +106,6 @@ static void __changed_cb(unsigned int event_type, sensor_event_data_t *event,
{
int *cb_event_data;
enum appcore_rm m;
- int ret;
if (rot.lock)
return;
@@ -135,7 +134,6 @@ static void __lock_cb(keynode_t *node, void *data)
{
int r;
enum appcore_rm m;
- int ret;
rot.lock = !vconf_keynode_get_bool(node);
@@ -170,9 +168,8 @@ static void __add_rotlock(void *data)
lock = 0;
r = vconf_get_bool(VCONFKEY_SETAPPL_AUTO_ROTATE_SCREEN_BOOL, &lock);
- if (r) {
+ if (r)
_DBG("[APP %d] Rotation vconf get bool failed", getpid());
- }
rot.lock = !lock;
@@ -189,9 +186,8 @@ static void __del_rotlock(void)
EXPORT_API int appcore_set_rotation_cb(int (*cb) (void *evnet_info, enum appcore_rm, void *),
void *data)
{
- if (rot.wm_rotate) {
+ if (rot.wm_rotate)
return rot.wm_rotate->set_rotation_cb(cb, data);
- }
else {
int r;
int handle;
@@ -228,9 +224,9 @@ EXPORT_API int appcore_set_rotation_cb(int (*cb) (void *evnet_info, enum appcore
if (r < 0) {
_ERR("sf_start failed: %d", r);
r = sf_unregister_event(handle, ACCELEROMETER_EVENT_ROTATION_CHECK);
- if (r < 0) {
+ if (r < 0)
_ERR("sf_unregister_event failed: %d", r);
- }
+
rot.callback = NULL;
rot.cbdata = NULL;
rot.cb_set = 0;
@@ -244,7 +240,7 @@ EXPORT_API int appcore_set_rotation_cb(int (*cb) (void *evnet_info, enum appcore
__add_rotlock(data);
#ifdef X11
- _MAKE_ATOM(ATOM_ROTATION_LOCK, STR_ATOM_ROTATION_LOCK );
+ _MAKE_ATOM(ATOM_ROTATION_LOCK, STR_ATOM_ROTATION_LOCK);
root = ecore_x_window_root_first_get();
XSelectInput(ecore_x_display_get(), root, PropertyChangeMask);
#endif
@@ -254,9 +250,8 @@ EXPORT_API int appcore_set_rotation_cb(int (*cb) (void *evnet_info, enum appcore
EXPORT_API int appcore_unset_rotation_cb(void)
{
- if (rot.wm_rotate) {
+ if (rot.wm_rotate)
return rot.wm_rotate->unset_rotation_cb();
- }
else {
int r;
@@ -297,9 +292,8 @@ EXPORT_API int appcore_unset_rotation_cb(void)
EXPORT_API int appcore_get_rotation_state(enum appcore_rm *curr)
{
- if (rot.wm_rotate) {
+ if (rot.wm_rotate)
return rot.wm_rotate->get_rotation_state(curr);
- }
else {
int r;
unsigned long event;
@@ -323,9 +317,8 @@ EXPORT_API int appcore_get_rotation_state(enum appcore_rm *curr)
EXPORT_API int appcore_pause_rotation_cb(void)
{
- if (rot.wm_rotate) {
+ if (rot.wm_rotate)
return rot.wm_rotate->pause_rotation_cb();
- }
else {
int r;
@@ -360,11 +353,11 @@ EXPORT_API int appcore_pause_rotation_cb(void)
EXPORT_API int appcore_resume_rotation_cb(void)
{
- if (rot.wm_rotate) {
+ if (rot.wm_rotate)
return rot.wm_rotate->resume_rotation_cb();
- }
else {
- int r,ret;
+ int r;
+ int ret;
enum appcore_rm m;
_retv_if(rot.callback == NULL, 0);
diff --git a/src/appcore-util.c b/src/appcore-util.c
index f0cb2fe..9e2ede7 100644
--- a/src/appcore-util.c
+++ b/src/appcore-util.c
@@ -28,7 +28,7 @@
#include "appcore-internal.h"
-#define GETSP() ({ unsigned int sp; asm volatile ("mov %0,sp " : "=r"(sp) ); sp;})
+#define GETSP() ({ unsigned int sp; asm volatile ("mov %0,sp " : "=r"(sp)); sp; })
#define BUF_SIZE 256
#define PAGE_SIZE (1 << 12)
#define _ALIGN_UP(addr , size) (((addr)+((size)-1))&(~((size)-1)))