diff --git a/kitty/boss.py b/kitty/boss.py index 9b6ea1a7e..855721285 100644 --- a/kitty/boss.py +++ b/kitty/boss.py @@ -22,10 +22,9 @@ from .constants import ( from .fast_data_types import ( ChildMonitor, background_opacity_of, change_background_opacity, change_os_window_state, create_os_window, current_os_window, - destroy_global_data, get_clipboard_string, glfw_post_empty_event, - global_font_size, mark_os_window_for_close, os_window_font_size, - patch_global_colors, set_clipboard_string, set_in_sequence_mode, - toggle_fullscreen + destroy_global_data, get_clipboard_string, global_font_size, + mark_os_window_for_close, os_window_font_size, patch_global_colors, + set_clipboard_string, set_in_sequence_mode, toggle_fullscreen ) from .keys import get_shortcut, shortcut_matches from .layout import set_draw_minimal_borders @@ -345,7 +344,6 @@ class Boss: if len(tm) == 0: if not self.shutting_down: mark_os_window_for_close(os_window_id) - glfw_post_empty_event() def close_window(self, window=None): if window is None: diff --git a/kitty/glfw.c b/kitty/glfw.c index 5fcdad908..8da249695 100644 --- a/kitty/glfw.c +++ b/kitty/glfw.c @@ -733,7 +733,7 @@ dbus_user_notification_activated(uint32_t notification_id, const char* action) { } #endif -PyObject* +static PyObject* glfw_init(PyObject UNUSED *self, PyObject *args) { const char* path; int debug_keyboard = 0; @@ -765,19 +765,13 @@ glfw_init(PyObject UNUSED *self, PyObject *args) { return ans; } -PyObject* +static PyObject* glfw_terminate(PYNOARG) { glfwTerminate(); Py_RETURN_NONE; } -PyObject* -glfw_post_empty_event(PYNOARG) { - glfwPostEmptyEvent(); - Py_RETURN_NONE; -} - -PyObject* +static PyObject* glfw_poll_events(PYNOARG) { glfwPollEvents(); Py_RETURN_NONE; @@ -795,21 +789,21 @@ get_physical_dpi(GLFWmonitor *m) { return Py_BuildValue("ff", dpix, dpiy); } -PyObject* +static PyObject* glfw_get_physical_dpi(PYNOARG) { GLFWmonitor *m = glfwGetPrimaryMonitor(); if (m == NULL) { PyErr_SetString(PyExc_ValueError, "Failed to get primary monitor"); return NULL; } return get_physical_dpi(m); } -PyObject* +static PyObject* glfw_get_key_name(PyObject UNUSED *self, PyObject *args) { int key, scancode; if (!PyArg_ParseTuple(args, "ii", &key, &scancode)) return NULL; return Py_BuildValue("s", glfwGetKeyName(key, scancode)); } -PyObject* +static PyObject* glfw_window_hint(PyObject UNUSED *self, PyObject *args) { int key, val; if (!PyArg_ParseTuple(args, "ii", &key, &val)) return NULL; @@ -1182,7 +1176,6 @@ static PyMethodDef module_methods[] = { #endif {"glfw_init", (PyCFunction)glfw_init, METH_VARARGS, ""}, {"glfw_terminate", (PyCFunction)glfw_terminate, METH_NOARGS, ""}, - {"glfw_post_empty_event", (PyCFunction)glfw_post_empty_event, METH_NOARGS, ""}, {"glfw_get_physical_dpi", (PyCFunction)glfw_get_physical_dpi, METH_NOARGS, ""}, {"glfw_get_key_name", (PyCFunction)glfw_get_key_name, METH_VARARGS, ""}, {"glfw_primary_monitor_size", (PyCFunction)primary_monitor_size, METH_NOARGS, ""}, diff --git a/kitty/tabs.py b/kitty/tabs.py index bce294c7a..e030aa5fd 100644 --- a/kitty/tabs.py +++ b/kitty/tabs.py @@ -10,7 +10,7 @@ from .borders import Borders from .child import Child from .constants import appname, get_boss, is_macos, is_wayland from .fast_data_types import ( - add_tab, glfw_post_empty_event, mark_tab_bar_dirty, next_window_id, + add_tab, mark_tab_bar_dirty, next_window_id, pt_to_px, remove_tab, remove_window, ring_bell, set_active_tab, swap_tabs, x11_window_id ) @@ -244,7 +244,6 @@ class Tab: # {{{ get_boss().add_child(window) self.active_window_idx = self.current_layout.add_window(self.windows, window, self.active_window_idx) self.relayout_borders() - glfw_post_empty_event() return window def new_special_window(self, special_window): @@ -258,13 +257,11 @@ class Tab: # {{{ self.active_window_idx = self.current_layout.remove_window(self.windows, window, self.active_window_idx) remove_window(self.os_window_id, self.id, window.id) self.relayout_borders() - glfw_post_empty_event() def set_active_window_idx(self, idx): if idx != self.active_window_idx: self.active_window_idx = self.current_layout.set_active_window(self.windows, idx) self.relayout_borders() - glfw_post_empty_event() def set_active_window(self, window): try: @@ -293,13 +290,11 @@ class Tab: # {{{ else: self.active_window_idx = self.current_layout.nth_window(self.windows, num) self.relayout_borders() - glfw_post_empty_event() def _next_window(self, delta=1): if len(self.windows) > 1: self.active_window_idx = self.current_layout.next_window(self.windows, self.active_window_idx, delta) self.relayout_borders() - glfw_post_empty_event() def next_window(self): self._next_window() @@ -315,12 +310,10 @@ class Tab: # {{{ if candidates: self.active_window_idx = self.current_layout.set_active_window(self.windows, candidates[0]) self.relayout_borders() - glfw_post_empty_event() def move_window(self, delta=1): self.active_window_idx = self.current_layout.move_window(self.windows, self.active_window_idx, delta) self.relayout() - glfw_post_empty_event() def move_window_to_top(self): self.move_window(-self.active_window_idx) @@ -434,7 +427,6 @@ class TabManager: # {{{ if not self.tab_bar_hidden: self.tab_bar.layout() self.resize(only_tabs=True) - glfw_post_empty_event() def mark_tab_bar_dirty(self): if self.tab_bar_should_be_visible and not self.tab_bar_hidden: diff --git a/kitty/window.py b/kitty/window.py index 3b3b64cd6..d46f1e702 100644 --- a/kitty/window.py +++ b/kitty/window.py @@ -19,7 +19,7 @@ from .fast_data_types import ( CELL_SPECIAL_PROGRAM, CSI, DCS, DECORATION, DIM, GRAPHICS_PREMULT_PROGRAM, GRAPHICS_PROGRAM, OSC, REVERSE, SCROLL_FULL, SCROLL_LINE, SCROLL_PAGE, STRIKETHROUGH, Screen, add_window, cell_size_for_window, compile_program, - get_clipboard_string, glfw_post_empty_event, init_cell_program, + get_clipboard_string, init_cell_program, set_clipboard_string, set_titlebar_color, set_window_render_data, update_window_title, update_window_visibility, viewport_for_window ) @@ -267,7 +267,6 @@ class Window: t = self.tabref() if t is not None: t.title_changed(self) - glfw_post_empty_event() def set_title(self, title): if title: @@ -361,7 +360,6 @@ class Window: code += 1 if color_changes: self.change_colors(color_changes) - glfw_post_empty_event() def set_color_table_color(self, code, value): cp = self.screen.color_profile