1 #ifndef __SPICETERM_H__
2 #define __SPICETERM_H__
8 #define MAX_ESC_PARAMS 16
10 typedef struct TextAttributes
{
16 unsigned int invers
:1;
17 unsigned int unvisible
:1;
20 typedef struct TextCell
{
22 TextAttributes attrib
;
25 #define COMMANDS_SIZE 1024
26 #define MAX_HEIGHT 2048
27 #define MAX_WIDTH 2048
29 typedef struct SpiceScreen SpiceScreen
;
32 SpiceCoreInterface
*core
;
35 QXLInstance qxl_instance
;
36 QXLWorker
*qxl_worker
;
38 uint8_t primary_surface
[MAX_HEIGHT
* MAX_WIDTH
* 4];
42 SpiceTimer
*conn_timeout_timer
;
43 SpiceWatch
*mwatch
; /* watch master pty */
47 // Current mode (set by create_primary)
52 GMutex
* command_mutex
;
56 struct QXLCommandExt
* commands
[COMMANDS_SIZE
];
59 void (*on_client_connected
)(SpiceScreen
*spice_screen
);
60 void (*on_client_disconnected
)(SpiceScreen
*spice_screen
);
63 SpiceScreen
* spice_screen_new(SpiceCoreInterface
* core
, guint timeout
);
65 void spice_screen_draw_char(SpiceScreen
*spice_screen
, int x
, int y
, gunichar2 ch
, TextAttributes attrib
);
66 void spice_screen_scroll(SpiceScreen
*spice_screen
, int x1
, int y1
, int x2
, int y2
, int src_x
, int src_y
);
67 void spice_screen_clear(SpiceScreen
*spice_screen
, int x1
, int y1
, int x2
, int y2
);
70 uint32_t spice_screen_get_width(void);
71 uint32_t spice_screen_get_height(void);
73 typedef struct spiceTerm
{
86 unsigned int utf8
:1; // utf8 mode
87 long utf_char
; // used by utf8 parser
88 int utf_count
; // used by utf8 parser
90 TextAttributes default_attrib
;
96 SpiceKbdInstance keyboard_sin
;
97 SpiceCharDeviceInstance vdagent_sin
;
100 TextAttributes cur_attrib
;
101 TextAttributes cur_attrib_saved
;
102 int tty_state
; // 0 - normal, 1 - ESC, 2 - CSI
103 int cx
; // cursor x position
104 int cy
; // cursor y position
105 int cx_saved
; // saved cursor x position
106 int cy_saved
; // saved cursor y position
107 int esc_buf
[MAX_ESC_PARAMS
];
111 char osc_textbuf
[4096];
116 unsigned int charset
:1; // G0 or G1
117 unsigned int charset_saved
:1; // G0 or G1
118 unsigned int g0enc
:2;
119 unsigned int g0enc_saved
:2;
120 unsigned int g1enc
:2;
121 unsigned int g1enc_saved
:2;
122 unsigned int cur_enc
:2;
123 unsigned int cur_enc_saved
:2;
129 gunichar2
*selection
;
132 unsigned int mark_active
:1;
134 unsigned int report_mouse
:1;
138 #endif /* __SPICETERM_H__ */