Allow the user to control the resize debounce time via resize_debounce_time

This commit is contained in:
Kovid Goyal 2019-04-28 21:16:13 +05:30
parent c660840c19
commit 53df123c0d
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
5 changed files with 14 additions and 5 deletions

View File

@ -8,7 +8,7 @@ To update |kitty|, :doc:`follow the instructions <binary>`.
--------------------- ---------------------
- macOS: The default behavior of the Option key has changed. It now generates - macOS: The default behavior of the Option key has changed. It now generates
unicode characters rather than acting as the Alt modifier. See unicode characters rather than acting as the :kbd:`Alt` modifier. See
:opt:`macos_option_as_alt`. :opt:`macos_option_as_alt`.
- Support for an arbitrary number of internal clipboard buffers to copy/paste - Support for an arbitrary number of internal clipboard buffers to copy/paste
@ -117,6 +117,9 @@ To update |kitty|, :doc:`follow the instructions <binary>`.
- When encountering errors in :file:`kitty.conf` report them to the user - When encountering errors in :file:`kitty.conf` report them to the user
instead of failing to start. instead of failing to start.
- Allow the user to control the resize debounce time via
:opt:`resize_debounce_time`.
0.13.3 [2019-01-19] 0.13.3 [2019-01-19]
------------------------------ ------------------------------

View File

@ -831,10 +831,10 @@ process_pending_resizes(double now) {
if (w->live_resize.from_os_notification) { if (w->live_resize.from_os_notification) {
if (w->live_resize.os_says_resize_complete || (now - w->live_resize.last_resize_event_at) > 1) update_viewport = true; if (w->live_resize.os_says_resize_complete || (now - w->live_resize.last_resize_event_at) > 1) update_viewport = true;
} else { } else {
if (now - w->live_resize.last_resize_event_at >= RESIZE_DEBOUNCE_TIME) update_viewport = true; if (now - w->live_resize.last_resize_event_at >= OPT(resize_debounce_time)) update_viewport = true;
else { else {
global_state.has_pending_resizes = true; global_state.has_pending_resizes = true;
set_maximum_wait(RESIZE_DEBOUNCE_TIME - now + w->live_resize.last_resize_event_at); set_maximum_wait(OPT(resize_debounce_time) - now + w->live_resize.last_resize_event_at);
} }
} }
if (update_viewport) { if (update_viewport) {

View File

@ -603,6 +603,12 @@ Hide the window decorations (title-bar and window borders).
Whether this works and exactly what effect it has depends on the Whether this works and exactly what effect it has depends on the
window manager/operating system. window manager/operating system.
''')) '''))
o('resize_debounce_time', 0.1, option_type=positive_float, long_text=_('''
The time (in seconds) to wait before redrawing the screen when a
resize event is received. On platforms such as macOS, where the
operating system sends event corresponding to the start and end
of a resize, this number is ignored.'''))
# }}} # }}}
g('tabbar') # {{{ g('tabbar') # {{{

View File

@ -387,6 +387,7 @@ PYWRAP1(set_options) {
S(open_url_modifiers, convert_mods); S(open_url_modifiers, convert_mods);
S(rectangle_select_modifiers, convert_mods); S(rectangle_select_modifiers, convert_mods);
S(click_interval, PyFloat_AsDouble); S(click_interval, PyFloat_AsDouble);
S(resize_debounce_time, PyFloat_AsDouble);
S(url_color, color_as_int); S(url_color, color_as_int);
S(background, color_as_int); S(background, color_as_int);
S(foreground, color_as_int); S(foreground, color_as_int);

View File

@ -40,6 +40,7 @@ typedef struct {
bool close_on_child_death; bool close_on_child_death;
bool window_alert_on_bell; bool window_alert_on_bell;
bool debug_keyboard; bool debug_keyboard;
double resize_debounce_time;
} Options; } Options;
typedef struct { typedef struct {
@ -178,8 +179,6 @@ extern GlobalState global_state;
else Py_DECREF(cret_); \ else Py_DECREF(cret_); \
} }
#define RESIZE_DEBOUNCE_TIME 0.2
void gl_init(); void gl_init();
void remove_vao(ssize_t vao_idx); void remove_vao(ssize_t vao_idx);
bool remove_os_window(id_type os_window_id); bool remove_os_window(id_type os_window_id);