From: <enl...@li...> - 2004-01-19 18:13:33
|
Enlightenment CVS committal Author : technikolor Project : misc Module : eplayer Dir : misc/eplayer/src Modified Files: callbacks.c callbacks.h interface.c Log Message: The default theme now supports rephorm's new seek methods which are signicantly smoother. Also, initial key binding support is added. Current it is not user configurable, but the basics are there and should work as most people would expect. =================================================================== RCS file: /cvsroot/enlightenment/misc/eplayer/src/callbacks.c,v retrieving revision 1.26 retrieving revision 1.27 diff -u -3 -r1.26 -r1.27 --- callbacks.c 16 Jan 2004 05:10:55 -0000 1.26 +++ callbacks.c 19 Jan 2004 18:13:32 -0000 1.27 @@ -370,3 +370,69 @@ else return 0; } + +/* Handle Key Bindings via EVAS Event Callback */ +void +cb_key_press(void *data, Evas *e, Evas_Object *obj, void *event_info) { + ePlayer *player = data; + + Evas_Event_Key_Down *ev; + ev = (Evas_Event_Key_Down *)event_info; + + //printf("DEBUG: You hit key: %s\n", ev->keyname); + + if (!strcmp(ev->keyname, "Return")) + edje_object_signal_emit(player->gui.edje, "PLAY_NEXT", "*"); + if (!strcmp(ev->keyname, "space")) + edje_object_signal_emit(player->gui.edje, "PAUSE", "*"); + else if (!strcmp(ev->keyname, "Escape")) + edje_object_signal_emit(player->gui.edje, "QUIT", "*"); + else if (!strcmp(ev->keyname, "q")) + edje_object_signal_emit(player->gui.edje, "QUIT", "*"); + else if (!strcmp(ev->keyname, "Down")) + edje_object_signal_emit(player->gui.edje, "PLAY_NEXT", "*"); + else if (!strcmp(ev->keyname, "Up")) + edje_object_signal_emit(player->gui.edje, "PLAY_PREVIOUS", "*"); + else if (!strcmp(ev->keyname, "Right")) + edje_object_signal_emit(player->gui.edje, "SEEK_FORWARD", "*"); + else if (!strcmp(ev->keyname, "Left")) + edje_object_signal_emit(player->gui.edje, "SEEK_BACK", "*"); + else if (!strcmp(ev->keyname, "KP_Add")) + edje_object_signal_emit(player->gui.edje, "VOL_INCR", "*"); + else if (!strcmp(ev->keyname, "equal")) + edje_object_signal_emit(player->gui.edje, "VOL_INCR", "*"); + else if (!strcmp(ev->keyname, "KP_Subtract")) + edje_object_signal_emit(player->gui.edje, "VOL_DECR", "*"); + else if (!strcmp(ev->keyname, "minus")) + edje_object_signal_emit(player->gui.edje, "VOL_DECR", "*"); + + + /********* See notes on cb_key_release(). + else if (!strcmp(ev->keyname, "Right")) + edje_object_signal_emit(player->gui.edje, "SEEK_FORWARD_START", "*"); + else if (!strcmp(ev->keyname, "Left")) + edje_object_signal_emit(player->gui.edje, "SEEK_BACK_START", "*"); + ************/ + +} + +/* Handle Key Bindings via EVAS Event Callback */ +/* - This only works IF you turn off X key repeat, which raster */ +/* pointed out is global... so for most of us, this won't work. */ +/* This function is, thus, currently unused, but left in for testing. */ +void +cb_key_release(void *data, Evas *e, Evas_Object *obj, void *event_info) { + ePlayer *player = data; + + Evas_Event_Key_Down *ev; + ev = (Evas_Event_Key_Down *)event_info; + + //printf("DEBUG: You released key: %s\n", ev->keyname); + + if (!strcmp(ev->keyname, "Right")) + edje_object_signal_emit(player->gui.edje, "SEEK_FORWARD_STOP", "*"); + else if (!strcmp(ev->keyname, "Left")) + edje_object_signal_emit(player->gui.edje, "SEEK_BACK_STOP", "*"); + +} + =================================================================== RCS file: /cvsroot/enlightenment/misc/eplayer/src/callbacks.h,v retrieving revision 1.14 retrieving revision 1.15 diff -u -3 -r1.14 -r1.15 --- callbacks.h 16 Jan 2004 05:10:55 -0000 1.14 +++ callbacks.h 19 Jan 2004 18:13:32 -0000 1.15 @@ -41,5 +41,8 @@ EDJE_CB(update_seeker); +void cb_key_press(void *data, Evas *e, Evas_Object *obj, void *event_info); +void cb_key_release(void *data, Evas *e, Evas_Object *obj, void *event_info); + #endif =================================================================== RCS file: /cvsroot/enlightenment/misc/eplayer/src/interface.c,v retrieving revision 1.35 retrieving revision 1.36 diff -u -3 -r1.35 -r1.36 --- interface.c 17 Jan 2004 18:34:30 -0000 1.35 +++ interface.c 19 Jan 2004 18:13:32 -0000 1.36 @@ -232,6 +232,13 @@ for (i = 0; i < sizeof (cb) / sizeof (EdjeCallback); i++) edje_object_signal_callback_add(e, cb[i].name, cb[i].src, cb[i].func, player); + + /* Setup Key Binds */ + evas_object_focus_set(e, 1); + evas_object_event_callback_add(e, EVAS_CALLBACK_KEY_DOWN, cb_key_press, player); + /* This is for a later time and place, see notes with cb_key_release() */ + //evas_object_event_callback_add(e, EVAS_CALLBACK_KEY_UP, cb_key_release, player); + } static void setup_playlist(ePlayer *player) { |