5 #define MAX_ESC_PARAMS 16
7 typedef struct TextAttributes
{
13 unsigned int invers
:1;
14 unsigned int unvisible
:1;
15 unsigned int selected
:1;
18 typedef struct TextCell
{
20 TextAttributes attrib
;
23 #define COMMANDS_SIZE (1024)
24 #define MAX_HEIGHT 1440
25 #define MAX_WIDTH 2560
27 typedef struct SpiceTermOptions
{
35 typedef struct SpiceScreen SpiceScreen
;
37 typedef struct CachedImage
{
43 SpiceCoreInterface
*core
;
46 QXLInstance qxl_instance
;
47 QXLWorker
*qxl_worker
;
49 uint8_t primary_surface
[MAX_HEIGHT
* MAX_WIDTH
* 4];
53 SpiceTimer
*conn_timeout_timer
;
54 SpiceWatch
*mwatch
; /* watch master pty */
56 // Current mode (set by create_primary)
65 struct QXLCommandExt
* commands
[COMMANDS_SIZE
];
67 //cache for glyphs bitmaps
68 GHashTable
*image_cache
;
73 void (*on_client_connected
)(SpiceScreen
*spice_screen
);
74 void (*on_client_disconnected
)(SpiceScreen
*spice_screen
);
77 SpiceScreen
* spice_screen_new(SpiceCoreInterface
* core
, uint32_t width
, uint32_t height
, SpiceTermOptions
*opts
);
79 void spice_screen_resize(SpiceScreen
*spice_screen
, uint32_t width
, uint32_t height
);
80 void spice_screen_draw_char(SpiceScreen
*spice_screen
, int x
, int y
, gunichar2 ch
, TextAttributes attrib
);
81 void spice_screen_scroll(SpiceScreen
*spice_screen
, int x1
, int y1
, int x2
, int y2
, int src_x
, int src_y
);
82 void spice_screen_clear(SpiceScreen
*spice_screen
, int x1
, int y1
, int x2
, int y2
);
83 uint32_t spice_screen_get_width(void);
84 uint32_t spice_screen_get_height(void);
86 typedef struct spiceTerm
{
87 int pty
; // pty file descriptor
98 unsigned int utf8
:1; // utf8 mode
99 gunichar utf_char
; // used by utf8 parser
100 int utf_count
; // used by utf8 parser
102 TextAttributes default_attrib
;
108 SpiceKbdInstance keyboard_sin
;
109 SpiceCharDeviceInstance vdagent_sin
;
112 TextAttributes cur_attrib
;
113 TextAttributes cur_attrib_saved
;
114 unsigned int tty_state
; // 0 - normal, 1 - ESC, 2 - CSI
115 int cx
; // cursor x position
116 int cy
; // cursor y position
117 int cx_saved
; // saved cursor x position
118 int cy_saved
; // saved cursor y position
119 unsigned int esc_buf
[MAX_ESC_PARAMS
];
120 unsigned int esc_count
;
121 unsigned int esc_ques
;
122 unsigned int esc_has_par
;
123 char osc_textbuf
[4096];
125 unsigned int region_top
;
126 unsigned int region_bottom
;
128 unsigned int charset
:1; // G0 or G1
129 unsigned int charset_saved
:1; // G0 or G1
130 unsigned int g0enc
:2;
131 unsigned int g0enc_saved
:2;
132 unsigned int g1enc
:2;
133 unsigned int g1enc_saved
:2;
134 unsigned int cur_enc
:2;
135 unsigned int cur_enc_saved
:2;
141 gunichar2
*selection
;
144 unsigned int mark_active
:1;
146 unsigned int report_mouse
:1;
150 void init_spiceterm(spiceTerm
*vt
, uint32_t width
, uint32_t height
);
151 void spiceterm_refresh(spiceTerm
*vt
);
153 void spiceterm_resize(spiceTerm
*vt
, uint32_t width
, uint32_t height
);
154 void spiceterm_virtual_scroll(spiceTerm
*vt
, int lines
);
155 void spiceterm_clear_selection(spiceTerm
*vt
);
156 void spiceterm_motion_event(spiceTerm
*vt
, uint32_t x
, uint32_t y
,
159 void spiceterm_respond_esc(spiceTerm
*vt
, const char *esc
);
160 void spiceterm_respond_data(spiceTerm
*vt
, int len
, uint8_t *data
);
161 void spiceterm_update_watch_mask(spiceTerm
*vt
, gboolean writable
);
163 spiceTerm
*spiceterm_create(uint32_t width
, uint32_t height
, SpiceTermOptions
*opts
);
165 gboolean
vdagent_owns_clipboard(spiceTerm
*vt
);
166 void vdagent_request_clipboard(spiceTerm
*vt
);
167 void vdagent_grab_clipboard(spiceTerm
*vt
);
169 int pve_auth_verify(const char *clientip
, const char *username
, const char *passwd
);
170 void pve_auth_set_path(char *path
);
171 void pve_auth_set_permissions(char *perm
);