Fix rendering occasionally not occurring after input received
This commit is contained in:
parent
ee581ebdf4
commit
33f48e8268
@ -480,10 +480,14 @@ render_cursor(Window *w, double now) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline bool
|
static inline void
|
||||||
render(double now) {
|
render(double now) {
|
||||||
double time_since_last_render = now - last_render_at;
|
double time_since_last_render = now - last_render_at;
|
||||||
if (time_since_last_render > OPT(repaint_delay)) {
|
if (time_since_last_render < OPT(repaint_delay)) {
|
||||||
|
set_maximum_wait(OPT(repaint_delay) - time_since_last_render);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
draw_borders();
|
draw_borders();
|
||||||
#define TD global_state.tab_bar_render_data
|
#define TD global_state.tab_bar_render_data
|
||||||
if (TD.screen && global_state.num_tabs > 1) draw_cells(TD.vao_idx, TD.xstart, TD.ystart, TD.dx, TD.dy, TD.screen);
|
if (TD.screen && global_state.num_tabs > 1) draw_cells(TD.vao_idx, TD.xstart, TD.ystart, TD.dx, TD.dy, TD.screen);
|
||||||
@ -522,10 +526,6 @@ render(double now) {
|
|||||||
}
|
}
|
||||||
glfwSwapBuffers(glfw_window_id);
|
glfwSwapBuffers(glfw_window_id);
|
||||||
last_render_at = now;
|
last_render_at = now;
|
||||||
} else {
|
|
||||||
set_maximum_wait(OPT(repaint_delay) - time_since_last_render);
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef struct { int fd; uint8_t *buf; size_t sz; } ThreadWriteData;
|
typedef struct { int fd; uint8_t *buf; size_t sz; } ThreadWriteData;
|
||||||
@ -581,14 +581,14 @@ main_loop(ChildMonitor *self) {
|
|||||||
#define main_loop_doc "The main thread loop"
|
#define main_loop_doc "The main thread loop"
|
||||||
while (!glfwWindowShouldClose(glfw_window_id)) {
|
while (!glfwWindowShouldClose(glfw_window_id)) {
|
||||||
double now = monotonic();
|
double now = monotonic();
|
||||||
maximum_wait = -1;
|
render(now);
|
||||||
if (!render(now)) break;
|
|
||||||
if (global_state.mouse_visible && OPT(mouse_hide_wait) > 0 && now - global_state.last_mouse_activity_at > OPT(mouse_hide_wait)) {
|
if (global_state.mouse_visible && OPT(mouse_hide_wait) > 0 && now - global_state.last_mouse_activity_at > OPT(mouse_hide_wait)) {
|
||||||
glfwSetInputMode(glfw_window_id, GLFW_CURSOR, GLFW_CURSOR_HIDDEN);
|
glfwSetInputMode(glfw_window_id, GLFW_CURSOR, GLFW_CURSOR_HIDDEN);
|
||||||
global_state.mouse_visible = false;
|
global_state.mouse_visible = false;
|
||||||
}
|
}
|
||||||
if (maximum_wait < 0) glfwWaitEvents();
|
if (maximum_wait < 0) glfwWaitEvents();
|
||||||
else if (maximum_wait > 0) glfwWaitEventsTimeout(maximum_wait);
|
else if (maximum_wait > 0) glfwWaitEventsTimeout(maximum_wait);
|
||||||
|
maximum_wait = -1;
|
||||||
parse_input(self);
|
parse_input(self);
|
||||||
}
|
}
|
||||||
if (PyErr_Occurred()) return NULL;
|
if (PyErr_Occurred()) return NULL;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user