From 6ca93646be4538564e25f4aa03456c6da8c2115a Mon Sep 17 00:00:00 2001 From: Gijs Vermeulen Date: Wed, 20 Nov 2019 11:45:28 +0100 Subject: [PATCH] server: Add support for additional fields in set_console_output_info. Signed-off-by: Gijs Vermeulen Signed-off-by: Alexandre Julliard --- include/wine/server_protocol.h | 8 ++++--- programs/wineconsole/wineconsole.c | 3 +++ server/console.c | 35 +++++++++++++++++++++++++----- server/protocol.def | 5 ++++- server/request.h | 2 ++ server/trace.c | 5 ++++- tools/make_requests | 8 ++++++- 7 files changed, 55 insertions(+), 11 deletions(-) diff --git a/include/wine/server_protocol.h b/include/wine/server_protocol.h index d8f98164225..3213f433d9c 100644 --- a/include/wine/server_protocol.h +++ b/include/wine/server_protocol.h @@ -2074,8 +2074,10 @@ struct set_console_output_info_request short int max_height; short int font_width; short int font_height; - /* VARARG(colors,uints); */ - char __pad_52[4]; + short int font_weight; + short int font_pitch_family; + /* VARARG(colors,uints,64); */ + /* VARARG(face_name,unicode_str); */ }; struct set_console_output_info_reply { @@ -6691,6 +6693,6 @@ union generic_reply struct resume_process_reply resume_process_reply; }; -#define SERVER_PROTOCOL_VERSION 589 +#define SERVER_PROTOCOL_VERSION 590 #endif /* __WINE_WINE_SERVER_PROTOCOL_H */ diff --git a/programs/wineconsole/wineconsole.c b/programs/wineconsole/wineconsole.c index 439099c37a6..ebcfce1011c 100644 --- a/programs/wineconsole/wineconsole.c +++ b/programs/wineconsole/wineconsole.c @@ -458,6 +458,9 @@ void WINECON_SetConfig(struct inner_data* data, const struct config_data* cf req->max_height = (r.bottom - r.top - GetSystemMetrics(SM_CYCAPTION)) / cfg->cell_height; req->font_width = cfg->cell_width; req->font_height = cfg->cell_height; + req->font_weight = cfg->font_weight; + req->font_pitch_family = FIXED_PITCH | FF_DONTCARE; + wine_server_add_data( req, cfg->face_name, lstrlenW(cfg->face_name) * sizeof(WCHAR) ); wine_server_call( req ); } SERVER_END_REQ; diff --git a/server/console.c b/server/console.c index 7d1fc5d2680..97d247c98e1 100644 --- a/server/console.c +++ b/server/console.c @@ -131,6 +131,10 @@ struct font_info { short int width; short int height; + short int weight; + short int pitch_family; + WCHAR *face_name; + data_size_t face_len; }; struct screen_buffer @@ -433,6 +437,10 @@ static struct screen_buffer *create_console_output( struct console_input *consol screen_buffer->data = NULL; screen_buffer->font.width = 0; screen_buffer->font.height = 0; + screen_buffer->font.weight = FW_NORMAL; + screen_buffer->font.pitch_family = FIXED_PITCH | FF_DONTCARE; + screen_buffer->font.face_name = NULL; + screen_buffer->font.face_len = 0; memset( screen_buffer->color_map, 0, sizeof(screen_buffer->color_map) ); list_add_head( &screen_buffer_list, &screen_buffer->entry ); @@ -896,6 +904,8 @@ static int set_console_output_info( struct screen_buffer *screen_buffer, const struct set_console_output_info_request *req ) { struct console_renderer_event evt; + data_size_t font_name_len, offset; + WCHAR *font_name; memset(&evt.u, 0, sizeof(evt.u)); if (req->mask & SET_CONSOLE_OUTPUT_INFO_CURSOR_GEOM) @@ -1039,15 +1049,29 @@ static int set_console_output_info( struct screen_buffer *screen_buffer, screen_buffer->max_width = req->max_width; screen_buffer->max_height = req->max_height; } + if (req->mask & SET_CONSOLE_OUTPUT_INFO_COLORTABLE) + { + memcpy( screen_buffer->color_map, get_req_data(), min( get_req_data_size(), sizeof(screen_buffer->color_map) )); + } if (req->mask & SET_CONSOLE_OUTPUT_INFO_FONT) { screen_buffer->font.width = req->font_width; screen_buffer->font.height = req->font_height; - } - if (req->mask & SET_CONSOLE_OUTPUT_INFO_COLORTABLE) - { - memcpy( screen_buffer->color_map, get_req_data(), - min( sizeof(screen_buffer->color_map), get_req_data_size() )); + screen_buffer->font.weight = req->font_weight; + screen_buffer->font.pitch_family = req->font_pitch_family; + offset = req->mask & SET_CONSOLE_OUTPUT_INFO_COLORTABLE ? sizeof(screen_buffer->color_map) : 0; + if (get_req_data_size() > offset) + { + font_name_len = (get_req_data_size() - offset) / sizeof(WCHAR) * sizeof(WCHAR); + font_name = mem_alloc( font_name_len ); + if (font_name) + { + memcpy( font_name, (char *)get_req_data() + offset, font_name_len ); + free( screen_buffer->font.face_name ); + screen_buffer->font.face_name = font_name; + screen_buffer->font.face_len = font_name_len; + } + } } return 1; @@ -1183,6 +1207,7 @@ static void screen_buffer_destroy( struct object *obj ) } if (screen_buffer->fd) release_object( screen_buffer->fd ); free( screen_buffer->data ); + free( screen_buffer->font.face_name ); } static struct fd *screen_buffer_get_fd( struct object *obj ) diff --git a/server/protocol.def b/server/protocol.def index 3a0df20bdba..1b4085ecbf0 100644 --- a/server/protocol.def +++ b/server/protocol.def @@ -1633,7 +1633,10 @@ struct console_renderer_event short int max_height; short int font_width; /* font size (width x height) */ short int font_height; - VARARG(colors,uints); /* color table */ + short int font_weight; /* font weight */ + short int font_pitch_family; /* font pitch & family */ + VARARG(colors,uints,64); /* color table */ + VARARG(face_name,unicode_str); /* font face name */ @END #define SET_CONSOLE_OUTPUT_INFO_CURSOR_GEOM 0x0001 #define SET_CONSOLE_OUTPUT_INFO_CURSOR_POS 0x0002 diff --git a/server/request.h b/server/request.h index 1303b35ef79..e7846b55b3e 100644 --- a/server/request.h +++ b/server/request.h @@ -1204,6 +1204,8 @@ C_ASSERT( FIELD_OFFSET(struct set_console_output_info_request, max_width) == 44 C_ASSERT( FIELD_OFFSET(struct set_console_output_info_request, max_height) == 46 ); C_ASSERT( FIELD_OFFSET(struct set_console_output_info_request, font_width) == 48 ); C_ASSERT( FIELD_OFFSET(struct set_console_output_info_request, font_height) == 50 ); +C_ASSERT( FIELD_OFFSET(struct set_console_output_info_request, font_weight) == 52 ); +C_ASSERT( FIELD_OFFSET(struct set_console_output_info_request, font_pitch_family) == 54 ); C_ASSERT( sizeof(struct set_console_output_info_request) == 56 ); C_ASSERT( FIELD_OFFSET(struct get_console_output_info_request, handle) == 12 ); C_ASSERT( sizeof(struct get_console_output_info_request) == 16 ); diff --git a/server/trace.c b/server/trace.c index 55d5e68962f..94def435373 100644 --- a/server/trace.c +++ b/server/trace.c @@ -2133,7 +2133,10 @@ static void dump_set_console_output_info_request( const struct set_console_outpu fprintf( stderr, ", max_height=%d", req->max_height ); fprintf( stderr, ", font_width=%d", req->font_width ); fprintf( stderr, ", font_height=%d", req->font_height ); - dump_varargs_uints( ", colors=", cur_size ); + fprintf( stderr, ", font_weight=%d", req->font_weight ); + fprintf( stderr, ", font_pitch_family=%d", req->font_pitch_family ); + dump_varargs_uints( ", colors=", min(cur_size,64) ); + dump_varargs_unicode_str( ", face_name=", cur_size ); } static void dump_get_console_output_info_request( const struct get_console_output_info_request *req ) diff --git a/tools/make_requests b/tools/make_requests index faeabe5852d..4e39bb65a9a 100755 --- a/tools/make_requests +++ b/tools/make_requests @@ -216,7 +216,13 @@ sub PARSE_REQUESTS() next; } - if (/^\s*VARARG\((\w+),(\w+),(\w+)\)/) + if (/^\s*VARARG\((\w+),(\w+),(\d+)\)/) + { + $var = $1; + $type = "dump_varargs_$2( \"%s\", min(cur_size,$3) )"; + s!(VARARG\(.*\)\s*;)!/* $1 */!; + } + elsif (/^\s*VARARG\((\w+),(\w+),(\w+)\)/) { $var = $1; $type = "dump_varargs_" . $2 . "( \"%s\", min(cur_size,req->" . $3 . ") )";