Avoid rapid transitions between the cells banner and the normal terminal view when live resizing on systems without live resizing notifications
This commit is contained in:
parent
53df123c0d
commit
7622cbaed5
@ -831,7 +831,12 @@ process_pending_resizes(double now) {
|
||||
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;
|
||||
} else {
|
||||
if (now - w->live_resize.last_resize_event_at >= OPT(resize_debounce_time)) update_viewport = true;
|
||||
double debounce_time = OPT(resize_debounce_time);
|
||||
// if more than one resize event has occurred, wait at least 0.2 secs
|
||||
// before repainting, to avoid rapid transitions between the cells banner
|
||||
// and the normal screen
|
||||
if (w->live_resize.num_of_resize_events > 1) debounce_time = MAX(0.2, debounce_time);
|
||||
if (now - w->live_resize.last_resize_event_at >= debounce_time) update_viewport = true;
|
||||
else {
|
||||
global_state.has_pending_resizes = true;
|
||||
set_maximum_wait(OPT(resize_debounce_time) - now + w->live_resize.last_resize_event_at);
|
||||
|
||||
@ -159,6 +159,7 @@ framebuffer_size_callback(GLFWwindow *w, int width, int height) {
|
||||
window->live_resize.in_progress = true;
|
||||
window->live_resize.last_resize_event_at = monotonic();
|
||||
window->live_resize.width = MAX(0, width); window->live_resize.height = MAX(0, height);
|
||||
window->live_resize.num_of_resize_events++;
|
||||
make_os_window_context_current(window);
|
||||
update_surface_size(width, height, window->offscreen_texture_id);
|
||||
request_tick_callback();
|
||||
|
||||
@ -113,7 +113,7 @@ typedef struct {
|
||||
bool in_progress;
|
||||
bool from_os_notification;
|
||||
bool os_says_resize_complete;
|
||||
unsigned int width, height;
|
||||
unsigned int width, height, num_of_resize_events;
|
||||
} LiveResizeInfo;
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user