hide cursor: fix unchecking "auto hide cursor". Closes T8148

This commit is contained in:
Boris Faure 2019-09-02 23:27:42 +02:00
parent 42e358d194
commit 98017f1647
3 changed files with 7 additions and 5 deletions

View File

@ -116,4 +116,6 @@ void config_reset_keys(Config *config);
const char *config_theme_path_get(const Config *config); const char *config_theme_path_get(const Config *config);
const char *config_theme_path_default_get(const Config *config); const char *config_theme_path_default_get(const Config *config);
#define CONFIG_CURSOR_IDLE_TIMEOUT_MAX 60.0
#endif #endif

View File

@ -221,7 +221,7 @@ _cb_op_hide_cursor_changed(void *data,
} }
else else
{ {
config->hide_cursor = INFINITY; config->hide_cursor = CONFIG_CURSOR_IDLE_TIMEOUT_MAX + 1.0;
elm_object_disabled_set(ctx->sld_hide_cursor, EINA_TRUE); elm_object_disabled_set(ctx->sld_hide_cursor, EINA_TRUE);
} }
config_save(config, NULL); config_save(config, NULL);
@ -629,7 +629,7 @@ options_behavior(Evas_Object *opbox, Evas_Object *term)
evas_object_size_hint_align_set(o, EVAS_HINT_FILL, 0.5); evas_object_size_hint_align_set(o, EVAS_HINT_FILL, 0.5);
elm_object_text_set(o, _("Translucent")); elm_object_text_set(o, _("Translucent"));
elm_object_text_set(o, _("Auto hide the mouse cursor when idle:")); elm_object_text_set(o, _("Auto hide the mouse cursor when idle:"));
elm_check_state_set(o, !isnan(config->hide_cursor)); elm_check_state_set(o, config->hide_cursor < CONFIG_CURSOR_IDLE_TIMEOUT_MAX);
elm_box_pack_end(bx, o); elm_box_pack_end(bx, o);
evas_object_show(o); evas_object_show(o);
evas_object_smart_callback_add(o, "changed", evas_object_smart_callback_add(o, "changed",
@ -643,7 +643,7 @@ options_behavior(Evas_Object *opbox, Evas_Object *term)
elm_slider_span_size_set(o, 40); elm_slider_span_size_set(o, 40);
elm_slider_unit_format_set(o, _("%1.1f s")); elm_slider_unit_format_set(o, _("%1.1f s"));
elm_slider_indicator_format_set(o, _("%1.1f s")); elm_slider_indicator_format_set(o, _("%1.1f s"));
elm_slider_min_max_set(o, 0.0, 60.0); elm_slider_min_max_set(o, 0.0, CONFIG_CURSOR_IDLE_TIMEOUT_MAX);
elm_slider_value_set(o, config->hide_cursor); elm_slider_value_set(o, config->hide_cursor);
elm_box_pack_end(bx, o); elm_box_pack_end(bx, o);
evas_object_show(o); evas_object_show(o);

View File

@ -1609,7 +1609,7 @@ _cb_win_mouse_move(void *data,
if (wn->on_popover) if (wn->on_popover)
return; return;
if (!isnan(wn->config->hide_cursor)) if (wn->config->hide_cursor < CONFIG_CURSOR_IDLE_TIMEOUT_MAX)
{ {
if (wn->hide_cursor_timer) if (wn->hide_cursor_timer)
{ {
@ -1819,7 +1819,7 @@ imf_done:
} }
if (!isnan(wn->config->hide_cursor)) if (wn->config->hide_cursor < CONFIG_CURSOR_IDLE_TIMEOUT_MAX)
{ {
wn->hide_cursor_timer = ecore_timer_add( wn->hide_cursor_timer = ecore_timer_add(
wn->config->hide_cursor, _hide_cursor, wn); wn->config->hide_cursor, _hide_cursor, wn);