]> git.proxmox.com Git - spiceterm.git/blame - spiceterm.h
white space cleanups
[spiceterm.git] / spiceterm.h
CommitLineData
e3759a34
DM
1#include <glib.h>
2#include <spice.h>
22e5ba02
DM
3
4#define IBUFSIZE 1024
5#define MAX_ESC_PARAMS 16
6
e3759a34 7typedef struct TextAttributes {
44a22215
DM
8 unsigned int fgcol:4;
9 unsigned int bgcol:4;
10 unsigned int bold:1;
11 unsigned int uline:1;
12 unsigned int blink:1;
13 unsigned int invers:1;
14 unsigned int unvisible:1;
e3759a34 15} TextAttributes;
22e5ba02
DM
16
17typedef struct TextCell {
44a22215
DM
18 gunichar2 ch;
19 TextAttributes attrib;
22e5ba02
DM
20} TextCell;
21
e3759a34
DM
22#define COMMANDS_SIZE 1024
23#define MAX_HEIGHT 2048
24#define MAX_WIDTH 2048
25
64bc7a2f 26typedef struct SpiceScreen SpiceScreen;
e3759a34 27
64bc7a2f 28struct SpiceScreen {
e3759a34
DM
29 SpiceCoreInterface *core;
30 SpiceServer *server;
31
32 QXLInstance qxl_instance;
33 QXLWorker *qxl_worker;
34
e3759a34
DM
35 uint8_t primary_surface[MAX_HEIGHT * MAX_WIDTH * 4];
36 int primary_height;
37 int primary_width;
38
39 SpiceTimer *conn_timeout_timer;
40 SpiceWatch *mwatch; /* watch master pty */
41
42 int cursor_notify;
43
44 // Current mode (set by create_primary)
45 int width;
46 int height;
47
e3759a34
DM
48 GCond* command_cond;
49 GMutex* command_mutex;
50
51 int commands_end;
52 int commands_start;
53 struct QXLCommandExt* commands[COMMANDS_SIZE];
54
55 // callbacks
64bc7a2f
DM
56 void (*on_client_connected)(SpiceScreen *spice_screen);
57 void (*on_client_disconnected)(SpiceScreen *spice_screen);
e3759a34
DM
58};
59
11ba14dc 60SpiceScreen* spice_screen_new(SpiceCoreInterface* core, guint timeout);
e3759a34 61
b052e9c7 62void spice_screen_draw_char(SpiceScreen *spice_screen, int x, int y, gunichar2 ch, TextAttributes attrib);
64bc7a2f
DM
63void spice_screen_scroll(SpiceScreen *spice_screen, int x1, int y1, int x2, int y2, int src_x, int src_y);
64void spice_screen_clear(SpiceScreen *spice_screen, int x1, int y1, int x2, int y2);
64bc7a2f
DM
65uint32_t spice_screen_get_width(void);
66uint32_t spice_screen_get_height(void);
e3759a34 67
d6a5f5a9 68typedef struct spiceTerm {
44a22215
DM
69 int maxx;
70 int maxy;
22e5ba02 71
44a22215
DM
72 int width;
73 int height;
22e5ba02 74
44a22215
DM
75 int total_height;
76 int scroll_height;
77 int y_base;
78 int y_displ;
79 int altbuf:1;
80
81 unsigned int utf8:1; // utf8 mode
82 long utf_char; // used by utf8 parser
83 int utf_count; // used by utf8 parser
84
85 TextAttributes default_attrib;
86
87 TextCell *cells;
88 TextCell *altcells;
89
90 SpiceScreen *screen;
91 SpiceKbdInstance keyboard_sin;
92 SpiceCharDeviceInstance vdagent_sin;
93
94 // cursor
95 TextAttributes cur_attrib;
96 TextAttributes cur_attrib_saved;
97 int tty_state; // 0 - normal, 1 - ESC, 2 - CSI
98 int cx; // cursor x position
99 int cy; // cursor y position
100 int cx_saved; // saved cursor x position
101 int cy_saved; // saved cursor y position
102 int esc_buf[MAX_ESC_PARAMS];
103 int esc_count;
104 int esc_ques;
105 int esc_has_par;
106 char osc_textbuf[4096];
107 char osc_cmd;
108 int region_top;
109 int region_bottom;
110
111 unsigned int charset:1; // G0 or G1
112 unsigned int charset_saved:1; // G0 or G1
113 unsigned int g0enc:2;
114 unsigned int g0enc_saved:2;
115 unsigned int g1enc:2;
116 unsigned int g1enc_saved:2;
117 unsigned int cur_enc:2;
118 unsigned int cur_enc_saved:2;
119
120 // input buffer
121 char ibuf[IBUFSIZE];
122 int ibuf_count;
123
124 gunichar2 *selection;
125 int selection_len;
126
127 unsigned int mark_active:1;
128
129 unsigned int report_mouse:1;
130
131} spiceTerm;