vnc: Add cut-text events
parent
67676b224e
commit
86283fd8d1
|
@ -17,6 +17,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
#include <unistd.h>
|
||||||
#include <pixman.h>
|
#include <pixman.h>
|
||||||
#include <wayland-client.h>
|
#include <wayland-client.h>
|
||||||
#include <rfb/rfbclient.h>
|
#include <rfb/rfbclient.h>
|
||||||
|
@ -26,6 +27,7 @@ struct vnc_client {
|
||||||
|
|
||||||
int (*alloc_fb)(struct vnc_client*);
|
int (*alloc_fb)(struct vnc_client*);
|
||||||
void (*update_fb)(struct vnc_client*);
|
void (*update_fb)(struct vnc_client*);
|
||||||
|
void (*cut_text)(struct vnc_client*, const char*, size_t);
|
||||||
|
|
||||||
void* userdata;
|
void* userdata;
|
||||||
struct pixman_region16 damage;
|
struct pixman_region16 damage;
|
||||||
|
@ -54,3 +56,5 @@ void vnc_client_send_keyboard_event(struct vnc_client* self, uint32_t symbol,
|
||||||
void vnc_client_set_encodings(struct vnc_client* self, const char* encodings);
|
void vnc_client_set_encodings(struct vnc_client* self, const char* encodings);
|
||||||
void vnc_client_set_quality_level(struct vnc_client* self, int value);
|
void vnc_client_set_quality_level(struct vnc_client* self, int value);
|
||||||
void vnc_client_set_compression_level(struct vnc_client* self, int value);
|
void vnc_client_set_compression_level(struct vnc_client* self, int value);
|
||||||
|
void vnc_client_send_cut_text(struct vnc_client* self, const char* text,
|
||||||
|
size_t len);
|
||||||
|
|
17
src/vnc.c
17
src/vnc.c
|
@ -56,6 +56,15 @@ static void vnc_client_finish_update(rfbClient* client)
|
||||||
pixman_region_clear(&self->damage);
|
pixman_region_clear(&self->damage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void vnc_client_got_cut_text(rfbClient* client, const char* text,
|
||||||
|
int len)
|
||||||
|
{
|
||||||
|
struct vnc_client* self = rfbClientGetClientData(client, NULL);
|
||||||
|
assert(self);
|
||||||
|
|
||||||
|
self->cut_text(self, text, len);
|
||||||
|
}
|
||||||
|
|
||||||
struct vnc_client* vnc_client_create(void)
|
struct vnc_client* vnc_client_create(void)
|
||||||
{
|
{
|
||||||
struct vnc_client* self = calloc(1, sizeof(*self));
|
struct vnc_client* self = calloc(1, sizeof(*self));
|
||||||
|
@ -80,6 +89,7 @@ struct vnc_client* vnc_client_create(void)
|
||||||
client->MallocFrameBuffer = vnc_client_alloc_fb;
|
client->MallocFrameBuffer = vnc_client_alloc_fb;
|
||||||
client->GotFrameBufferUpdate = vnc_client_update_box;
|
client->GotFrameBufferUpdate = vnc_client_update_box;
|
||||||
client->FinishedFrameBufferUpdate = vnc_client_finish_update;
|
client->FinishedFrameBufferUpdate = vnc_client_finish_update;
|
||||||
|
client->GotXCutText = vnc_client_got_cut_text;
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
|
|
||||||
|
@ -240,3 +250,10 @@ void vnc_client_set_compression_level(struct vnc_client* self, int value)
|
||||||
{
|
{
|
||||||
self->client->appData.compressLevel = value;
|
self->client->appData.compressLevel = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void vnc_client_send_cut_text(struct vnc_client* self, const char* text,
|
||||||
|
size_t len)
|
||||||
|
{
|
||||||
|
// libvncclient doesn't modify text, so typecast is OK.
|
||||||
|
SendClientCutText(self->client, (char*)text, len);
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue