parent
755a36e40a
commit
0c9265219a
|
@ -1131,7 +1131,7 @@ ACT_FN_GO(exit)
|
|||
e_dialog_icon_set(dia, "enlightenment/exit", 64);
|
||||
e_dialog_button_add(dia, _("Yes"), NULL, _e_actions_cb_exit_dialog_ok, NULL);
|
||||
e_dialog_button_add(dia, _("No"), NULL, NULL, NULL);
|
||||
e_dialog_button_focus (dia, 1);
|
||||
e_dialog_button_focus(dia, 1);
|
||||
e_win_centered_set(dia->win, 1);
|
||||
e_dialog_show(dia);
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ struct _E_Dialog_Button
|
|||
static void _e_dialog_free(E_Dialog *dia);
|
||||
static void _e_dialog_cb_button_clicked(void *data, Evas_Object *obj, const char *emission, const char *source);
|
||||
static void _e_dialog_cb_delete(E_Win *win);
|
||||
static int _e_dialog_key_down_cb (void *data, int type, void *event);
|
||||
static int _e_dialog_key_down_cb(void *data, int type, void *event);
|
||||
|
||||
/* local subsystem globals */
|
||||
|
||||
|
@ -75,7 +75,7 @@ e_dialog_new(E_Container *con)
|
|||
evas_object_show(o);
|
||||
|
||||
dia->focused = NULL;
|
||||
dia->key_down_handler = ecore_event_handler_add (ECORE_X_EVENT_KEY_DOWN, _e_dialog_key_down_cb, dia);
|
||||
dia->key_down_handler = ecore_event_handler_add(ECORE_X_EVENT_KEY_DOWN, _e_dialog_key_down_cb, dia);
|
||||
|
||||
return dia;
|
||||
}
|
||||
|
@ -127,23 +127,22 @@ e_dialog_button_focus(E_Dialog *dia, int button)
|
|||
{
|
||||
E_Dialog_Button *db = NULL;
|
||||
|
||||
db = evas_list_nth (dia->buttons, button);
|
||||
|
||||
if (!db)
|
||||
return 0;
|
||||
db = evas_list_nth(dia->buttons, button);
|
||||
|
||||
if (!db) return 0;
|
||||
|
||||
if (dia->focused)
|
||||
{
|
||||
E_Dialog_Button *focused;
|
||||
|
||||
focused = dia->focused->data;
|
||||
if (focused)
|
||||
edje_object_signal_emit(focused->obj, "unfocus", "");
|
||||
}
|
||||
|
||||
{
|
||||
E_Dialog_Button *focused;
|
||||
|
||||
focused = dia->focused->data;
|
||||
if (focused)
|
||||
edje_object_signal_emit(focused->obj, "unfocus", "");
|
||||
}
|
||||
|
||||
dia->focused = evas_list_nth_list(dia->buttons, button);
|
||||
edje_object_signal_emit(db->obj, "focus", "");
|
||||
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -216,7 +215,7 @@ _e_dialog_free(E_Dialog *dia)
|
|||
if (dia->icon_object) evas_object_del(dia->icon_object);
|
||||
if (dia->box_object) evas_object_del(dia->box_object);
|
||||
if (dia->bg_object) evas_object_del(dia->bg_object);
|
||||
ecore_event_handler_del (dia->key_down_handler);
|
||||
ecore_event_handler_del(dia->key_down_handler);
|
||||
e_object_del(E_OBJECT(dia->win));
|
||||
free(dia);
|
||||
}
|
||||
|
@ -235,58 +234,62 @@ _e_dialog_cb_button_clicked(void *data, Evas_Object *obj, const char *emission,
|
|||
|
||||
/* TODO: Implement shift-tab and left arrow */
|
||||
static int
|
||||
_e_dialog_key_down_cb (void *data, int type, void *event)
|
||||
_e_dialog_key_down_cb(void *data, int type, void *event)
|
||||
{
|
||||
Ecore_X_Event_Key_Down *ev = event;
|
||||
E_Dialog *dia = data;
|
||||
|
||||
Ecore_X_Event_Key_Down *ev;
|
||||
E_Dialog *dia;
|
||||
|
||||
ev = event;
|
||||
dia = data;
|
||||
|
||||
if (!strcmp(ev->keyname, "Tab") || !strcmp(ev->keyname, "Right"))
|
||||
{
|
||||
if (dia->focused && dia->buttons)
|
||||
{
|
||||
if (dia->focused->next)
|
||||
{
|
||||
E_Dialog_Button *db;
|
||||
|
||||
db = dia->focused->data;
|
||||
edje_object_signal_emit(db->obj, "unfocus", "");
|
||||
|
||||
dia->focused = dia->focused->next;
|
||||
db = dia->focused->data;
|
||||
edje_object_signal_emit(db->obj, "focus", "");
|
||||
|
||||
} else {
|
||||
|
||||
E_Dialog_Button *db;
|
||||
|
||||
db = dia->focused->data;
|
||||
edje_object_signal_emit(db->obj, "unfocus", "");
|
||||
|
||||
dia->focused = dia->buttons;
|
||||
db = evas_list_data (dia->focused);
|
||||
edje_object_signal_emit(db->obj, "focus", "");
|
||||
}
|
||||
} else {
|
||||
|
||||
E_Dialog_Button *db;
|
||||
|
||||
dia->focused = dia->buttons;
|
||||
|
||||
db = dia->focused->data;
|
||||
edje_object_signal_emit(db->obj, "focus", "");
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
{
|
||||
if (dia->focused && dia->buttons)
|
||||
{
|
||||
if (dia->focused->next)
|
||||
{
|
||||
E_Dialog_Button *db;
|
||||
|
||||
db = dia->focused->data;
|
||||
edje_object_signal_emit(db->obj, "unfocus", "");
|
||||
|
||||
dia->focused = dia->focused->next;
|
||||
db = dia->focused->data;
|
||||
edje_object_signal_emit(db->obj, "focus", "");
|
||||
}
|
||||
else
|
||||
{
|
||||
E_Dialog_Button *db;
|
||||
|
||||
db = dia->focused->data;
|
||||
edje_object_signal_emit(db->obj, "unfocus", "");
|
||||
|
||||
dia->focused = dia->buttons;
|
||||
db = evas_list_data(dia->focused);
|
||||
edje_object_signal_emit(db->obj, "focus", "");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
E_Dialog_Button *db;
|
||||
|
||||
dia->focused = dia->buttons;
|
||||
|
||||
db = dia->focused->data;
|
||||
edje_object_signal_emit(db->obj, "focus", "");
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
if ((!strcmp(ev->keyname, "Enter") || !strcmp(ev->keyname, "Return") ||
|
||||
!strcmp(ev->keyname, "Space")) && dia->focused)
|
||||
{
|
||||
E_Dialog_Button *db;
|
||||
|
||||
db = evas_list_data (dia->focused);
|
||||
edje_object_signal_emit(db->obj, "click", "");
|
||||
}
|
||||
|
||||
{
|
||||
E_Dialog_Button *db;
|
||||
|
||||
db = evas_list_data(dia->focused);
|
||||
edje_object_signal_emit(db->obj, "click", "");
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue