From f592f931b2fe0eead1e136f7a087babc7efe23ef Mon Sep 17 00:00:00 2001 From: Hugh McMaster Date: Wed, 10 Aug 2016 10:01:57 +0000 Subject: [PATCH] server: Get and set the console pop-up color attributes. Signed-off-by: Hugh McMaster Signed-off-by: Alexandre Julliard --- include/wine/server_protocol.h | 24 +++++++++++---------- programs/wineconsole/wineconsole.c | 3 ++- server/console.c | 9 +++++++- server/protocol.def | 23 +++++++++++--------- server/request.h | 34 ++++++++++++++++-------------- server/trace.c | 2 ++ 6 files changed, 56 insertions(+), 39 deletions(-) diff --git a/include/wine/server_protocol.h b/include/wine/server_protocol.h index 5a6e277101e..8f5b7aa7f1e 100644 --- a/include/wine/server_protocol.h +++ b/include/wine/server_protocol.h @@ -1939,6 +1939,7 @@ struct set_console_output_info_request short int width; short int height; short int attr; + short int popup_attr; short int win_left; short int win_top; short int win_right; @@ -1948,20 +1949,21 @@ struct set_console_output_info_request short int font_width; short int font_height; /* VARARG(colors,uints); */ - char __pad_50[6]; + char __pad_52[4]; }; struct set_console_output_info_reply { struct reply_header __header; }; -#define SET_CONSOLE_OUTPUT_INFO_CURSOR_GEOM 0x01 -#define SET_CONSOLE_OUTPUT_INFO_CURSOR_POS 0x02 -#define SET_CONSOLE_OUTPUT_INFO_SIZE 0x04 -#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 -#define SET_CONSOLE_OUTPUT_INFO_COLORTABLE 0x80 +#define SET_CONSOLE_OUTPUT_INFO_CURSOR_GEOM 0x0001 +#define SET_CONSOLE_OUTPUT_INFO_CURSOR_POS 0x0002 +#define SET_CONSOLE_OUTPUT_INFO_SIZE 0x0004 +#define SET_CONSOLE_OUTPUT_INFO_ATTR 0x0008 +#define SET_CONSOLE_OUTPUT_INFO_DISPLAY_WINDOW 0x0010 +#define SET_CONSOLE_OUTPUT_INFO_MAX_SIZE 0x0020 +#define SET_CONSOLE_OUTPUT_INFO_FONT 0x0040 +#define SET_CONSOLE_OUTPUT_INFO_COLORTABLE 0x0080 +#define SET_CONSOLE_OUTPUT_INFO_POPUP_ATTR 0x0100 @@ -1980,6 +1982,7 @@ struct get_console_output_info_reply short int width; short int height; short int attr; + short int popup_attr; short int win_left; short int win_top; short int win_right; @@ -1989,7 +1992,6 @@ struct get_console_output_info_reply short int font_width; short int font_height; /* VARARG(colors,uints); */ - char __pad_38[2]; }; @@ -6248,6 +6250,6 @@ union generic_reply struct terminate_job_reply terminate_job_reply; }; -#define SERVER_PROTOCOL_VERSION 508 +#define SERVER_PROTOCOL_VERSION 509 #endif /* __WINE_WINE_SERVER_PROTOCOL_H */ diff --git a/programs/wineconsole/wineconsole.c b/programs/wineconsole/wineconsole.c index babc3effdc2..d6efa2f8762 100644 --- a/programs/wineconsole/wineconsole.c +++ b/programs/wineconsole/wineconsole.c @@ -226,7 +226,8 @@ static void WINECON_SetColors(struct inner_data *data, const struct config_data* SERVER_START_REQ( set_console_output_info ) { req->handle = wine_server_obj_handle( data->hConOut ); - req->mask = SET_CONSOLE_OUTPUT_INFO_COLORTABLE; + req->mask = SET_CONSOLE_OUTPUT_INFO_COLORTABLE | SET_CONSOLE_OUTPUT_INFO_POPUP_ATTR; + req->popup_attr = cfg->popup_attr; wine_server_add_data( req, cfg->color_map, color_map_size ); wine_server_call( req ); } diff --git a/server/console.c b/server/console.c index ab764dcf284..32d3137ab6c 100644 --- a/server/console.c +++ b/server/console.c @@ -146,7 +146,8 @@ struct screen_buffer int max_width; /* size (w-h) of the window given font size */ int max_height; char_info_t *data; /* the data for each cell - a width x height matrix */ - unsigned short attr; /* default attribute for screen buffer */ + unsigned short attr; /* default fill attributes (screen colors) */ + unsigned short popup_attr; /* pop-up color attributes */ unsigned int color_map[16]; /* color table */ rectangle_t win; /* current visible window on the screen buffer * * as seen in wineconsole */ @@ -420,6 +421,7 @@ static struct screen_buffer *create_console_output( struct console_input *consol screen_buffer->cursor_x = 0; screen_buffer->cursor_y = 0; screen_buffer->attr = 0x0F; + screen_buffer->popup_attr = 0xF5; screen_buffer->win.left = 0; screen_buffer->win.right = screen_buffer->max_width - 1; screen_buffer->win.top = 0; @@ -999,6 +1001,10 @@ static int set_console_output_info( struct screen_buffer *screen_buffer, { screen_buffer->attr = req->attr; } + if (req->mask & SET_CONSOLE_OUTPUT_INFO_POPUP_ATTR) + { + screen_buffer->popup_attr = req->popup_attr; + } if (req->mask & SET_CONSOLE_OUTPUT_INFO_DISPLAY_WINDOW) { if (req->win_left < 0 || req->win_left > req->win_right || @@ -1689,6 +1695,7 @@ DECL_HANDLER(get_console_output_info) reply->width = screen_buffer->width; reply->height = screen_buffer->height; reply->attr = screen_buffer->attr; + reply->popup_attr = screen_buffer->popup_attr; reply->win_left = screen_buffer->win.left; reply->win_top = screen_buffer->win.top; reply->win_right = screen_buffer->win.right; diff --git a/server/protocol.def b/server/protocol.def index c11b6791514..8f285488229 100644 --- a/server/protocol.def +++ b/server/protocol.def @@ -1528,7 +1528,8 @@ struct console_renderer_event short int cursor_y; short int width; /* width of the screen buffer */ short int height; /* height of the screen buffer */ - short int attr; /* default attribute */ + short int attr; /* default fill attributes (screen colors) */ + short int popup_attr; /* pop-up color attributes */ short int win_left; /* window actually displayed by renderer */ short int win_top; /* the rect area is expressed within the */ short int win_right; /* boundaries of the screen buffer */ @@ -1539,14 +1540,15 @@ struct console_renderer_event short int font_height; VARARG(colors,uints); /* color table */ @END -#define SET_CONSOLE_OUTPUT_INFO_CURSOR_GEOM 0x01 -#define SET_CONSOLE_OUTPUT_INFO_CURSOR_POS 0x02 -#define SET_CONSOLE_OUTPUT_INFO_SIZE 0x04 -#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 -#define SET_CONSOLE_OUTPUT_INFO_COLORTABLE 0x80 +#define SET_CONSOLE_OUTPUT_INFO_CURSOR_GEOM 0x0001 +#define SET_CONSOLE_OUTPUT_INFO_CURSOR_POS 0x0002 +#define SET_CONSOLE_OUTPUT_INFO_SIZE 0x0004 +#define SET_CONSOLE_OUTPUT_INFO_ATTR 0x0008 +#define SET_CONSOLE_OUTPUT_INFO_DISPLAY_WINDOW 0x0010 +#define SET_CONSOLE_OUTPUT_INFO_MAX_SIZE 0x0020 +#define SET_CONSOLE_OUTPUT_INFO_FONT 0x0040 +#define SET_CONSOLE_OUTPUT_INFO_COLORTABLE 0x0080 +#define SET_CONSOLE_OUTPUT_INFO_POPUP_ATTR 0x0100 /* Get info about a console (output only) */ @@ -1559,7 +1561,8 @@ struct console_renderer_event short int cursor_y; short int width; /* width of the screen buffer */ short int height; /* height of the screen buffer */ - short int attr; /* default attribute */ + short int attr; /* default fill attributes (screen colors) */ + short int popup_attr; /* pop-up color attributes */ short int win_left; /* window actually displayed by renderer */ short int win_top; /* the rect area is expressed within the */ short int win_right; /* boundaries of the screen buffer */ diff --git a/server/request.h b/server/request.h index 4efc057e25f..d55b7e7ee13 100644 --- a/server/request.h +++ b/server/request.h @@ -1126,14 +1126,15 @@ C_ASSERT( FIELD_OFFSET(struct set_console_output_info_request, cursor_y) == 26 ) C_ASSERT( FIELD_OFFSET(struct set_console_output_info_request, width) == 28 ); C_ASSERT( FIELD_OFFSET(struct set_console_output_info_request, height) == 30 ); C_ASSERT( FIELD_OFFSET(struct set_console_output_info_request, attr) == 32 ); -C_ASSERT( FIELD_OFFSET(struct set_console_output_info_request, win_left) == 34 ); -C_ASSERT( FIELD_OFFSET(struct set_console_output_info_request, win_top) == 36 ); -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( 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( FIELD_OFFSET(struct set_console_output_info_request, popup_attr) == 34 ); +C_ASSERT( FIELD_OFFSET(struct set_console_output_info_request, win_left) == 36 ); +C_ASSERT( FIELD_OFFSET(struct set_console_output_info_request, win_top) == 38 ); +C_ASSERT( FIELD_OFFSET(struct set_console_output_info_request, win_right) == 40 ); +C_ASSERT( FIELD_OFFSET(struct set_console_output_info_request, win_bottom) == 42 ); +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( 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 ); @@ -1144,14 +1145,15 @@ C_ASSERT( FIELD_OFFSET(struct get_console_output_info_reply, cursor_y) == 14 ); C_ASSERT( FIELD_OFFSET(struct get_console_output_info_reply, width) == 16 ); C_ASSERT( FIELD_OFFSET(struct get_console_output_info_reply, height) == 18 ); C_ASSERT( FIELD_OFFSET(struct get_console_output_info_reply, attr) == 20 ); -C_ASSERT( FIELD_OFFSET(struct get_console_output_info_reply, win_left) == 22 ); -C_ASSERT( FIELD_OFFSET(struct get_console_output_info_reply, win_top) == 24 ); -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( FIELD_OFFSET(struct get_console_output_info_reply, popup_attr) == 22 ); +C_ASSERT( FIELD_OFFSET(struct get_console_output_info_reply, win_left) == 24 ); +C_ASSERT( FIELD_OFFSET(struct get_console_output_info_reply, win_top) == 26 ); +C_ASSERT( FIELD_OFFSET(struct get_console_output_info_reply, win_right) == 28 ); +C_ASSERT( FIELD_OFFSET(struct get_console_output_info_reply, win_bottom) == 30 ); +C_ASSERT( FIELD_OFFSET(struct get_console_output_info_reply, max_width) == 32 ); +C_ASSERT( FIELD_OFFSET(struct get_console_output_info_reply, max_height) == 34 ); +C_ASSERT( FIELD_OFFSET(struct get_console_output_info_reply, font_width) == 36 ); +C_ASSERT( FIELD_OFFSET(struct get_console_output_info_reply, font_height) == 38 ); 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 d17564f7694..4d8a2eb8185 100644 --- a/server/trace.c +++ b/server/trace.c @@ -2033,6 +2033,7 @@ static void dump_set_console_output_info_request( const struct set_console_outpu fprintf( stderr, ", width=%d", req->width ); fprintf( stderr, ", height=%d", req->height ); fprintf( stderr, ", attr=%d", req->attr ); + fprintf( stderr, ", popup_attr=%d", req->popup_attr ); fprintf( stderr, ", win_left=%d", req->win_left ); fprintf( stderr, ", win_top=%d", req->win_top ); fprintf( stderr, ", win_right=%d", req->win_right ); @@ -2058,6 +2059,7 @@ static void dump_get_console_output_info_reply( const struct get_console_output_ fprintf( stderr, ", width=%d", req->width ); fprintf( stderr, ", height=%d", req->height ); fprintf( stderr, ", attr=%d", req->attr ); + fprintf( stderr, ", popup_attr=%d", req->popup_attr ); fprintf( stderr, ", win_left=%d", req->win_left ); fprintf( stderr, ", win_top=%d", req->win_top ); fprintf( stderr, ", win_right=%d", req->win_right );