From e52818d54c2f5491b2ec4f57430d143dc6ef2d6e Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 26 Sep 2017 12:01:59 +0530 Subject: [PATCH] Move the screen datatype decls into screen.h --- kitty/data-types.h | 50 -------------------------------------------- kitty/screen.h | 52 ++++++++++++++++++++++++++++++++++++++++++++++ kitty/state.h | 1 + 3 files changed, 53 insertions(+), 50 deletions(-) diff --git a/kitty/data-types.h b/kitty/data-types.h index 870bd158e..847e2a18f 100644 --- a/kitty/data-types.h +++ b/kitty/data-types.h @@ -189,14 +189,6 @@ typedef struct { } ColorProfile; PyTypeObject ColorProfile_Type; -typedef struct { - bool mLNM, mIRM, mDECTCEM, mDECSCNM, mDECOM, mDECAWM, mDECCOLM, mDECARM, mDECCKM, - mBRACKETED_PASTE, mFOCUS_TRACKING, mEXTENDED_KEYBOARD; - MouseTrackingMode mouse_tracking_mode; - MouseTrackingProtocol mouse_tracking_protocol; -} ScreenModes; -PyTypeObject ScreenModes_Type; - #define SAVEPOINTS_SZ 256 typedef struct { @@ -217,46 +209,6 @@ typedef struct { #define PARSER_BUF_SZ (8 * 1024) #define READ_BUF_SZ (1024*1024) -typedef struct { - unsigned int x, y; -} SelectionBoundary; - -typedef struct { - unsigned int start_x, start_y, start_scrolled_by, end_x, end_y, end_scrolled_by; - bool in_progress; -} Selection; - -typedef struct { - PyObject_HEAD - - unsigned int columns, lines, margin_top, margin_bottom, charset, scrolled_by, last_selection_scrolled_by, window_id; - uint32_t utf8_state, utf8_codepoint, *g0_charset, *g1_charset, *g_charset; - Selection selection; - SelectionBoundary last_rendered_selection_start, last_rendered_selection_end; - Selection url_range; - bool use_latin1, selection_updated_once, is_dirty, scroll_changed; - Cursor *cursor; - SavepointBuffer main_savepoints, alt_savepoints; - PyObject *callbacks, *test_child; - LineBuf *linebuf, *main_linebuf, *alt_linebuf; - HistoryBuf *historybuf; - unsigned int history_line_added_count; - bool *tabstops, *main_tabstops, *alt_tabstops; - ScreenModes modes; - ColorProfile *color_profile; - double start_visual_bell_at; - - uint32_t parser_buf[PARSER_BUF_SZ]; - unsigned int parser_state, parser_text_start, parser_buf_pos; - bool parser_has_pending_text; - uint8_t read_buf[READ_BUF_SZ], *write_buf; - double new_input_at; - size_t read_buf_sz, write_buf_sz, write_buf_used; - pthread_mutex_t read_buf_lock, write_buf_lock; - -} Screen; -PyTypeObject Screen_Type; - typedef struct { double at; PyObject *callback; @@ -293,8 +245,6 @@ LineBuf* alloc_linebuf(unsigned int, unsigned int); HistoryBuf* alloc_historybuf(unsigned int, unsigned int); ColorProfile* alloc_color_profile(); PyObject* create_256_color_table(); -void parse_worker(Screen *screen, PyObject *dump_callback); -void parse_worker_dump(Screen *screen, PyObject *dump_callback); PyObject* parse_bytes_dump(PyObject UNUSED *, PyObject *); PyObject* parse_bytes(PyObject UNUSED *, PyObject *); uint32_t decode_utf8(uint32_t*, uint32_t*, uint8_t byte); diff --git a/kitty/screen.h b/kitty/screen.h index e6d11b7a9..b552b1a98 100644 --- a/kitty/screen.h +++ b/kitty/screen.h @@ -6,8 +6,60 @@ #pragma once +#include "graphics.h" + typedef enum ScrollTypes { SCROLL_LINE = -999999, SCROLL_PAGE, SCROLL_FULL } ScrollType; +typedef struct { + bool mLNM, mIRM, mDECTCEM, mDECSCNM, mDECOM, mDECAWM, mDECCOLM, mDECARM, mDECCKM, + mBRACKETED_PASTE, mFOCUS_TRACKING, mEXTENDED_KEYBOARD; + MouseTrackingMode mouse_tracking_mode; + MouseTrackingProtocol mouse_tracking_protocol; +} ScreenModes; + +typedef struct { + unsigned int x, y; +} SelectionBoundary; + +typedef struct { + unsigned int start_x, start_y, start_scrolled_by, end_x, end_y, end_scrolled_by; + bool in_progress; +} Selection; + +typedef struct { + PyObject_HEAD + + unsigned int columns, lines, margin_top, margin_bottom, charset, scrolled_by, last_selection_scrolled_by, window_id; + uint32_t utf8_state, utf8_codepoint, *g0_charset, *g1_charset, *g_charset; + Selection selection; + SelectionBoundary last_rendered_selection_start, last_rendered_selection_end; + Selection url_range; + bool use_latin1, selection_updated_once, is_dirty, scroll_changed; + Cursor *cursor; + SavepointBuffer main_savepoints, alt_savepoints; + PyObject *callbacks, *test_child; + LineBuf *linebuf, *main_linebuf, *alt_linebuf; + HistoryBuf *historybuf; + unsigned int history_line_added_count; + bool *tabstops, *main_tabstops, *alt_tabstops; + ScreenModes modes; + ColorProfile *color_profile; + double start_visual_bell_at; + + uint32_t parser_buf[PARSER_BUF_SZ]; + unsigned int parser_state, parser_text_start, parser_buf_pos; + bool parser_has_pending_text; + uint8_t read_buf[READ_BUF_SZ], *write_buf; + double new_input_at; + size_t read_buf_sz, write_buf_sz, write_buf_used; + pthread_mutex_t read_buf_lock, write_buf_lock; + +} Screen; +PyTypeObject Screen_Type; + + +void parse_worker(Screen *screen, PyObject *dump_callback); +void parse_worker_dump(Screen *screen, PyObject *dump_callback); void screen_align(Screen*); void screen_restore_cursor(Screen *); void screen_save_cursor(Screen *); diff --git a/kitty/state.h b/kitty/state.h index d8852f065..94092d1cd 100644 --- a/kitty/state.h +++ b/kitty/state.h @@ -6,6 +6,7 @@ #pragma once #include "data-types.h" +#include "screen.h" #define OPT(name) global_state.opts.name