- move keyboard code to evas callbacks, thanks raster

SVN revision: 18315
This commit is contained in:
codewarrior 2005-11-05 11:13:13 +00:00 committed by codewarrior
parent dcc5a3ac95
commit cdbab6c509
2 changed files with 22 additions and 26 deletions

View File

@ -72,7 +72,7 @@ e_fileman_new(E_Container *con)
e_win_title_set(fileman->win, dir); e_win_title_set(fileman->win, dir);
evas_event_freeze(fileman->evas); evas_event_freeze(fileman->evas);
fileman->smart = e_fm_add(fileman->evas); fileman->smart = e_fm_add(fileman->evas);
e_fm_e_win_set(fileman->smart, fileman->win); e_fm_e_win_set(fileman->smart, fileman->win);
fileman->main = e_scrollframe_add(fileman->evas); fileman->main = e_scrollframe_add(fileman->evas);
@ -91,6 +91,10 @@ e_fileman_new(E_Container *con)
evas_event_thaw(fileman->evas); evas_event_thaw(fileman->evas);
evas_object_focus_set(fileman->main, 0);
//evas_object_focus_set(fileman->smart, 1);
evas_object_propagate_events_set(fileman->smart, 0);
fileman->event_handlers = evas_list_append(fileman->event_handlers, fileman->event_handlers = evas_list_append(fileman->event_handlers,
ecore_event_handler_add(E_EVENT_FM_RECONFIGURE, ecore_event_handler_add(E_EVENT_FM_RECONFIGURE,
_e_fileman_reconfigure_cb, _e_fileman_reconfigure_cb,

View File

@ -222,6 +222,7 @@ static void _e_fm_fake_mouse_up_later (Evas *evas, int button
static void _e_fm_fake_mouse_up_all_later (Evas *evas); static void _e_fm_fake_mouse_up_all_later (Evas *evas);
static void _e_fm_fake_mouse_up_cb (void *data); static void _e_fm_fake_mouse_up_cb (void *data);
static void _e_fm_key_down_cb (void *data, Evas *e, Evas_Object *obj, void *event_info);
static void _e_fm_mouse_down_cb (void *data, Evas *e, Evas_Object *obj, void *event_info); static void _e_fm_mouse_down_cb (void *data, Evas *e, Evas_Object *obj, void *event_info);
static void _e_fm_mouse_move_cb (void *data, Evas *e, Evas_Object *obj, void *event_info); static void _e_fm_mouse_move_cb (void *data, Evas *e, Evas_Object *obj, void *event_info);
static void _e_fm_mouse_up_cb (void *data, Evas *e, Evas_Object *obj, void *event_info); static void _e_fm_mouse_up_cb (void *data, Evas *e, Evas_Object *obj, void *event_info);
@ -231,7 +232,6 @@ static void _e_fm_icon_mouse_in_cb (void *data, Evas *e, Evas_O
static void _e_fm_icon_mouse_out_cb (void *data, Evas *e, Evas_Object *obj, void *event_info); static void _e_fm_icon_mouse_out_cb (void *data, Evas *e, Evas_Object *obj, void *event_info);
static int _e_fm_win_mouse_move_cb (void *data, int type, void *event); static int _e_fm_win_mouse_move_cb (void *data, int type, void *event);
static int _e_fm_win_mouse_up_cb (void *data, int type, void *event); static int _e_fm_win_mouse_up_cb (void *data, int type, void *event);
static int _e_fm_win_key_down_cb (void *data, int type, void *event);
static int _e_fm_drop_enter_cb (void *data, int type, void *event); static int _e_fm_drop_enter_cb (void *data, int type, void *event);
static int _e_fm_drop_leave_cb (void *data, int type, void *event); static int _e_fm_drop_leave_cb (void *data, int type, void *event);
@ -519,7 +519,6 @@ _e_fm_smart_add(Evas_Object *object)
evas_object_repeat_events_set(sd->layout, 1); evas_object_repeat_events_set(sd->layout, 1);
evas_object_smart_member_add(sd->layout, object); evas_object_smart_member_add(sd->layout, object);
e_icon_layout_spacing_set(sd->layout, sd->icon_info.x_space, sd->icon_info.y_space); e_icon_layout_spacing_set(sd->layout, sd->icon_info.x_space, sd->icon_info.y_space);
evas_object_stack_above(sd->layout, sd->bg);
evas_object_show(sd->layout); evas_object_show(sd->layout);
sd->clip = evas_object_rectangle_add(sd->evas); sd->clip = evas_object_rectangle_add(sd->evas);
@ -538,6 +537,11 @@ _e_fm_smart_add(Evas_Object *object)
"base/theme/fileman/rubberband", "base/theme/fileman/rubberband",
"fileman/rubberband"); "fileman/rubberband");
evas_object_focus_set(sd->object, 1);
evas_object_event_callback_add(sd->object, EVAS_CALLBACK_KEY_DOWN,_e_fm_key_down_cb, sd);
evas_object_stack_below(sd->bg, sd->layout);
sd->event_handlers = NULL; sd->event_handlers = NULL;
sd->event_handlers = evas_list_append(sd->event_handlers, sd->event_handlers = evas_list_append(sd->event_handlers,
@ -564,10 +568,6 @@ _e_fm_smart_add(Evas_Object *object)
ecore_event_handler_add(ECORE_X_EVENT_MOUSE_MOVE, ecore_event_handler_add(ECORE_X_EVENT_MOUSE_MOVE,
_e_fm_win_mouse_move_cb, _e_fm_win_mouse_move_cb,
sd)); sd));
sd->event_handlers = evas_list_append(sd->event_handlers,
ecore_event_handler_add(ECORE_X_EVENT_KEY_DOWN,
_e_fm_win_key_down_cb,
sd));
sd->monitor = NULL; sd->monitor = NULL;
sd->position = 0.0; sd->position = 0.0;
@ -647,7 +647,7 @@ _e_fm_smart_move(Evas_Object *object, Evas_Coord x, Evas_Coord y)
sd->y = y; sd->y = y;
evas_object_move(sd->bg, x, y); evas_object_move(sd->bg, x, y);
evas_object_move(sd->clip, x, y); evas_object_move(sd->clip, x, y);
evas_object_move(sd->layout, sd->x - sd->child.x, sd->y - sd->child.y); evas_object_move(sd->layout, sd->x - sd->child.x, sd->y - sd->child.y);
} }
static void static void
@ -2354,7 +2354,7 @@ _e_fm_icon_select_down(E_Fm_Smart_Data *sd)
if(!E_CONTAINS(sd->x, sd->y, sd->w, sd->h, x, y, w, h)) if(!E_CONTAINS(sd->x, sd->y, sd->w, sd->h, x, y, w, h))
{ {
E_Event_Fm_Reconfigure *ev; E_Event_Fm_Reconfigure *ev;
printf("!E_CONTAINS %s\n", icon->file->name);
ev = E_NEW(E_Event_Fm_Reconfigure, 1); ev = E_NEW(E_Event_Fm_Reconfigure, 1);
if (ev) if (ev)
{ {
@ -2524,32 +2524,24 @@ _e_fm_icon_run(E_Fm_Smart_Data *sd)
} }
} }
static int static void
_e_fm_win_key_down_cb(void *data, int type, void *event) _e_fm_key_down_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
{ {
Ecore_X_Event_Key_Down *ev; Evas_Event_Key_Up *ev;
E_Fm_Smart_Data *sd; E_Fm_Smart_Data *sd;
ev = event; ev = event_info;
sd = data; sd = data;
/* FIXME: do NOT use ecore_x key events. NOT! use evas key callbacks on
* a focused onject!!!!
*/
return 1;
// make this call generic
if (!sd->win) return 1;
if (ev->win != sd->win->evas_sub_win) return 1;
if (!strcmp(ev->keysymbol, "Up")) if (!strcmp(ev->keyname, "Up"))
_e_fm_icon_select_up(sd); _e_fm_icon_select_up(sd);
else if (!strcmp(ev->keysymbol, "Down")) else if (!strcmp(ev->keyname, "Down"))
_e_fm_icon_select_down(sd); _e_fm_icon_select_down(sd);
else if (!strcmp(ev->keysymbol, "Left")) else if (!strcmp(ev->keyname, "Left"))
_e_fm_icon_select_left(sd); _e_fm_icon_select_left(sd);
else if (!strcmp(ev->keysymbol, "Right")) else if (!strcmp(ev->keyname, "Right"))
_e_fm_icon_select_right(sd); _e_fm_icon_select_right(sd);
else if (!strcmp(ev->keysymbol, "Return")) else if (!strcmp(ev->keyname, "Return"))
_e_fm_icon_run(sd); _e_fm_icon_run(sd);
return 1; return 1;