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
{
36 typedef struct SpiceScreen SpiceScreen
;
38 typedef struct CachedImage
{
44 SpiceCoreInterface
*core
;
47 QXLInstance qxl_instance
;
48 QXLWorker
*qxl_worker
;
50 uint8_t primary_surface
[MAX_HEIGHT
* MAX_WIDTH
* 4];
54 SpiceTimer
*conn_timeout_timer
;
55 SpiceWatch
*mwatch
; /* watch master pty */
57 // Current mode (set by create_primary)
62 GMutex
* command_mutex
;
66 struct QXLCommandExt
* commands
[COMMANDS_SIZE
];
68 //cache for glyphs bitmaps
69 GHashTable
*image_cache
;
74 void (*on_client_connected
)(SpiceScreen
*spice_screen
);
75 void (*on_client_disconnected
)(SpiceScreen
*spice_screen
);
78 SpiceScreen
* spice_screen_new(SpiceCoreInterface
* core
, uint32_t width
, uint32_t height
, SpiceTermOptions
*opts
);
80 void spice_screen_resize(SpiceScreen
*spice_screen
, uint32_t width
, uint32_t height
);
81 void spice_screen_draw_char(SpiceScreen
*spice_screen
, int x
, int y
, gunichar2 ch
, TextAttributes attrib
);
82 void spice_screen_scroll(SpiceScreen
*spice_screen
, int x1
, int y1
, int x2
, int y2
, int src_x
, int src_y
);
83 void spice_screen_clear(SpiceScreen
*spice_screen
, int x1
, int y1
, int x2
, int y2
);
84 uint32_t spice_screen_get_width(void);
85 uint32_t spice_screen_get_height(void);
87 typedef struct spiceTerm
{
88 int pty
; // pty file descriptor
99 unsigned int utf8
:1; // utf8 mode
100 gunichar utf_char
; // used by utf8 parser
101 int utf_count
; // used by utf8 parser
103 TextAttributes default_attrib
;
109 SpiceKbdInstance keyboard_sin
;
110 SpiceCharDeviceInstance vdagent_sin
;
113 TextAttributes cur_attrib
;
114 TextAttributes cur_attrib_saved
;
115 int tty_state
; // 0 - normal, 1 - ESC, 2 - CSI
116 int cx
; // cursor x position
117 int cy
; // cursor y position
118 int cx_saved
; // saved cursor x position
119 int cy_saved
; // saved cursor y position
120 int esc_buf
[MAX_ESC_PARAMS
];
124 char osc_textbuf
[4096];
129 unsigned int charset
:1; // G0 or G1
130 unsigned int charset_saved
:1; // G0 or G1
131 unsigned int g0enc
:2;
132 unsigned int g0enc_saved
:2;
133 unsigned int g1enc
:2;
134 unsigned int g1enc_saved
:2;
135 unsigned int cur_enc
:2;
136 unsigned int cur_enc_saved
:2;
142 gunichar2
*selection
;
145 unsigned int mark_active
:1;
147 unsigned int report_mouse
:1;
151 void init_spiceterm(spiceTerm
*vt
, uint32_t width
, uint32_t height
);
152 void spiceterm_refresh(spiceTerm
*vt
);
154 void spiceterm_resize(spiceTerm
*vt
, uint32_t width
, uint32_t height
);
155 void spiceterm_virtual_scroll(spiceTerm
*vt
, int lines
);
156 void spiceterm_clear_selection(spiceTerm
*vt
);
157 void spiceterm_motion_event(spiceTerm
*vt
, uint32_t x
, uint32_t y
,
160 void spiceterm_respond_esc(spiceTerm
*vt
, const char *esc
);
161 void spiceterm_respond_data(spiceTerm
*vt
, int len
, uint8_t *data
);
162 void spiceterm_update_watch_mask(spiceTerm
*vt
, gboolean writable
);
164 spiceTerm
*spiceterm_create(uint32_t width
, uint32_t height
, SpiceTermOptions
*opts
);
166 gboolean
vdagent_owns_clipboard(spiceTerm
*vt
);
167 void vdagent_request_clipboard(spiceTerm
*vt
);
168 void vdagent_grab_clipboard(spiceTerm
*vt
);
170 int pve_auth_verify(const char *clientip
, const char *username
, const char *passwd
);
171 void pve_auth_set_path(char *path
);
172 void pve_auth_set_permissions(char *perm
);