From 629b5ab9f3f03f54fb115d169ed2bbe666f2799f Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Mon, 15 Jun 2020 15:25:17 +0200 Subject: libaxl_receive_handshake and libaxl_send_request MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- libaxl_receive_handshake.c | 34 ++++++++++++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) (limited to 'libaxl_receive_handshake.c') diff --git a/libaxl_receive_handshake.c b/libaxl_receive_handshake.c index d26a5d4..f37fe88 100644 --- a/libaxl_receive_handshake.c +++ b/libaxl_receive_handshake.c @@ -50,11 +50,13 @@ libaxl_receive_handshake(LIBAXL_CONTEXT *restrict ctx, int *restrict majorp, int { LIBAXL_CONNECTION *conn = ctx->conn; char *restrict inbuf, *new; - size_t i, n, t, len, vendor_len, out_off, in_off; + size_t i, j, k, n, t, len, vendor_len, out_off, in_off; ssize_t r; int read_stage = 0, saved_errno, status; struct response *resp; uint32_t xid_base, xid_mask; + struct libaxl_screen *screen; + struct libaxl_depth *depth; #ifdef MSG_TRUNC int flag_trunc; #endif @@ -205,7 +207,7 @@ continue_read: conn->info_buf = inbuf; conn->info.vendor = inbuf; conn->info.formats = (void *)&inbuf[t]; - conn->info.screens = (void *)&inbuf[t + conn->info.nformats * 8]; + conn->info.screens = screen = (void *)&inbuf[t + conn->info.nformats * 8]; if ((size_t)conn->info.default_screen_number < conn->info.nscreens) { conn->info.default_screen = conn->info.screens; for (i = 0; i < (size_t)conn->info.default_screen_number; i++) @@ -214,6 +216,34 @@ continue_read: conn->info.default_screen = NULL; } + for (i = 0; i < (size_t)conn->info.nscreens; i++) { + screen->root = ntohl(screen->root); + screen->default_colormap = ntohl(screen->default_colormap); + screen->white_pixel = ntohl(screen->white_pixel); + screen->black_pixel = ntohl(screen->black_pixel); + screen->current_input_masks = ntohl(screen->current_input_masks); + screen->width_in_pixels = ntohs(screen->width_in_pixels); + screen->height_in_pixels = ntohs(screen->height_in_pixels); + screen->width_in_millimeters = ntohs(screen->width_in_millimeters); + screen->height_in_millimeters = ntohs(screen->height_in_millimeters); + screen->min_installed_maps = ntohs(screen->min_installed_maps); + screen->max_installed_maps = ntohs(screen->max_installed_maps); + screen->root_visual = ntohs(screen->root_visual); + depth = screen->allowed_depths; + for (j = 0; j < (size_t)screen->number_of_allowed_depths; j++) { + depth->number_of_visuals = ntohs(depth->number_of_visuals); + for (k = 0; k < (size_t)depth->number_of_visuals; k++) { + depth->visuals[k].visual_id = ntohl(depth->visuals[k].visual_id); + depth->visuals[k].colormap_entries = ntohs(depth->visuals[k].colormap_entries); + depth->visuals[k].red_mask = ntohl(depth->visuals[k].red_mask); + depth->visuals[k].green_mask = ntohl(depth->visuals[k].green_mask); + depth->visuals[k].blue_mask = ntohl(depth->visuals[k].blue_mask); + } + depth = (void *)(uintptr_t)&depth->visuals[depth->number_of_visuals]; + } + screen = (void *)(uintptr_t)depth; + } + ctx->in_buf_size = 0; ctx->in_buf = NULL; break; -- cgit v1.2.3-70-g09d2