diff --git a/src/bin/options_behavior.c b/src/bin/options_behavior.c index 1318c94c..5e30a9b9 100644 --- a/src/bin/options_behavior.c +++ b/src/bin/options_behavior.c @@ -224,7 +224,6 @@ _cb_op_hide_cursor_changed(void *data, config->hide_cursor = INFINITY; elm_object_disabled_set(ctx->sld_hide_cursor, EINA_TRUE); } - main_hide_cursor_update(config); config_save(config, NULL); } @@ -241,7 +240,6 @@ _cb_hide_cursor_slider_chg(void *data, return; config->hide_cursor = value; - main_hide_cursor_update(config); config_save(config, NULL); } diff --git a/src/bin/win.c b/src/bin/win.c index 44bcaf6b..19b429f2 100644 --- a/src/bin/win.c +++ b/src/bin/win.c @@ -170,6 +170,7 @@ struct _Win Evas_Object *cmdbox; Ecore_Timer *cmdbox_del_timer; Ecore_Timer *cmdbox_focus_timer; + Ecore_Timer *hide_cursor_timer; unsigned char focused : 1; unsigned char cmdbox_up : 1; unsigned char group_input : 1; @@ -679,12 +680,6 @@ _win_trans(Win *wn, Term *term, Eina_Bool trans) } } -void -main_hide_cursor_update(const Config *config) -{ - /* TODO */ -} - void main_trans_update(const Config *config) { @@ -1546,6 +1541,34 @@ _cb_win_mouse_down(void *data, tc_child->focus(tc_child, tc); } +static Eina_Bool +_set_cursor(Term *term, void *data) +{ + char *cursor = data; + + if (cursor) + { + elm_object_cursor_set(term->base, cursor); + } + else + { + elm_object_cursor_unset(term->base); + } + + return ECORE_CALLBACK_PASS_ON; +} + + +static Eina_Bool +_hide_cursor(void *data) +{ + Win *wn = data; + + wn->hide_cursor_timer = NULL; + for_each_term_do(wn, &_set_cursor, (void*)"blank"); + return ECORE_CALLBACK_CANCEL; +} + static void _cb_win_mouse_move(void *data, Evas *_e EINA_UNUSED, @@ -1558,10 +1581,25 @@ _cb_win_mouse_move(void *data, Term_Container *tc = (Term_Container*) wn; Term_Container *tc_child = NULL; - if (wn->on_popover || wn->group_input || !tc->is_focused) + if (wn->on_popover) return; - if (!wn->config->mouse_over_focus) + if (!isnan(wn->config->hide_cursor)) + { + if (wn->hide_cursor_timer) + { + ecore_timer_interval_set(wn->hide_cursor_timer, + wn->config->hide_cursor); + } + else + { + for_each_term_do(wn, &_set_cursor, NULL); + wn->hide_cursor_timer = ecore_timer_add( + wn->config->hide_cursor, _hide_cursor, wn); + } + } + + if (wn->group_input || !tc->is_focused || !wn->config->mouse_over_focus) return; term_mouse = tc->find_term_at_coords(tc, diff --git a/src/bin/win.h b/src/bin/win.h index defa2175..af4bf16b 100644 --- a/src/bin/win.h +++ b/src/bin/win.h @@ -90,6 +90,5 @@ term_apply_shine(Term *term, int shine); void background_set_shine(Config *config, Evas_Object *bg); void main_trans_update(const Config *config); -void main_hide_cursor_update(const Config *config); #endif