Hide help window when other shortcuts are pressed
Otherwise many unexpected issues could happen, like open multiple help popups, opening the rulers box with "@" as string, killing eruler instead of just closing the windows when "ESC" is pressed. The reason the help popup is not imeadiatelly deleted is because if done so, the keydown callback is called twice. Honestly I didn't understand the reason, but it's easy to be avoided with an idler.
This commit is contained in:
parent
e9dfef7048
commit
37839e70cf
|
@ -30,6 +30,8 @@ struct _Zone {
|
|||
Evas_Object *guide_v;
|
||||
Evas_Object *display_pos;
|
||||
Evas_Object *cmdbox;
|
||||
Evas_Object *help_popup;
|
||||
Ecore_Idler *del_help_popup_idler;
|
||||
struct {
|
||||
Evas_Object *frame;
|
||||
Evas_Object *main_box;
|
||||
|
@ -1435,8 +1437,9 @@ zone_zoom_pre_setup(Zone *zone)
|
|||
static void
|
||||
_popup_dismiss_cb(void *data, Evas_Object *o EINA_UNUSED, void *event EINA_UNUSED)
|
||||
{
|
||||
Evas_Object *popup = data;
|
||||
evas_object_del(popup);
|
||||
Zone *zone = data;
|
||||
evas_object_del(zone->help_popup);
|
||||
zone->help_popup = NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -1491,10 +1494,11 @@ show_gui_help(Zone *zone)
|
|||
|
||||
bt = elm_button_add(popup);
|
||||
elm_object_text_set(bt, "Close");
|
||||
evas_object_smart_callback_add(bt, "clicked", _popup_dismiss_cb, popup);
|
||||
evas_object_smart_callback_add(bt, "clicked", _popup_dismiss_cb, zone);
|
||||
elm_object_part_content_set(popup, "button1", bt);
|
||||
|
||||
evas_object_show(popup);
|
||||
zone->help_popup = popup;
|
||||
elm_object_focus_set(bt, EINA_TRUE);
|
||||
}
|
||||
|
||||
|
@ -2090,6 +2094,18 @@ _toggle_visibility_cb(void *data EINA_UNUSED, const char *keyname EINA_UNUSED)
|
|||
platform_funcs->windows_visibility_set(visible);
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
_del_help_popup(void *data)
|
||||
{
|
||||
Zone *zone = data;
|
||||
|
||||
evas_object_del(zone->help_popup);
|
||||
zone->help_popup = NULL;
|
||||
zone->del_help_popup_idler = NULL;
|
||||
|
||||
return ECORE_CALLBACK_CANCEL;
|
||||
}
|
||||
|
||||
static void
|
||||
_zone_win_key_down_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *o EINA_UNUSED, void *event_info)
|
||||
{
|
||||
|
@ -2101,6 +2117,14 @@ _zone_win_key_down_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *o EINA_UNUSE
|
|||
|
||||
if (zone->screenshot.ee) return;
|
||||
|
||||
if (zone->del_help_popup_idler) return;
|
||||
|
||||
if (zone->help_popup)
|
||||
{
|
||||
zone->del_help_popup_idler = ecore_idler_add(_del_help_popup, zone);
|
||||
return;
|
||||
}
|
||||
|
||||
if (strcmp(keyname, "Escape") == 0)
|
||||
{
|
||||
DBG("User requested exit!");
|
||||
|
@ -2315,6 +2339,8 @@ zone_del(Zone *zone)
|
|||
{
|
||||
if (zone->tracker)
|
||||
ecore_animator_del(zone->tracker);
|
||||
if (zone->del_help_popup_idler)
|
||||
ecore_idler_del(zone->del_help_popup_idler);
|
||||
|
||||
/* all objects are deleted when canvas goes away.
|
||||
* when ruler and distance objects are deleted, they remove themselves from
|
||||
|
|
Loading…
Reference in New Issue