2020-07-12 11:17:03 +00:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2020 Andri Yngvason
|
|
|
|
*
|
|
|
|
* Permission to use, copy, modify, and/or distribute this software for any
|
|
|
|
* purpose with or without fee is hereby granted, provided that the above
|
|
|
|
* copyright notice and this permission notice appear in all copies.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
|
|
* REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
|
|
* AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
|
|
* INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
|
|
* LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
|
|
|
|
* OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
|
|
* PERFORMANCE OF THIS SOFTWARE.
|
|
|
|
*/
|
|
|
|
|
2020-07-11 17:54:35 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <stdbool.h>
|
2020-12-06 19:52:02 +00:00
|
|
|
#include <unistd.h>
|
2020-07-11 17:54:35 +00:00
|
|
|
#include <pixman.h>
|
|
|
|
#include <wayland-client.h>
|
|
|
|
#include <rfb/rfbclient.h>
|
|
|
|
|
|
|
|
struct vnc_client {
|
|
|
|
rfbClient* client;
|
|
|
|
|
|
|
|
int (*alloc_fb)(struct vnc_client*);
|
|
|
|
void (*update_fb)(struct vnc_client*);
|
2020-12-06 19:52:02 +00:00
|
|
|
void (*cut_text)(struct vnc_client*, const char*, size_t);
|
2020-07-11 17:54:35 +00:00
|
|
|
|
|
|
|
void* userdata;
|
|
|
|
struct pixman_region16 damage;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct vnc_client* vnc_client_create(void);
|
|
|
|
void vnc_client_destroy(struct vnc_client* self);
|
|
|
|
|
|
|
|
int vnc_client_connect(struct vnc_client* self, const char* address, int port);
|
|
|
|
|
|
|
|
int vnc_client_set_pixel_format(struct vnc_client* self,
|
|
|
|
enum wl_shm_format format);
|
|
|
|
|
|
|
|
int vnc_client_get_fd(const struct vnc_client* self);
|
|
|
|
int vnc_client_get_width(const struct vnc_client* self);
|
|
|
|
int vnc_client_get_height(const struct vnc_client* self);
|
|
|
|
int vnc_client_get_stride(const struct vnc_client* self);
|
|
|
|
void* vnc_client_get_fb(const struct vnc_client* self);
|
|
|
|
void vnc_client_set_fb(struct vnc_client* self, void* fb);
|
|
|
|
const char* vnc_client_get_desktop_name(const struct vnc_client* self);
|
|
|
|
int vnc_client_process(struct vnc_client* self);
|
|
|
|
void vnc_client_send_pointer_event(struct vnc_client* self, int x, int y,
|
|
|
|
uint32_t button_mask);
|
|
|
|
void vnc_client_send_keyboard_event(struct vnc_client* self, uint32_t symbol,
|
2020-11-30 21:59:55 +00:00
|
|
|
uint32_t code, bool is_pressed);
|
2020-07-11 22:24:11 +00:00
|
|
|
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_compression_level(struct vnc_client* self, int value);
|
2020-12-06 19:52:02 +00:00
|
|
|
void vnc_client_send_cut_text(struct vnc_client* self, const char* text,
|
|
|
|
size_t len);
|