Gijs Vermeulen : server: Add support for additional fields in set_console_output_info.
Alexandre Julliard
julliard at winehq.org
Mon Nov 25 16:41:56 CST 2019
Module: wine
Branch: master
Commit: 6ca93646be4538564e25f4aa03456c6da8c2115a
URL: https://source.winehq.org/git/wine.git/?a=commit;h=6ca93646be4538564e25f4aa03456c6da8c2115a
Author: Gijs Vermeulen <gijsvrm at codeweavers.com>
Date: Wed Nov 20 11:45:28 2019 +0100
server: Add support for additional fields in set_console_output_info.
Signed-off-by: Gijs Vermeulen <gijsvrm at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
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 d8f9816422..3213f433d9 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 439099c37a..ebcfce1011 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 7d1fc5d268..97d247c98e 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 3a0df20bdb..1b4085ecbf 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 1303b35ef7..e7846b55b3 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 55d5e68962..94def43537 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 faeabe5852..4e39bb65a9 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 . ") )";
More information about the wine-cvs
mailing list