Add even more events

tight-png
Andri Yngvason 2019-08-12 23:39:37 +00:00 committed by Andri Yngvason
parent e42b8ffa92
commit 11f44c7223
2 changed files with 21 additions and 1 deletions

View File

@ -106,6 +106,13 @@ struct rfb_client_pointer_event_msg {
uint16_t y; uint16_t y;
} RFB_PACKED; } RFB_PACKED;
struct rfb_client_cut_text_msg {
uint8_t type;
uint8_t padding[3];
uint32_t length;
char test[0];
} RFB_PACKED;
static inline int rfb_send_security_types(void *client) static inline int rfb_send_security_types(void *client)
{ {
struct rfb_security_types_msg payload = { struct rfb_security_types_msg payload = {

View File

@ -517,6 +517,19 @@ static int on_client_pointer_event(struct vnc_client *client)
return sizeof(*msg); return sizeof(*msg);
} }
static int on_client_cut_text(struct vnc_client *client)
{
struct rfb_client_cut_text_msg *msg =
(struct rfb_client_cut_text_msg*)(client->msg_buffer +
client->buffer_index);
uint32_t length = ntohl(msg->length);
// TODO
return sizeof(*msg) + length;
}
static int on_client_message(struct vnc_client *client) static int on_client_message(struct vnc_client *client)
{ {
if (client->buffer_len - client->buffer_index < 1) if (client->buffer_len - client->buffer_index < 1)
@ -537,7 +550,7 @@ static int on_client_message(struct vnc_client *client)
case RFB_CLIENT_TO_SERVER_POINTER_EVENT: case RFB_CLIENT_TO_SERVER_POINTER_EVENT:
return on_client_pointer_event(client); return on_client_pointer_event(client);
case RFB_CLIENT_TO_SERVER_CLIENT_CUT_TEXT: case RFB_CLIENT_TO_SERVER_CLIENT_CUT_TEXT:
break; return on_client_cut_text(client);
} }
uv_close((uv_handle_t*)&client->stream_handle, cleanup_client); uv_close((uv_handle_t*)&client->stream_handle, cleanup_client);