Skip to content

Commit 53df123

Browse files
committed
Allow the user to control the resize debounce time via resize_debounce_time
1 parent c660840 commit 53df123

File tree

5 files changed

+14
-5
lines changed

5 files changed

+14
-5
lines changed

docs/changelog.rst

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ To update |kitty|, :doc:`follow the instructions <binary>`.
88
---------------------
99

1010
- macOS: The default behavior of the Option key has changed. It now generates
11-
unicode characters rather than acting as the Alt modifier. See
11+
unicode characters rather than acting as the :kbd:`Alt` modifier. See
1212
:opt:`macos_option_as_alt`.
1313

1414
- Support for an arbitrary number of internal clipboard buffers to copy/paste
@@ -117,6 +117,9 @@ To update |kitty|, :doc:`follow the instructions <binary>`.
117117
- When encountering errors in :file:`kitty.conf` report them to the user
118118
instead of failing to start.
119119

120+
- Allow the user to control the resize debounce time via
121+
:opt:`resize_debounce_time`.
122+
120123

121124
0.13.3 [2019-01-19]
122125
------------------------------

kitty/child-monitor.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -831,10 +831,10 @@ process_pending_resizes(double now) {
831831
if (w->live_resize.from_os_notification) {
832832
if (w->live_resize.os_says_resize_complete || (now - w->live_resize.last_resize_event_at) > 1) update_viewport = true;
833833
} else {
834-
if (now - w->live_resize.last_resize_event_at >= RESIZE_DEBOUNCE_TIME) update_viewport = true;
834+
if (now - w->live_resize.last_resize_event_at >= OPT(resize_debounce_time)) update_viewport = true;
835835
else {
836836
global_state.has_pending_resizes = true;
837-
set_maximum_wait(RESIZE_DEBOUNCE_TIME - now + w->live_resize.last_resize_event_at);
837+
set_maximum_wait(OPT(resize_debounce_time) - now + w->live_resize.last_resize_event_at);
838838
}
839839
}
840840
if (update_viewport) {

kitty/config_data.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -603,6 +603,12 @@ def to_layout_names(raw):
603603
Whether this works and exactly what effect it has depends on the
604604
window manager/operating system.
605605
'''))
606+
607+
o('resize_debounce_time', 0.1, option_type=positive_float, long_text=_('''
608+
The time (in seconds) to wait before redrawing the screen when a
609+
resize event is received. On platforms such as macOS, where the
610+
operating system sends event corresponding to the start and end
611+
of a resize, this number is ignored.'''))
606612
# }}}
607613

608614
g('tabbar') # {{{

kitty/state.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -387,6 +387,7 @@ PYWRAP1(set_options) {
387387
S(open_url_modifiers, convert_mods);
388388
S(rectangle_select_modifiers, convert_mods);
389389
S(click_interval, PyFloat_AsDouble);
390+
S(resize_debounce_time, PyFloat_AsDouble);
390391
S(url_color, color_as_int);
391392
S(background, color_as_int);
392393
S(foreground, color_as_int);

kitty/state.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ typedef struct {
4040
bool close_on_child_death;
4141
bool window_alert_on_bell;
4242
bool debug_keyboard;
43+
double resize_debounce_time;
4344
} Options;
4445

4546
typedef struct {
@@ -178,8 +179,6 @@ extern GlobalState global_state;
178179
else Py_DECREF(cret_); \
179180
}
180181

181-
#define RESIZE_DEBOUNCE_TIME 0.2
182-
183182
void gl_init();
184183
void remove_vao(ssize_t vao_idx);
185184
bool remove_os_window(id_type os_window_id);

0 commit comments

Comments
 (0)