add large cursor support, posix shm

This commit is contained in:
Jay Sorg
2022-07-14 01:46:38 -07:00
parent 544ead05e7
commit c250529e8e
14 changed files with 282 additions and 68 deletions
+60
View File
@@ -1247,6 +1247,63 @@ process_server_paint_rect_shmem_ex(struct mod *amod, struct stream *s)
return rv;
}
/******************************************************************************/
/* return error */
static int
process_server_set_pointer_shmfd(struct mod *amod, struct stream *s)
{
int rv;
int x;
int y;
int bpp;
int Bpp;
int width;
int height;
int fd;
int recv_bytes;
int shmembytes;
unsigned int num_fds;
void *shmemptr;
char *cur_data;
char *cur_mask;
char msg[4];
rv = 0;
in_sint16_le(s, x);
in_sint16_le(s, y);
in_uint16_le(s, bpp);
in_uint16_le(s, width);
in_uint16_le(s, height);
fd = -1;
num_fds = -1;
if (g_tcp_can_recv(amod->trans->sck, 5000) == 0)
{
return 1;
}
recv_bytes = g_sck_recv_fd_set(amod->trans->sck, msg, 4, &fd, 1, &num_fds);
LOG_DEVEL(LOG_LEVEL_DEBUG, "process_server_set_pointer_shmfd: "
"g_sck_recv_fd_set rv %d fd %d", recv_bytes, fd);
if (recv_bytes == 4)
{
if (num_fds == 1)
{
Bpp = (bpp == 0) ? 3 : (bpp + 7) / 8;
shmembytes = width * height * Bpp + width * height / 8;
if (g_file_map(fd, 1, 1, shmembytes, &shmemptr) == 0)
{
cur_data = (char *)shmemptr;
cur_mask = cur_data + width * height * Bpp;
rv = amod->server_set_pointer_large(amod, x, y,
cur_data, cur_mask,
bpp, width, height);
g_munmap(shmemptr, shmembytes);
}
g_file_close(fd);
}
}
return rv;
}
/******************************************************************************/
/* return error */
static int
@@ -1472,6 +1529,9 @@ lib_mod_process_orders(struct mod *mod, int type, struct stream *s)
case 61: /* server_paint_rect_shmem_ex */
rv = process_server_paint_rect_shmem_ex(mod, s);
break;
case 63: /* server_set_pointer_shmfd */
rv = process_server_set_pointer_shmfd(mod, s);
break;
default:
LOG_DEVEL(LOG_LEVEL_WARNING,
"lib_mod_process_orders: unknown order type %d", type);
+6 -2
View File
@@ -155,8 +155,12 @@ struct mod
int num_crects, short *crects,
char *data, int width, int height,
int flags, int frame_id);
tintptr server_dumby[100 - 45]; /* align, 100 minus the number of server
int (*server_session_info)(struct mod *v, const char *data,
int data_bytes);
int (*server_set_pointer_large)(struct mod *v, int x, int y,
char *data, char *mask, int bpp,
int width, int height);
tintptr server_dumby[100 - 47]; /* align, 100 minus the number of server
functions above */
/* common */
tintptr handle; /* pointer to self as long */