Revise the code.
authorSung-jae Park <nicesj.park@samsung.com>
Mon, 13 Jan 2014 01:52:02 +0000 (10:52 +0900)
committerSung-jae Park <nicesj.park@samsung.com>
Mon, 13 Jan 2014 01:52:02 +0000 (10:52 +0900)
configuration value should be grouped in conf.c
so the event_filter is moved into the conf.c file from the livebox.c

Change-Id: I1fa023986164d695416c8bea0a3a1ac477f11142

include/conf.h
src/conf.c
src/livebox.c

index 487aea1..83f2ff4 100644 (file)
@@ -36,5 +36,7 @@ extern void conf_set_frame_drop_for_resizing(int flag);
 extern int conf_frame_drop_for_resizing(void);
 extern void conf_set_shared_content(int flag);
 extern int conf_shared_content(void);
+extern double conf_event_filter(void);
+extern void conf_set_event_filter(double filter);
 
 /* End of a file */
index 95446aa..1c1f898 100644 (file)
@@ -4,10 +4,14 @@ static struct info {
        int manual_sync;
        int frame_drop_for_resizing;
        int shared_content;
+
+       double event_filter;
 } s_info = {
        .manual_sync = 0,
        .frame_drop_for_resizing = 1,
        .shared_content = 0,
+
+       .event_filter = 0.01f,
 };
 
 void conf_set_manual_sync(int flag)
@@ -40,4 +44,14 @@ int conf_shared_content(void)
        return s_info.shared_content;
 }
 
+double conf_event_filter(void)
+{
+       return s_info.event_filter;
+}
+
+void conf_set_event_filter(double filter)
+{
+       s_info.event_filter = filter;
+}
+
 /* End of a file */
index d8c6bc2..42e845c 100644 (file)
@@ -44,7 +44,6 @@
 #include "conf.h"
 
 #define EAPI __attribute__((visibility("default")))
-#define MINIMUM_EVENT  s_info.event_filter
 
 #if defined(FLOG)
 FILE *__file_log_fp;
@@ -64,7 +63,6 @@ static struct info {
 
        int init_count;
        int prevent_overwrite;
-       double event_filter;
        enum event_state event_state;
        enum event_state fault_state;
        guint job_timer;
@@ -75,7 +73,6 @@ static struct info {
        .fault_list = NULL,
        .init_count = 0,
        .prevent_overwrite = 0,
-       .event_filter = 0.01f,
        .event_state = INFO_STATE_CALLBACK_IN_IDLE,
        .fault_state = INFO_STATE_CALLBACK_IN_IDLE,
        .job_timer = 0,
@@ -911,7 +908,7 @@ EAPI int livebox_init_with_options(void *disp, int prevent_overwrite, double eve
         * So set them using arguments.
         */
        s_info.prevent_overwrite = prevent_overwrite;
-       MINIMUM_EVENT = event_filter;
+       conf_set_event_filter(event_filter);
 
        initialize_livebox(disp, use_thread);
        return LB_STATUS_SUCCESS;
@@ -933,7 +930,10 @@ EAPI int livebox_init(void *disp)
 
        env = getenv("PROVIDER_EVENT_FILTER");
        if (env) {
-               sscanf(env, "%lf", &MINIMUM_EVENT);
+               double event_filter;
+               if (sscanf(env, "%lf", &event_filter) == 1) {
+                       conf_set_event_filter(event_filter);
+               }
        }
 
        initialize_livebox(disp, 0);
@@ -2452,7 +2452,7 @@ EAPI int livebox_mouse_event(struct livebox *handler, enum content_event_type ty
                }
 
                if (type & CONTENT_EVENT_MOUSE_MOVE) {
-                       if (fabs(x - handler->common->pd.x) < MINIMUM_EVENT && fabs(y - handler->common->pd.y) < MINIMUM_EVENT) {
+                       if (fabs(x - handler->common->pd.x) < conf_event_filter() && fabs(y - handler->common->pd.y) < conf_event_filter()) {
                                return LB_STATUS_ERROR_BUSY;
                        }
                } else if (type & CONTENT_EVENT_MOUSE_SET) {
@@ -2480,7 +2480,7 @@ EAPI int livebox_mouse_event(struct livebox *handler, enum content_event_type ty
                }
 
                if (type & CONTENT_EVENT_MOUSE_MOVE) {
-                       if (fabs(x - handler->common->lb.x) < MINIMUM_EVENT && fabs(y - handler->common->lb.y) < MINIMUM_EVENT) {
+                       if (fabs(x - handler->common->lb.x) < conf_event_filter() && fabs(y - handler->common->lb.y) < conf_event_filter()) {
                                return LB_STATUS_ERROR_BUSY;
                        }
                } else if (type & CONTENT_EVENT_MOUSE_SET) {