From 98017f1647decbf39cc64e2c53eb0bc90ec7aa59 Mon Sep 17 00:00:00 2001 From: Boris Faure Date: Mon, 2 Sep 2019 23:27:42 +0200 Subject: [PATCH] hide cursor: fix unchecking "auto hide cursor". Closes T8148 --- src/bin/config.h | 2 ++ src/bin/options_behavior.c | 6 +++--- src/bin/win.c | 4 ++-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/bin/config.h b/src/bin/config.h index d28c445e..e9e65c71 100644 --- a/src/bin/config.h +++ b/src/bin/config.h @@ -116,4 +116,6 @@ void config_reset_keys(Config *config); const char *config_theme_path_get(const Config *config); const char *config_theme_path_default_get(const Config *config); +#define CONFIG_CURSOR_IDLE_TIMEOUT_MAX 60.0 + #endif diff --git a/src/bin/options_behavior.c b/src/bin/options_behavior.c index 9e92cc95..72164720 100644 --- a/src/bin/options_behavior.c +++ b/src/bin/options_behavior.c @@ -221,7 +221,7 @@ _cb_op_hide_cursor_changed(void *data, } 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); } 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); elm_object_text_set(o, _("Translucent")); 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); evas_object_show(o); 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_unit_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_box_pack_end(bx, o); evas_object_show(o); diff --git a/src/bin/win.c b/src/bin/win.c index 6b1382f6..c4c8be9d 100644 --- a/src/bin/win.c +++ b/src/bin/win.c @@ -1609,7 +1609,7 @@ _cb_win_mouse_move(void *data, if (wn->on_popover) return; - if (!isnan(wn->config->hide_cursor)) + if (wn->config->hide_cursor < CONFIG_CURSOR_IDLE_TIMEOUT_MAX) { 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->config->hide_cursor, _hide_cursor, wn);