GFXprim
2D bitmap graphics library with emphasis on speed and correctness
Loading...
Searching...
No Matches
gp_proxy_proto.h
Go to the documentation of this file.
1//SPDX-License-Identifier: LGPL-2.0-or-later
2/*
3
4 Copyright (c) 2019-2024 Cyril Hrubis <metan@ucw.cz>
5
6 */
7
13#ifndef GP_PROXY_PROTO_H
14#define GP_PROXY_PROTO_H
15
16#include <core/gp_pixmap.h>
17#include <core/gp_pixel.h>
18#include <input/gp_event.h>
19#include <stdint.h>
20
136
142 uint32_t type;
144 uint32_t size;
147};
148
154 size_t size;
156 char path[64];
157};
158
163 uint32_t x;
164 uint32_t y;
165 uint32_t w;
166 uint32_t h;
167};
168
177 uint32_t type;
179 uint32_t size;
182};
183
191 uint32_t type;
193 uint32_t size;
196};
197
205 uint32_t type;
207 uint32_t size;
210};
211
224
230 uint32_t type;
232 uint32_t size;
235};
236
240typedef struct gp_proxy_coord {
241 uint32_t x;
242 uint32_t y;
244
250 uint32_t type;
252 uint32_t size;
255};
256
262typedef union gp_proxy_msg {
263 struct {
264 uint32_t type;
265 uint32_t size;
266 char payload[];
267 };
268 struct gp_proxy_event ev;
269 struct gp_proxy_map map;
270 struct gp_proxy_pixmap pix;
271 struct gp_proxy_rect rect;
272 struct gp_proxy_cli_init cli_init;
273 struct gp_proxy_cursor cursor;
275
281#define GP_PROXY_BUF_SIZE 128
282
284typedef struct gp_proxy_buf {
286 size_t pos;
288 size_t size;
292
298static inline void gp_proxy_buf_init(gp_proxy_buf *buf)
299{
300 buf->pos = 0;
301 buf->size = 0;
302}
303
312
327
336
346int gp_proxy_send(int fd, enum gp_proxy_msg_types type, void *payload);
347
348#endif /* GP_PROXY_PROTO_H */
An (input) event layer.
gp_pixel_type
List of all pixel types.
A pixel description.
A pixel buffer.
gp_proxy_msg_types
A proxy message type, identifies the type of the payload.
@ GP_PROXY_SHOW
Server requests to show application is on screen.
@ GP_PROXY_HIDE
Server requests to hide application is from screen.
@ GP_PROXY_MAX
Last message type + 1.
@ GP_PROXY_MAP
A buffer map request or confirmation.
@ GP_PROXY_CURSOR_POS
Sets a cursor position.
@ GP_PROXY_UNMAP
A buffer unmap request or confirmation.
@ GP_PROXY_UPDATE
Application asks server to update a rect on screen.
@ GP_PROXY_CLI_INIT
Backend sends a basic information to the client (application).
@ GP_PROXY_NAME
Sets an application name.
@ GP_PROXY_EXIT
Requests an application exit.
@ GP_PROXY_EVENT
Backend sends a gp_event to the application.
@ GP_PROXY_PIXMAP
int gp_proxy_next(gp_proxy_buf *buf, gp_proxy_msg **msg)
Parse next message in the buffer.
#define GP_PROXY_BUF_SIZE
A proxy buffer size.
int gp_proxy_buf_recv(int fd, gp_proxy_buf *buf)
Receives data from from fd and stores them to the proxy buffer.
static void gp_proxy_buf_init(gp_proxy_buf *buf)
Initialize proxy buffer position and size.
int gp_proxy_send(int fd, enum gp_proxy_msg_types type, void *payload)
Sends a message to the server/client.
const char * gp_proxy_msg_type_name(enum gp_proxy_msg_types type)
Returns a string name for a proxy message type.
An input event.
Definition gp_event.h:153
A pixmap buffer.
Definition gp_pixmap.h:33
A proxy message buffer.
size_t size
A current buffer size.
char buf[128]
The buffer.
size_t pos
A current buffer position.
An initial infromation send to a client (application).
unsigned int dpi
A display DPI.
gp_pixel_type pixel_type
A pixel type for drawing.
An initial infromation send to a client (application).
uint32_t size
Size is set to header size + sizeof(struct gp_proxy_rect_).
uint32_t type
Event type is set to GP_PROXY_CLI_INIT.
struct gp_proxy_cli_init_ cli_init
The client init payload.
A coordinate.
A proxy cursor position.
uint32_t size
Size is set to header size + sizeof(struct gp_proxy_coord).
struct gp_proxy_coord pos
A cursor coordinates payload.
uint32_t type
Event type set to GP_PROXY_CURSOR_POS.
A proxy input event message.
gp_event ev
The input event.
uint32_t type
Event type set to GP_PROXY_EVENT.
uint32_t size
Event size set to header_size (8) + sizeof(gp_event).
A mmap() request.
struct gp_proxy_path map
A proxy map payload.
uint32_t size
Size is set to header size + sizeof(struct gp_proxy_path).
uint32_t type
Event type is set to GP_PROXY_MAP.
A SHM path and size for a mmap().
size_t size
A size for the mmap().
char path[64]
A SHM path to mmap().
A pixmap request.
uint32_t type
Event type is set to GP_PROXY_PIXMAP.
uint32_t size
Size is set to header size + sizeof(gp_pixmap).
gp_pixmap pix
A pixmap payload.
A rectangle.
A rectangle update request.
uint32_t size
Size is set to header size + sizeof(struct gp_proxy_rect_).
struct gp_proxy_rect_ rect
The rectangle payload.
uint32_t type
Event type is set to GP_PROXY_UPDATE.
A proxy message.