mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-26 10:12:17 +02:00
Redraw windows when the window manager tells us they have been damaged
Needed on systems with non-compositing window managers. Fix #317
This commit is contained in:
@@ -623,6 +623,7 @@ render_os_window(OSWindow *os_window, double now, unsigned int active_window_id)
|
|||||||
br->is_dirty = false;
|
br->is_dirty = false;
|
||||||
os_window->last_active_tab = os_window->active_tab; os_window->last_num_tabs = os_window->num_tabs; os_window->last_active_window_id = active_window_id;
|
os_window->last_active_tab = os_window->active_tab; os_window->last_num_tabs = os_window->num_tabs; os_window->last_active_window_id = active_window_id;
|
||||||
os_window->focused_at_last_render = os_window->is_focused;
|
os_window->focused_at_last_render = os_window->is_focused;
|
||||||
|
os_window->is_damaged = false;
|
||||||
#undef WD
|
#undef WD
|
||||||
#undef TD
|
#undef TD
|
||||||
}
|
}
|
||||||
@@ -638,7 +639,7 @@ render(double now) {
|
|||||||
for (size_t i = 0; i < global_state.num_os_windows; i++) {
|
for (size_t i = 0; i < global_state.num_os_windows; i++) {
|
||||||
OSWindow *w = global_state.os_windows + i;
|
OSWindow *w = global_state.os_windows + i;
|
||||||
if (!w->num_tabs || !should_os_window_be_rendered(w)) continue;
|
if (!w->num_tabs || !should_os_window_be_rendered(w)) continue;
|
||||||
bool needs_render = w->is_focused;
|
bool needs_render = w->is_focused || w->is_damaged;
|
||||||
make_os_window_context_current(w);
|
make_os_window_context_current(w);
|
||||||
if (w->viewport_size_dirty) {
|
if (w->viewport_size_dirty) {
|
||||||
w->clear_count = 0;
|
w->clear_count = 0;
|
||||||
|
|||||||
@@ -85,6 +85,13 @@ framebuffer_size_callback(GLFWwindow *w, int width, int height) {
|
|||||||
global_state.callback_os_window = NULL;
|
global_state.callback_os_window = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
refresh_callback(GLFWwindow *w) {
|
||||||
|
if (!set_callback_window(w)) return;
|
||||||
|
global_state.callback_os_window->is_damaged = true;
|
||||||
|
global_state.callback_os_window = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
char_mods_callback(GLFWwindow *w, unsigned int codepoint, int mods) {
|
char_mods_callback(GLFWwindow *w, unsigned int codepoint, int mods) {
|
||||||
if (!set_callback_window(w)) return;
|
if (!set_callback_window(w)) return;
|
||||||
@@ -363,6 +370,7 @@ create_os_window(PyObject UNUSED *self, PyObject *args) {
|
|||||||
glfwSetCursor(glfw_window, standard_cursor);
|
glfwSetCursor(glfw_window, standard_cursor);
|
||||||
update_os_window_viewport(w, false);
|
update_os_window_viewport(w, false);
|
||||||
glfwSetFramebufferSizeCallback(glfw_window, framebuffer_size_callback);
|
glfwSetFramebufferSizeCallback(glfw_window, framebuffer_size_callback);
|
||||||
|
glfwSetWindowRefreshCallback(glfw_window, refresh_callback);
|
||||||
glfwSetCharModsCallback(glfw_window, char_mods_callback);
|
glfwSetCharModsCallback(glfw_window, char_mods_callback);
|
||||||
glfwSetMouseButtonCallback(glfw_window, mouse_button_callback);
|
glfwSetMouseButtonCallback(glfw_window, mouse_button_callback);
|
||||||
glfwSetScrollCallback(glfw_window, scroll_callback);
|
glfwSetScrollCallback(glfw_window, scroll_callback);
|
||||||
|
|||||||
@@ -111,6 +111,7 @@ typedef struct {
|
|||||||
bool has_pending_resizes;
|
bool has_pending_resizes;
|
||||||
bool is_semi_transparent;
|
bool is_semi_transparent;
|
||||||
bool shown_once;
|
bool shown_once;
|
||||||
|
bool is_damaged;
|
||||||
uint32_t offscreen_texture_id;
|
uint32_t offscreen_texture_id;
|
||||||
unsigned int clear_count;
|
unsigned int clear_count;
|
||||||
} OSWindow;
|
} OSWindow;
|
||||||
|
|||||||
Reference in New Issue
Block a user