Skip to content

Commit

Permalink
Wayland: Fix kitty being killed on some Wayland compositors if a hidd…
Browse files Browse the repository at this point in the history
…en window has a lot of output

Sway falls over and dies if it receives many render frame
requests. So send only a single one per damaged window and hope and pray
that the compositor hasn't dropped it. Shrug, Wayland, no surprise.
Fixes #2329
  • Loading branch information
kovidgoyal committed May 20, 2020
1 parent 936f6c2 commit d12e108
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
3 changes: 3 additions & 0 deletions docs/changelog.rst
Expand Up @@ -22,6 +22,9 @@ To update |kitty|, :doc:`follow the instructions <binary>`.

- Linux: Workaround for broken Nvidia drivers for old cards (:iss:`456`)

- Wayland: Fix kitty being killed on some Wayland compositors if a hidden window
has a lot of output (:iss:`2329`)


0.17.4 [2020-05-09]
--------------------
Expand Down
8 changes: 7 additions & 1 deletion kitty/child-monitor.c
Expand Up @@ -632,7 +632,13 @@ draw_resizing_text(OSWindow *w) {
static inline bool
no_render_frame_received_recently(OSWindow *w, monotonic_t now, monotonic_t max_wait) {
bool ans = now - w->last_render_frame_received_at > max_wait;
if (ans && global_state.debug_rendering) log_error("No render frame received in %.2f seconds, re-requesting at: %f", monotonic_t_to_s_double(max_wait), monotonic_t_to_s_double(now));
if (ans && global_state.debug_rendering) {
if (global_state.is_wayland) {
log_error("No render frame received in %.2f seconds", monotonic_t_to_s_double(max_wait));
} else {
log_error("No render frame received in %.2f seconds, re-requesting at: %f", monotonic_t_to_s_double(max_wait), monotonic_t_to_s_double(now));
}
}
return ans;
}

Expand Down
8 changes: 6 additions & 2 deletions kitty/glfw.c
Expand Up @@ -1109,8 +1109,12 @@ wayland_frame_request_callback(id_type os_window_id) {

void
request_frame_render(OSWindow *w) {
glfwRequestWaylandFrameEvent(w->handle, w->id, wayland_frame_request_callback);
w->render_state = RENDER_FRAME_REQUESTED;
// Some Wayland compositors are too fragile to handle multiple
// render frame requests, see https://github.com/kovidgoyal/kitty/issues/2329
if (w->render_state != RENDER_FRAME_REQUESTED) {
glfwRequestWaylandFrameEvent(w->handle, w->id, wayland_frame_request_callback);
w->render_state = RENDER_FRAME_REQUESTED;
}
}

void
Expand Down

0 comments on commit d12e108

Please sign in to comment.