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
140
146 uint32_t type;
148 uint32_t size;
151};
152
158 size_t size;
160 char path[64];
161};
162
168 uint32_t x;
170 uint32_t y;
172 uint32_t w;
174 uint32_t h;
182 uint32_t cookie;
183};
184
193 uint32_t type;
195 uint32_t size;
198};
199
207 uint32_t type;
209 uint32_t size;
212};
213
221 uint32_t type;
223 uint32_t size;
226};
227
240
246 uint32_t type;
248 uint32_t size;
251};
252
256typedef struct gp_proxy_coord {
257 uint32_t x;
258 uint32_t y;
260
266 uint32_t type;
268 uint32_t size;
270 uint32_t cursor;
271};
272
278 uint32_t type;
280 uint32_t size;
283};
284
290typedef union gp_proxy_msg {
291 struct {
292 uint32_t type;
293 uint32_t size;
294 char payload[];
295 };
296 struct gp_proxy_event_msg ev;
297 struct gp_proxy_map_msg map;
298 struct gp_proxy_pixmap_msg pix;
299 struct gp_proxy_rect_msg rect;
300 struct gp_proxy_cli_init_msg cli_init;
301 struct gp_proxy_cursor_msg cursor;
302 struct gp_proxy_cursor_pos_msg cursor_pos;
304
310#define GP_PROXY_BUF_SIZE 128
311
313typedef struct gp_proxy_buf {
315 size_t pos;
317 size_t size;
321
327static inline void gp_proxy_buf_init(gp_proxy_buf *buf)
328{
329 buf->pos = 0;
330 buf->size = 0;
331}
332
341
356
365int gp_proxy_buf_recv(int fd, gp_proxy_buf *buf, int block);
366
376int gp_proxy_send(int fd, enum gp_proxy_msg_types type, void *payload);
377
378#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_CURSOR
Sets cursor image or shows/hides cursor.
@ GP_PROXY_EXIT
Requests an application exit.
@ GP_PROXY_EVENT
Backend sends a gp_event to the application.
@ GP_PROXY_PIXMAP
struct gp_proxy_buf gp_proxy_buf
A proxy message buffer.
int gp_proxy_buf_recv(int fd, gp_proxy_buf *buf, int block)
Receives data from from fd and stores them to the proxy buffer.
union gp_proxy_msg gp_proxy_msg
A proxy message.
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.
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.
struct gp_proxy_coord gp_proxy_coord
A coordinate.
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:202
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).
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.
An initial infromation send to a client (application).
unsigned int dpi
A display DPI.
gp_pixel_type pixel_type
A pixel type for drawing.
A coordinate.
A cursor change msg.
uint32_t cursor
A cursor change request.
uint32_t size
Size is set to header size + sizeof(uint32_t).
uint32_t type
Event type set to GP_PROXY_CURSOR.
A proxy cursor position.
struct gp_proxy_coord pos
A cursor coordinates payload.
uint32_t type
Event type set to GP_PROXY_CURSOR_POS.
uint32_t size
Size is set to header size + sizeof(struct gp_proxy_coord).
A proxy input event message.
uint32_t type
Event type set to GP_PROXY_EVENT.
gp_event ev
The input event.
uint32_t size
Event size set to header_size (8) + sizeof(gp_event).
A mmap() request.
uint32_t size
Size is set to header size + sizeof(struct gp_proxy_path).
struct gp_proxy_path map
A proxy map payload.
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 size
Size is set to header size + sizeof(gp_pixmap).
gp_pixmap pix
A pixmap payload.
uint32_t type
Event type is set to GP_PROXY_PIXMAP.
A rectangle update request.
uint32_t size
Size is set to header size + sizeof(struct gp_proxy_rect_).
uint32_t type
Event type is set to GP_PROXY_UPDATE.
struct gp_proxy_rect rect
The rectangle payload.
A rectangle.
uint32_t h
A height.
uint32_t cookie
An update cookie.
uint32_t x
A x offset.
uint32_t y
A y offset.
uint32_t w
A width.
A proxy message.