aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBoris Faure <billiob@gmail.com>2019-01-20 23:01:11 +0100
committerBoris Faure <billiob@gmail.com>2019-01-20 23:13:05 +0100
commit54565e32a659d7ebf5728b876fedb5fcc80956ec (patch)
tree26124c8f0d5aee436bae56d6a1594c6d8d5c4c66 /src
parenttermptyesc: support aliases for cursor Up/Left + tests (diff)
downloadterminology-54565e32a659d7ebf5728b876fedb5fcc80956ec.tar.gz
options_keys: clean up a bit
options: no need for delay
Diffstat (limited to 'src')
-rw-r--r--src/bin/options.c19
-rw-r--r--src/bin/options_keys.c41
2 files changed, 27 insertions, 33 deletions
diff --git a/src/bin/options.c b/src/bin/options.c
index 9d1321e..a8d272a 100644
--- a/src/bin/options.c
+++ b/src/bin/options.c
@@ -73,19 +73,6 @@ _cb_op_tmp_chg(void *data, Evas_Object *obj, void *_event EINA_UNUSED)
config->temporary = elm_check_state_get(obj);
}
-static Eina_Bool
-_cb_op_del_delay(void *data)
-{
- Options_Ctx *ctx = data;
-
- evas_object_del(ctx->opbox);
- evas_object_del(ctx->frame);
-
- free(ctx);
- elm_cache_all_flush();
- return EINA_FALSE;
-}
-
static void
_cb_opdt_hide_done(void *data,
Evas_Object *_obj EINA_UNUSED,
@@ -123,7 +110,11 @@ _cb_opdt_hide_done2(void *data,
edje_object_signal_callback_del(ctx->base, "optdetails,hide,done",
"terminology",
_cb_opdt_hide_done2);
- ecore_timer_add(10.0, _cb_op_del_delay, ctx);
+ evas_object_del(ctx->opbox);
+ evas_object_del(ctx->frame);
+
+ free(ctx);
+ elm_cache_all_flush();
}
static void
diff --git a/src/bin/options_keys.c b/src/bin/options_keys.c
index 5e9bec3..72fdcfb 100644
--- a/src/bin/options_keys.c
+++ b/src/bin/options_keys.c
@@ -40,9 +40,11 @@ _shortcut_delete(void *data,
evas_object_size_hint_min_get(hs, &w, NULL);
evas_object_size_hint_min_get(bx, &min_w, &min_h);
min_w -= w;
- evas_object_size_hint_min_set(bx, min_w, min_h);
evas_object_del(hs);
+
+ evas_object_size_hint_min_set(bx, min_w, min_h);
+
keyin_remove_config(cfg_key);
eina_stringshare_del(cfg_key->keyname);
@@ -208,6 +210,7 @@ _parent_hide_cb(void *data,
void *_event_info EINA_UNUSED)
{
Keys_Ctx *ctx = data;
+
_hover_del(ctx);
}
@@ -218,31 +221,30 @@ _parent_del_cb(void *data,
void *_event_info EINA_UNUSED)
{
Keys_Ctx *ctx = data;
- _hover_del(ctx);
- evas_object_event_callback_del(ctx->frame, EVAS_CALLBACK_DEL,
- _parent_del_cb);
- evas_object_event_callback_del(ctx->frame, EVAS_CALLBACK_HIDE,
- _parent_hide_cb);
+ ctx->frame = NULL;
+ _hover_del(ctx);
free(ctx);
}
static void
_hover_del(Keys_Ctx *ctx)
{
- if (ctx->layout)
+ Evas_Object *layout = ctx->layout;
+
+ ctx->layout = NULL;
+ if (layout && ctx->frame)
{
evas_object_event_callback_del(ctx->frame, EVAS_CALLBACK_KEY_UP,
_cb_key_up);
- evas_object_event_callback_del(ctx->frame, EVAS_CALLBACK_MOUSE_DOWN,
+ evas_object_event_callback_del(layout, EVAS_CALLBACK_MOUSE_DOWN,
_cb_mouse_down);
evas_object_event_callback_del(ctx->frame, EVAS_CALLBACK_MOVE,
_parent_move_cb);
evas_object_event_callback_del(ctx->frame, EVAS_CALLBACK_RESIZE,
_parent_resize_cb);
- evas_object_del(ctx->layout);
+ evas_object_del(layout);
}
- ctx->layout = NULL;
}
static void
@@ -250,7 +252,7 @@ _on_shortcut_add(void *data,
Evas_Object *bt,
void *_event_info EINA_UNUSED)
{
- Evas_Object *o, *oe;
+ Evas_Object *oe;
Evas_Object *bx = data;
Keys_Ctx *ctx;
@@ -258,23 +260,20 @@ _on_shortcut_add(void *data,
assert(ctx);
assert(ctx->layout == NULL);
- ctx->layout = o = elm_layout_add(bt);
+ ctx->layout = elm_layout_add(bt);
evas_object_data_set(ctx->layout, "ctx", ctx);
- oe = elm_layout_edje_get(o);
+ oe = elm_layout_edje_get(ctx->layout);
theme_apply(oe, ctx->config, "terminology/keybinding");
theme_auto_reload_enable(oe);
- elm_layout_text_set(o, "label", _("Please press key sequence"));
- evas_object_show(o);
+ elm_layout_text_set(ctx->layout, "label", _("Please press key sequence"));
+ evas_object_show(ctx->layout);
evas_object_event_callback_add(ctx->frame, EVAS_CALLBACK_KEY_UP,
_cb_key_up, bx);
- evas_object_event_callback_add(ctx->frame, EVAS_CALLBACK_MOUSE_DOWN,
+ evas_object_event_callback_add(ctx->layout, EVAS_CALLBACK_MOUSE_DOWN,
_cb_mouse_down, ctx);
- elm_object_focus_set(ctx->frame, EINA_TRUE);
- elm_object_focus_allow_set(ctx->frame, EINA_TRUE);
_hover_sizing_eval(ctx);
-
}
static Evas_Object *
@@ -390,6 +389,10 @@ options_keys(Evas_Object *opbox, Evas_Object *term)
_parent_del_cb, ctx);
evas_object_event_callback_add(ctx->frame, EVAS_CALLBACK_HIDE,
_parent_hide_cb, ctx);
+ evas_object_event_callback_add(ctx->frame, EVAS_CALLBACK_MOVE,
+ _parent_move_cb, ctx);
+ evas_object_event_callback_add(ctx->frame, EVAS_CALLBACK_RESIZE,
+ _parent_resize_cb, ctx);
bx = elm_box_add(opbox);
evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);