server: Add support for additional fields in set_console_output_info.

Signed-off-by: Gijs Vermeulen <gijsvrm@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Gijs Vermeulen 2019-11-20 11:45:28 +01:00 committed by Alexandre Julliard
parent 8b2d5c7c5a
commit 6ca93646be
7 changed files with 55 additions and 11 deletions

View File

@ -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 */

View File

@ -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;

View File

@ -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 )

View File

@ -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

View File

@ -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 );

View File

@ -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 )

View File

@ -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 . ") )";