From 3d440cf0f68cec80858ef2e18be5c99d272c8e07 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 5 Apr 2025 02:42:39 +0530 Subject: [PATCH] Cleanup previous PR --- docs/changelog.rst | 5 ++++ kitty/glfw.c | 2 +- kitty/options/definition.py | 51 ++++++++++++++++++------------------- 3 files changed, 31 insertions(+), 27 deletions(-) diff --git a/docs/changelog.rst b/docs/changelog.rst index b34769266..91583efb3 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -94,6 +94,11 @@ consumption to do the same tasks. Detailed list of changes ------------------------------------- +0.42.0 [future] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +- Allow configuring the mouse unhide behavior when using :opt:`mouse_hide_wait` (:pull:`8508`) + 0.41.1 [2025-04-03] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/kitty/glfw.c b/kitty/glfw.c index 8b3377056..fb218c11a 100644 --- a/kitty/glfw.c +++ b/kitty/glfw.c @@ -224,7 +224,7 @@ cursor_active_callback(GLFWwindow *w, monotonic_t now) { } else if (OPT(mouse_hide.unhide_wait) > 0) { if (global_state.callback_os_window->mouse_activate_deadline == -1) { global_state.callback_os_window->mouse_activate_deadline = OPT(mouse_hide.unhide_wait) + now; - global_state.callback_os_window->mouse_show_threshold = (int) (OPT(mouse_hide.unhide_wait) / 1e9 * OPT(mouse_hide.unhide_threshold)); + global_state.callback_os_window->mouse_show_threshold = (int) (monotonic_t_to_ms(OPT(mouse_hide.unhide_wait)) * OPT(mouse_hide.unhide_threshold)); } else if (now < global_state.callback_os_window->mouse_activate_deadline) { if (global_state.callback_os_window->mouse_show_threshold > 0) { global_state.callback_os_window->mouse_show_threshold--; diff --git a/kitty/options/definition.py b/kitty/options/definition.py index 10380a9e5..8e6753a25 100644 --- a/kitty/options/definition.py +++ b/kitty/options/definition.py @@ -523,39 +523,38 @@ By default, once the cursor is hidden, it is immediately unhidden on any further mouse events. Two formats are supported: - - "" - - " " + - :code:`` + - :code:` ` -To change the unhide behavior, the optional parameters , -, and may be set. +To change the unhide behavior, the optional parameters :code:``, +:code:``, and :code:`` may be set. -: -Waits for the specified number of seconds after mouse events before unhiding the -mouse cursor. Set to zero to unhide mouse cursor immediately on mouse activity. -This is useful to prevent the mouse cursor from unhiding on accidental swipes on -the trackpad. +:code:`` + Waits for the specified number of seconds after mouse events before unhiding the + mouse cursor. Set to zero to unhide mouse cursor immediately on mouse activity. + This is useful to prevent the mouse cursor from unhiding on accidental swipes on + the trackpad. -: -Sets the threshold of mouse activity required to unhide the mouse cursor, when -the option is non-zero. When is zero, this has no -effect. +:code:`` + Sets the threshold of mouse activity required to unhide the mouse cursor, when + the option is non-zero. When is zero, this has no + effect. -For example, if is 40 and is 2.5, when kitty -detects a mouse event, it records the number of mouse events in the next 2.5 -seconds, and checks if that exceeds 40 * 2.5 = 100. If it does, then the mouse -cursor is unhidden, otherwise nothing happens. - -: -Controls what mouse events may unhide the mouse cursor. If enabled, both scroll -and movement events may unhide the cursor. If disabled, only mouse movements can -unhide the cursor. + For example, if :code:`` is 40 and :code:`` is 2.5, when kitty + detects a mouse event, it records the number of mouse events in the next 2.5 + seconds, and checks if that exceeds 40 * 2.5 = 100. If it does, then the mouse + cursor is unhidden, otherwise nothing happens. +:code:`` + Controls what mouse events may unhide the mouse cursor. If enabled, both scroll + and movement events may unhide the cursor. If disabled, only mouse movements can + unhide the cursor. Examples of valid values: - - 0.0 - - 1.0 - - -1.0 - - 0.1 3.0 40 yes + - :code:`0.0` + - :code:`1.0` + - :code:`-1.0` + - :code:`0.1 3.0 40 yes` ''' )