From b61badcc90f27cde61fa97020fd267b83fb6ac0f Mon Sep 17 00:00:00 2001 From: Hugh McMaster Date: Thu, 29 Oct 2015 23:17:18 +1100 Subject: [PATCH] server: Add console font information. Signed-off-by: Hugh McMaster Signed-off-by: Alexandre Julliard --- include/wine/server_protocol.h | 11 ++++++++--- server/console.c | 16 ++++++++++++++++ server/protocol.def | 5 +++++ server/request.h | 6 +++++- server/trace.c | 4 ++++ 5 files changed, 38 insertions(+), 4 deletions(-) diff --git a/include/wine/server_protocol.h b/include/wine/server_protocol.h index 105273dbfdb..64f02a0d1bb 100644 --- a/include/wine/server_protocol.h +++ b/include/wine/server_protocol.h @@ -1896,7 +1896,9 @@ struct set_console_output_info_request short int win_bottom; short int max_width; short int max_height; - char __pad_46[2]; + short int font_width; + short int font_height; + char __pad_50[6]; }; struct set_console_output_info_reply { @@ -1908,6 +1910,7 @@ struct set_console_output_info_reply #define SET_CONSOLE_OUTPUT_INFO_ATTR 0x08 #define SET_CONSOLE_OUTPUT_INFO_DISPLAY_WINDOW 0x10 #define SET_CONSOLE_OUTPUT_INFO_MAX_SIZE 0x20 +#define SET_CONSOLE_OUTPUT_INFO_FONT 0x40 @@ -1932,7 +1935,9 @@ struct get_console_output_info_reply short int win_bottom; short int max_width; short int max_height; - char __pad_34[6]; + short int font_width; + short int font_height; + char __pad_38[2]; }; @@ -6147,6 +6152,6 @@ union generic_reply struct terminate_job_reply terminate_job_reply; }; -#define SERVER_PROTOCOL_VERSION 488 +#define SERVER_PROTOCOL_VERSION 489 #endif /* __WINE_WINE_SERVER_PROTOCOL_H */ diff --git a/server/console.c b/server/console.c index 389547d47f8..a57b2fea56c 100644 --- a/server/console.c +++ b/server/console.c @@ -121,6 +121,12 @@ static const struct object_ops console_input_events_ops = console_input_events_destroy /* destroy */ }; +struct font_info +{ + short int width; + short int height; +}; + struct screen_buffer { struct object obj; /* object header */ @@ -139,6 +145,7 @@ struct screen_buffer unsigned short attr; /* default attribute for screen buffer */ rectangle_t win; /* current visible window on the screen buffer * * as seen in wineconsole */ + struct font_info font; /* console font information */ struct fd *fd; /* for bare console, attached output fd */ }; @@ -411,6 +418,8 @@ static struct screen_buffer *create_console_output( struct console_input *consol screen_buffer->win.top = 0; screen_buffer->win.bottom = screen_buffer->max_height - 1; screen_buffer->data = NULL; + screen_buffer->font.width = 0; + screen_buffer->font.height = 0; list_add_head( &screen_buffer_list, &screen_buffer->entry ); if (fd == -1) @@ -1019,6 +1028,11 @@ 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_FONT) + { + screen_buffer->font.width = req->font_width; + screen_buffer->font.height = req->font_height; + } return 1; } @@ -1676,6 +1690,8 @@ DECL_HANDLER(get_console_output_info) reply->win_bottom = screen_buffer->win.bottom; reply->max_width = screen_buffer->max_width; reply->max_height = screen_buffer->max_height; + reply->font_width = screen_buffer->font.width; + reply->font_height = screen_buffer->font.height; release_object( screen_buffer ); } } diff --git a/server/protocol.def b/server/protocol.def index 5b45078b55d..aa37c66a879 100644 --- a/server/protocol.def +++ b/server/protocol.def @@ -1495,6 +1495,8 @@ struct console_renderer_event short int win_bottom; short int max_width; /* maximum size (width x height) for the window */ short int max_height; + short int font_width; /* font size (width x height) */ + short int font_height; @END #define SET_CONSOLE_OUTPUT_INFO_CURSOR_GEOM 0x01 #define SET_CONSOLE_OUTPUT_INFO_CURSOR_POS 0x02 @@ -1502,6 +1504,7 @@ struct console_renderer_event #define SET_CONSOLE_OUTPUT_INFO_ATTR 0x08 #define SET_CONSOLE_OUTPUT_INFO_DISPLAY_WINDOW 0x10 #define SET_CONSOLE_OUTPUT_INFO_MAX_SIZE 0x20 +#define SET_CONSOLE_OUTPUT_INFO_FONT 0x40 /* Get info about a console (output only) */ @@ -1521,6 +1524,8 @@ struct console_renderer_event short int win_bottom; short int max_width; /* maximum size (width x height) for the window */ short int max_height; + short int font_width; /* font size (width x height) */ + short int font_height; @END /* Add input records to a console input queue */ diff --git a/server/request.h b/server/request.h index fefabaa55ec..48f4d469045 100644 --- a/server/request.h +++ b/server/request.h @@ -1112,7 +1112,9 @@ C_ASSERT( FIELD_OFFSET(struct set_console_output_info_request, win_right) == 38 C_ASSERT( FIELD_OFFSET(struct set_console_output_info_request, win_bottom) == 40 ); C_ASSERT( FIELD_OFFSET(struct set_console_output_info_request, max_width) == 42 ); C_ASSERT( FIELD_OFFSET(struct set_console_output_info_request, max_height) == 44 ); -C_ASSERT( sizeof(struct set_console_output_info_request) == 48 ); +C_ASSERT( FIELD_OFFSET(struct set_console_output_info_request, font_width) == 46 ); +C_ASSERT( FIELD_OFFSET(struct set_console_output_info_request, font_height) == 48 ); +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 ); C_ASSERT( FIELD_OFFSET(struct get_console_output_info_reply, cursor_size) == 8 ); @@ -1128,6 +1130,8 @@ C_ASSERT( FIELD_OFFSET(struct get_console_output_info_reply, win_right) == 26 ); C_ASSERT( FIELD_OFFSET(struct get_console_output_info_reply, win_bottom) == 28 ); C_ASSERT( FIELD_OFFSET(struct get_console_output_info_reply, max_width) == 30 ); C_ASSERT( FIELD_OFFSET(struct get_console_output_info_reply, max_height) == 32 ); +C_ASSERT( FIELD_OFFSET(struct get_console_output_info_reply, font_width) == 34 ); +C_ASSERT( FIELD_OFFSET(struct get_console_output_info_reply, font_height) == 36 ); C_ASSERT( sizeof(struct get_console_output_info_reply) == 40 ); C_ASSERT( FIELD_OFFSET(struct write_console_input_request, handle) == 12 ); C_ASSERT( sizeof(struct write_console_input_request) == 16 ); diff --git a/server/trace.c b/server/trace.c index 62867c2d8d2..4ec7aad3bc9 100644 --- a/server/trace.c +++ b/server/trace.c @@ -1959,6 +1959,8 @@ static void dump_set_console_output_info_request( const struct set_console_outpu fprintf( stderr, ", win_bottom=%d", req->win_bottom ); fprintf( stderr, ", max_width=%d", req->max_width ); fprintf( stderr, ", max_height=%d", req->max_height ); + fprintf( stderr, ", font_width=%d", req->font_width ); + fprintf( stderr, ", font_height=%d", req->font_height ); } static void dump_get_console_output_info_request( const struct get_console_output_info_request *req ) @@ -1981,6 +1983,8 @@ static void dump_get_console_output_info_reply( const struct get_console_output_ fprintf( stderr, ", win_bottom=%d", req->win_bottom ); fprintf( stderr, ", max_width=%d", req->max_width ); fprintf( stderr, ", max_height=%d", req->max_height ); + fprintf( stderr, ", font_width=%d", req->font_width ); + fprintf( stderr, ", font_height=%d", req->font_height ); } static void dump_write_console_input_request( const struct write_console_input_request *req )