Don't handle Volume and Channel keys 93/45593/1
authorMinkyu Kang <mk7.kang@samsung.com>
Sat, 8 Aug 2015 04:11:19 +0000 (13:11 +0900)
committerMinkyu Kang <mk7.kang@samsung.com>
Sat, 8 Aug 2015 04:11:19 +0000 (13:11 +0900)
Change-Id: Ied50b68ff1b3f5c23160d807c65d518195693ad5
Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
include/util/timeout_handler.h
src/util/timeout_handler.c
src/view/viewer.c

index 44ad82f..2a4c2ff 100644 (file)
@@ -19,7 +19,7 @@
 
 struct timeout_handler;
 
-typedef void (*timeout_event_cb)(void *data, int type, void *ei);
+typedef Eina_Bool (*timeout_event_cb)(void *data, int type, void *ei);
 
 struct timeout_handler *timeout_handler_init(double timeout,
                timeout_event_cb timeout_cb, void *timeout_data,
index d66ac3b..148c41e 100644 (file)
@@ -16,6 +16,7 @@
 #include <stdbool.h>
 #include <Elementary.h>
 #include <app_debug.h>
+#include <key_define.h>
 
 #include "define.h"
 #include "util/timeout_handler.h"
@@ -37,6 +38,7 @@ struct timeout_handler {
 static Eina_Bool _timer_cb(void *data)
 {
        struct timeout_handler *handle;
+       Eina_Bool r;
 
        if (!data)
                return ECORE_CALLBACK_CANCEL;
@@ -48,9 +50,9 @@ static Eina_Bool _timer_cb(void *data)
        if (!handle->enable)
                return ECORE_CALLBACK_CANCEL;
 
-       handle->timeout_cb(handle->timeout_data, 0, NULL);
+       r = handle->timeout_cb(handle->timeout_data, 0, NULL);
 
-       return ECORE_CALLBACK_CANCEL;
+       return r;
 }
 
 void _timer_reset(struct timeout_handler *handle)
@@ -65,6 +67,7 @@ void _timer_reset(struct timeout_handler *handle)
 static Eina_Bool _event_occured(void *data, int type, void *event)
 {
        struct timeout_handler *handle;
+       Eina_Bool r;
 
        if (!data)
                return ECORE_CALLBACK_PASS_ON;
@@ -74,11 +77,34 @@ static Eina_Bool _event_occured(void *data, int type, void *event)
        if (!handle->enable)
                return ECORE_CALLBACK_PASS_ON;
 
-       handle->event_cb(handle->event_data, type, event);
+       /* Don't handle Volume and Channel keys */
+       if (type == ECORE_EVENT_KEY_UP) {
+               Evas_Event_Key_Up *ev;
+
+               if (!event)
+                       return ECORE_CALLBACK_PASS_ON;
+
+               ev = event;
+
+               if (!strcmp(ev->keyname, KEY_VOLUMEUP) ||
+                               !strcmp(ev->keyname, KEY_VOLUMEUP_REMOTE) ||
+                               !strcmp(ev->keyname, KEY_VOLUMEDOWN) ||
+                               !strcmp(ev->keyname, KEY_VOLUMEDOWN_REMOTE) ||
+                               !strcmp(ev->keyname, KEY_MUTE) ||
+                               !strcmp(ev->keyname, KEY_MUTE_REMOTE) ||
+                               !strcmp(ev->keyname, KEY_CHANNELUP) ||
+                               !strcmp(ev->keyname, KEY_CHANNELUP_REMOTE) ||
+                               !strcmp(ev->keyname, KEY_CHANNELDOWN) ||
+                               !strcmp(ev->keyname, KEY_CHANNELDOWN_REMOTE)) {
+                       return ECORE_CALLBACK_PASS_ON;
+               }
+       }
+
+       r = handle->event_cb(handle->event_data, type, event);
 
        _timer_reset(handle);
 
-       return ECORE_CALLBACK_PASS_ON;
+       return r;
 }
 
 void timeout_handler_enable(struct timeout_handler *handle, bool enable)
index 2f7d9e2..56c6961 100644 (file)
@@ -650,17 +650,19 @@ static void _pop_view(struct _priv *priv)
                ui_app_exit();
 }
 
-static void _timeout_cb(void *data, int type, void *ei)
+static Eina_Bool _timeout_cb(void *data, int type, void *ei)
 {
        _hide_bar(data);
+
+       return ECORE_CALLBACK_CANCEL;
 }
 
-static void _event_cb(void *data, int type, void *ei)
+static Eina_Bool _event_cb(void *data, int type, void *ei)
 {
        struct _priv *priv;
 
        if (!data)
-               return;
+               return ECORE_CALLBACK_PASS_ON;
 
        priv = data;
 
@@ -668,7 +670,7 @@ static void _event_cb(void *data, int type, void *ei)
                Evas_Event_Key_Up *ev;
 
                if (!ei)
-                       return;
+                       return ECORE_CALLBACK_PASS_ON;
 
                ev = ei;
 
@@ -676,12 +678,14 @@ static void _event_cb(void *data, int type, void *ei)
                                !strcmp(ev->keyname, KEY_BACK_REMOTE)) {
                        if (priv->bar_show) {
                                _pop_view(priv);
-                               return;
+                               return ECORE_CALLBACK_DONE;
                        }
                }
        }
 
        _show_bar(data);
+
+       return ECORE_CALLBACK_PASS_ON;
 }
 
 static int _player_get_position(void *data)