diff --git a/kitty/boss.py b/kitty/boss.py index 0c4add4bd..8ef34700e 100644 --- a/kitty/boss.py +++ b/kitty/boss.py @@ -2371,7 +2371,7 @@ class Boss: # Update colors for w in self.all_windows: self.default_bg_changed_for(w.id) - w.refresh() + w.refresh(reload_all_gpu_data=True) self.prewarm.reload_kitty_config() @ac('misc', ''' diff --git a/kitty/fast_data_types.pyi b/kitty/fast_data_types.pyi index 60d8d0850..6d756a03b 100644 --- a/kitty/fast_data_types.pyi +++ b/kitty/fast_data_types.pyi @@ -1105,6 +1105,9 @@ class Screen: def mark_as_dirty(self) -> None: pass + def reload_all_gpu_data(self) -> None: + pass + def resize(self, width: int, height: int) -> None: pass diff --git a/kitty/screen.c b/kitty/screen.c index 8ad4e8fdf..c2e940bf2 100644 --- a/kitty/screen.c +++ b/kitty/screen.c @@ -3789,6 +3789,13 @@ mark_as_dirty(Screen *self, PyObject *a UNUSED) { Py_RETURN_NONE; } +static PyObject* +reload_all_gpu_data(Screen *self, PyObject *a UNUSED) { + self->reload_all_gpu_data = true; + Py_RETURN_NONE; +} + + static PyObject* current_char_width(Screen *self, PyObject *a UNUSED) { #define current_char_width_doc "The width of the character under the cursor" @@ -4154,6 +4161,7 @@ static PyMethodDef methods[] = { {"clear_selection", (PyCFunction)clear_selection_, METH_NOARGS, ""}, MND(reverse_index, METH_NOARGS) MND(mark_as_dirty, METH_NOARGS) + MND(reload_all_gpu_data, METH_NOARGS) MND(resize, METH_VARARGS) MND(ignore_bells_for, METH_VARARGS) MND(set_margins, METH_VARARGS) diff --git a/kitty/window.py b/kitty/window.py index e25531472..d8ee47ed4 100644 --- a/kitty/window.py +++ b/kitty/window.py @@ -816,8 +816,10 @@ class Window: if val: self.refresh() - def refresh(self) -> None: + def refresh(self, reload_all_gpu_data: bool = False) -> None: self.screen.mark_as_dirty() + if reload_all_gpu_data: + self.screen.reload_all_gpu_data() wakeup_io_loop() wakeup_main_loop()