From bf47dcdb794bcc6f884e51b97b1223a3eb1429e0 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Thu, 20 Feb 2014 12:37:07 -0500 Subject: [PATCH] cancel efm rename operation on focus change T987 --- src/bin/e_fm.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/bin/e_fm.c b/src/bin/e_fm.c index 577d2f7..f580c04 100644 --- a/src/bin/e_fm.c +++ b/src/bin/e_fm.c @@ -190,6 +190,7 @@ struct _E_Fm2_Icon E_Menu *menu; E_Entry_Dialog *entry_dialog; Evas_Object *entry_widget; + E_Client_Hook *focus_hook; Eio_File *eio; Ecore_X_Window keygrab; E_Config_Dialog *prop_dialog; @@ -10271,6 +10272,18 @@ _e_fm2_file_rename(void *data, E_Menu *m __UNUSED__, E_Menu_Item *mi __UNUSED__) } } +/* FIXME: this is a stupid hack because it's impossible to get a focus event + * from e_widget_entry. + */ +static void +_e_fm2_icon_entry_widget_focus_out(void *data, E_Client *ec EINA_UNUSED) +{ + E_Fm2_Icon *ic = data; + + if (ic->entry_widget) + _e_fm2_icon_entry_widget_del(ic); +} + static Evas_Object * _e_fm2_icon_entry_widget_add(E_Fm2_Icon *ic) { @@ -10295,7 +10308,8 @@ _e_fm2_icon_entry_widget_add(E_Fm2_Icon *ic) evas_object_show(ic->entry_widget); edje_object_signal_emit(ic->obj, "e,state,rename,on", "e"); e_widget_entry_text_set(ic->entry_widget, ic->info.file); - e_widget_focus_set(ic->entry_widget, 0); + e_widget_focus_set(ic->entry_widget, 1); + e_client_hook_add(E_CLIENT_HOOK_FOCUS_SET, _e_fm2_icon_entry_widget_focus_out, ic); e_widget_entry_select_all(ic->entry_widget); ic->sd->iop_icon = ic; ic->sd->typebuf.disabled = EINA_TRUE; @@ -10311,6 +10325,7 @@ _e_fm2_icon_entry_widget_del(E_Fm2_Icon *ic) evas_object_focus_set(ic->sd->obj, 1); evas_object_del(ic->entry_widget); ic->entry_widget = NULL; + E_FREE_FUNC(ic->focus_hook, e_client_hook_del); ic->sd->typebuf.disabled = EINA_FALSE; if (ic->keygrab) { -- 2.7.4