winegstreamer: Avoid leaking buffer list in wg_transform_read_data.
[wine.git] / programs / conhost / conhost.h
blob9f2a90cd51054aa3b0b499e9f4799f7c846b4440
1 /*
2 * Copyright 1998 Alexandre Julliard
3 * Copyright 2001 Eric Pouech
4 * Copyright 2012 Detlef Riekenberg
5 * Copyright 2020 Jacek Caban
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
22 #ifndef RC_INVOKED
24 #include <stdarg.h>
25 #include <stdlib.h>
27 #include <ntstatus.h>
28 #define WIN32_NO_STATUS
29 #include <windef.h>
30 #include <winbase.h>
31 #include <winuser.h>
32 #include <winnls.h>
33 #include <winternl.h>
35 #include "wine/condrv.h"
36 #include "wine/rbtree.h"
38 struct history_line
40 size_t len;
41 WCHAR text[1];
44 struct font_info
46 short int width;
47 short int height;
48 short int weight;
49 short int pitch_family;
50 WCHAR *face_name;
51 size_t face_len;
54 struct edit_line
56 NTSTATUS status; /* edit status */
57 WCHAR *buf; /* the line being edited */
58 unsigned int len; /* number of chars in line */
59 size_t size; /* buffer size */
60 unsigned int cursor; /* offset for cursor in current line */
61 WCHAR *yanked; /* yanked line */
62 unsigned int mark; /* marked point (emacs mode only) */
63 unsigned int history_index; /* history index */
64 WCHAR *current_history; /* buffer for the recent history entry */
65 BOOL insert_key; /* insert key state */
66 BOOL insert_mode; /* insert mode */
67 unsigned int update_begin; /* update region */
68 unsigned int update_end;
69 unsigned int end_offset; /* offset of the last written char */
70 unsigned int home_x; /* home position */
71 unsigned int home_y;
72 unsigned int ctrl_mask; /* mask for ctrl characters for completion */
75 struct console
77 HANDLE server; /* console server handle */
78 unsigned int mode; /* input mode */
79 struct screen_buffer *active; /* active screen buffer */
80 int is_unix; /* UNIX terminal mode */
81 int use_relative_cursor; /* use relative cursor positioning */
82 int no_window; /* don't create console window */
83 INPUT_RECORD *records; /* input records */
84 unsigned int record_count; /* number of input records */
85 unsigned int record_size; /* size of input records buffer */
86 int signaled; /* is server in signaled state */
87 WCHAR *read_buffer; /* buffer of data available for read */
88 size_t read_buffer_count; /* size of available data */
89 size_t read_buffer_size; /* size of buffer */
90 unsigned int read_ioctl; /* current read ioctl */
91 size_t pending_read; /* size of pending read buffer */
92 struct edit_line edit_line; /* edit line context */
93 unsigned int key_state;
94 struct console_window *window;
95 WCHAR *title; /* console title */
96 struct history_line **history; /* lines history */
97 unsigned int history_size; /* number of entries in history array */
98 unsigned int history_index; /* number of used entries in history array */
99 unsigned int history_mode; /* mode of history (non zero means remove doubled strings */
100 unsigned int edition_mode; /* index to edition mode flavors */
101 unsigned int input_cp; /* console input codepage */
102 unsigned int output_cp; /* console output codepage */
103 HWND win; /* window handle if backend supports it */
104 HANDLE input_thread; /* input thread handle */
105 HANDLE tty_input; /* handle to tty input stream */
106 HANDLE tty_output; /* handle to tty output stream */
107 char tty_buffer[4096]; /* tty output buffer */
108 size_t tty_buffer_count; /* tty buffer size */
109 unsigned int tty_cursor_x; /* tty cursor position */
110 unsigned int tty_cursor_y;
111 unsigned int tty_attr; /* current tty char attributes */
112 int tty_cursor_visible; /* tty cursor visibility flag */
115 struct screen_buffer
117 struct console *console; /* console reference */
118 unsigned int id; /* screen buffer id */
119 unsigned int mode; /* output mode */
120 unsigned int width; /* size (w-h) of the screen buffer */
121 unsigned int height;
122 unsigned int cursor_size; /* size of cursor (percentage filled) */
123 unsigned int cursor_visible; /* cursor visibility flag */
124 unsigned int cursor_x; /* position of cursor */
125 unsigned int cursor_y; /* position of cursor */
126 unsigned short attr; /* default fill attributes (screen colors) */
127 unsigned short popup_attr; /* pop-up color attributes */
128 unsigned int max_width; /* size (w-h) of the window given font size */
129 unsigned int max_height;
130 char_info_t *data; /* the data for each cell - a width x height matrix */
131 unsigned int color_map[16]; /* color table */
132 RECT win; /* current visible window on the screen buffer */
133 struct font_info font; /* console font information */
134 struct wine_rb_entry entry; /* map entry */
137 /* conhost.c */
138 NTSTATUS write_console_input( struct console *console, const INPUT_RECORD *records,
139 unsigned int count, BOOL flush );
141 void notify_screen_buffer_size( struct screen_buffer *screen_buffer );
142 NTSTATUS change_screen_buffer_size( struct screen_buffer *screen_buffer, int new_width, int new_height );
144 /* window.c */
145 void update_console_font( struct console *console, const WCHAR *face_name, size_t face_name_size,
146 unsigned int height, unsigned int weight );
147 BOOL init_window( struct console *console );
148 void init_message_window( struct console *console );
149 void update_window_region( struct console *console, const RECT *update );
150 void update_window_config( struct console *console, BOOL delay );
152 static inline void empty_update_rect( struct screen_buffer *screen_buffer, RECT *rect )
154 SetRect( rect, screen_buffer->width, screen_buffer->height, 0, 0 );
157 static inline unsigned int get_bounded_cursor_x( struct screen_buffer *screen_buffer )
159 return min( screen_buffer->cursor_x, screen_buffer->width - 1 );
162 #endif /* RC_INVOKED */
164 /* strings */
165 #define IDS_EDIT 0x100
166 #define IDS_DEFAULT 0x101
167 #define IDS_PROPERTIES 0x102
169 #define IDS_MARK 0x110
170 #define IDS_COPY 0x111
171 #define IDS_PASTE 0x112
172 #define IDS_SELECTALL 0x113
173 #define IDS_SCROLL 0x114
174 #define IDS_SEARCH 0x115
176 #define IDS_DLG_TIT_DEFAULT 0x120
177 #define IDS_DLG_TIT_CURRENT 0x121
178 #define IDS_DLG_TIT_ERROR 0x122
180 #define IDS_DLG_ERR_SBWINSIZE 0x130
182 #define IDS_FNT_DISPLAY 0x200
183 #define IDS_FNT_PREVIEW 0x201
185 /* dialog boxes */
186 #define IDD_OPTION 0x0100
187 #define IDD_FONT 0x0200
188 #define IDD_CONFIG 0x0300
189 #define IDD_SAVE_SETTINGS 0x0400
191 /* dialog boxes controls */
192 #define IDC_OPT_CURSOR_SMALL 0x0101
193 #define IDC_OPT_CURSOR_MEDIUM 0x0102
194 #define IDC_OPT_CURSOR_LARGE 0x0103
195 #define IDC_OPT_HIST_SIZE 0x0104
196 #define IDC_OPT_HIST_SIZE_UD 0x0105
197 #define IDC_OPT_HIST_NODOUBLE 0x0106
198 #define IDC_OPT_CONF_CTRL 0x0107
199 #define IDC_OPT_CONF_SHIFT 0x0108
200 #define IDC_OPT_QUICK_EDIT 0x0109
201 #define IDC_OPT_INSERT_MODE 0x0110
203 #define IDC_FNT_LIST_FONT 0x0201
204 #define IDC_FNT_LIST_SIZE 0x0202
205 #define IDC_FNT_COLOR_BK 0x0203
206 #define IDC_FNT_COLOR_FG 0x0204
207 #define IDC_FNT_FONT_INFO 0x0205
208 #define IDC_FNT_PREVIEW 0x0206
210 #define IDC_CNF_SB_WIDTH 0x0301
211 #define IDC_CNF_SB_WIDTH_UD 0x0302
212 #define IDC_CNF_SB_HEIGHT 0x0303
213 #define IDC_CNF_SB_HEIGHT_UD 0x0304
214 #define IDC_CNF_WIN_WIDTH 0x0305
215 #define IDC_CNF_WIN_WIDTH_UD 0x0306
216 #define IDC_CNF_WIN_HEIGHT 0x0307
217 #define IDC_CNF_WIN_HEIGHT_UD 0x0308
218 #define IDC_CNF_CLOSE_EXIT 0x0309
219 #define IDC_CNF_EDITION_MODE 0x030a
221 #define IDC_SAV_SAVE 0x0401
222 #define IDC_SAV_SESSION 0x0402