diff --git a/kitty/child-monitor.c b/kitty/child-monitor.c index 53cb73530..399d62df8 100644 --- a/kitty/child-monitor.c +++ b/kitty/child-monitor.c @@ -28,6 +28,7 @@ extern int pthread_setname_np(const char *name); #include #include #include +extern PyTypeObject Screen_Type; #define EXTRA_FDS 2 #define wakeup_main_loop glfwPostEmptyEvent diff --git a/kitty/colors.c b/kitty/colors.c index e78d3c502..4d9e612b7 100644 --- a/kitty/colors.c +++ b/kitty/colors.c @@ -8,6 +8,8 @@ #include "data-types.h" #include +PyTypeObject ColorProfile_Type; + static uint32_t FG_BG_256[256] = { 0x000000, // 0 0xcd0000, // 1 diff --git a/kitty/data-types.h b/kitty/data-types.h index 847e2a18f..37ccbf8c8 100644 --- a/kitty/data-types.h +++ b/kitty/data-types.h @@ -135,7 +135,6 @@ typedef struct { bool continued; bool needs_free; } Line; -PyTypeObject Line_Type; typedef struct { @@ -146,7 +145,6 @@ typedef struct { bool *continued_map; Line *line; } LineBuf; -PyTypeObject LineBuf_Type; typedef struct { @@ -158,7 +156,6 @@ typedef struct { index_type start_of_data, count; bool *continued_map; } HistoryBuf; -PyTypeObject HistoryBuf_Type; typedef struct { PyObject_HEAD @@ -170,10 +167,6 @@ typedef struct { unsigned long fg, bg, decoration_fg; } Cursor; -PyTypeObject Cursor_Type; - -PyTypeObject Face_Type; -PyTypeObject Window_Type; typedef struct { color_type default_fg, default_bg, cursor_color, highlight_fg, highlight_bg; @@ -187,7 +180,6 @@ typedef struct { uint32_t orig_color_table[256]; DynamicColor configured, overridden; } ColorProfile; -PyTypeObject ColorProfile_Type; #define SAVEPOINTS_SZ 256 @@ -223,7 +215,6 @@ typedef struct { bool shutting_down; pthread_t io_thread; } ChildMonitor; -PyTypeObject ChildMonitor_Type; #define clear_sprite_position(cell) (cell).sprite_x = 0; (cell).sprite_y = 0; (cell).sprite_z = 0; diff --git a/kitty/graphics.c b/kitty/graphics.c index 7756caab5..b6427e779 100644 --- a/kitty/graphics.c +++ b/kitty/graphics.c @@ -17,6 +17,7 @@ #include #include #include +PyTypeObject GraphicsManager_Type; #define STORAGE_LIMIT (320 * (1024 * 1024)) diff --git a/kitty/graphics.h b/kitty/graphics.h index f7f11da2e..f3c8bc048 100644 --- a/kitty/graphics.h +++ b/kitty/graphics.h @@ -74,7 +74,6 @@ typedef struct { unsigned int last_scrolled_by; size_t used_storage; } GraphicsManager; -PyTypeObject GraphicsManager_Type; typedef struct { diff --git a/kitty/history.c b/kitty/history.c index b33273fce..1e716bfc5 100644 --- a/kitty/history.c +++ b/kitty/history.c @@ -9,6 +9,8 @@ #include "lineops.h" #include +extern PyTypeObject Line_Type; + static inline Cell* lineptr(HistoryBuf *linebuf, index_type y) { return linebuf->buf + y * linebuf->xnum; diff --git a/kitty/line-buf.c b/kitty/line-buf.c index 3769c054c..79f79d1c2 100644 --- a/kitty/line-buf.c +++ b/kitty/line-buf.c @@ -9,6 +9,9 @@ #include "lineops.h" #include +extern PyTypeObject Line_Type; +extern PyTypeObject HistoryBuf_Type; + static inline Cell* lineptr(LineBuf *linebuf, index_type y) { return linebuf->buf + y * linebuf->xnum; diff --git a/kitty/line.c b/kitty/line.c index 88fcbbbea..c647085db 100644 --- a/kitty/line.c +++ b/kitty/line.c @@ -9,6 +9,8 @@ #include "unicode-data.h" #include "lineops.h" +extern PyTypeObject Cursor_Type; + static PyObject * new(PyTypeObject UNUSED *type, PyObject UNUSED *args, PyObject UNUSED *kwds) { PyErr_SetString(PyExc_TypeError, "Line objects cannot be instantiated directly, create them using LineBuf.line()"); diff --git a/kitty/parser.c b/kitty/parser.c index 120d5980f..9f088176c 100644 --- a/kitty/parser.c +++ b/kitty/parser.c @@ -10,6 +10,8 @@ #include "graphics.h" #include +extern PyTypeObject Screen_Type; + // utils {{{ static unsigned long pow10[] = { 1, 10, 100, 1000, 10000, 100000, 1000000, 10000000, 100000000, 1000000000, 10000000000 @@ -894,6 +896,8 @@ dispatch_unicode_char(Screen *screen, uint32_t codepoint, PyObject DUMP_UNUSED * #undef HANDLE } +extern uint32_t *latin1_charset; + static inline void _parse_bytes(Screen *screen, uint8_t *buf, Py_ssize_t len, PyObject DUMP_UNUSED *dump_callback) { uint32_t prev = screen->utf8_state; diff --git a/kitty/screen.h b/kitty/screen.h index 320f8c733..96a893efa 100644 --- a/kitty/screen.h +++ b/kitty/screen.h @@ -56,7 +56,6 @@ typedef struct { pthread_mutex_t read_buf_lock, write_buf_lock; } Screen; -PyTypeObject Screen_Type; void parse_worker(Screen *screen, PyObject *dump_callback); @@ -108,7 +107,6 @@ void set_icon(Screen *self, PyObject*); void set_dynamic_color(Screen *self, unsigned int code, PyObject*); void set_color_table_color(Screen *self, unsigned int code, PyObject*); uint32_t* translation_table(uint32_t which); -uint32_t *latin1_charset; void screen_request_capabilities(Screen *, PyObject *); void report_device_attributes(Screen *self, unsigned int UNUSED mode, char start_modifier); void select_graphic_rendition(Screen *self, unsigned int *params, unsigned int count);