server: Get and set the console color table.
Signed-off-by: Hugh McMaster <hugh.mcmaster@outlook.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
adb43b9192
commit
2d7c73d802
|
@ -1947,6 +1947,7 @@ struct set_console_output_info_request
|
|||
short int max_height;
|
||||
short int font_width;
|
||||
short int font_height;
|
||||
/* VARARG(colors,uints); */
|
||||
char __pad_50[6];
|
||||
};
|
||||
struct set_console_output_info_reply
|
||||
|
@ -1960,6 +1961,7 @@ struct set_console_output_info_reply
|
|||
#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
|
||||
|
||||
|
||||
|
||||
|
@ -1986,6 +1988,7 @@ struct get_console_output_info_reply
|
|||
short int max_height;
|
||||
short int font_width;
|
||||
short int font_height;
|
||||
/* VARARG(colors,uints); */
|
||||
char __pad_38[2];
|
||||
};
|
||||
|
||||
|
@ -6245,6 +6248,6 @@ union generic_reply
|
|||
struct terminate_job_reply terminate_job_reply;
|
||||
};
|
||||
|
||||
#define SERVER_PROTOCOL_VERSION 507
|
||||
#define SERVER_PROTOCOL_VERSION 508
|
||||
|
||||
#endif /* __WINE_WINE_SERVER_PROTOCOL_H */
|
||||
|
|
|
@ -211,6 +211,27 @@ static BOOL WINECON_SetEditionMode(HANDLE hConIn, int edition_mode)
|
|||
return ret;
|
||||
}
|
||||
|
||||
/******************************************************************
|
||||
* WINECON_SetColors
|
||||
*
|
||||
*
|
||||
*/
|
||||
static void WINECON_SetColors(struct inner_data *data, const struct config_data* cfg)
|
||||
{
|
||||
size_t color_map_size = sizeof(data->curcfg.color_map);
|
||||
|
||||
memcpy(data->curcfg.color_map, cfg->color_map, color_map_size);
|
||||
|
||||
SERVER_START_REQ( set_console_output_info )
|
||||
{
|
||||
req->handle = wine_server_obj_handle( data->hConOut );
|
||||
req->mask = SET_CONSOLE_OUTPUT_INFO_COLORTABLE;
|
||||
wine_server_add_data( req, cfg->color_map, color_map_size );
|
||||
wine_server_call( req );
|
||||
}
|
||||
SERVER_END_REQ;
|
||||
}
|
||||
|
||||
/******************************************************************
|
||||
* WINECON_GrabChanges
|
||||
*
|
||||
|
@ -449,6 +470,7 @@ void WINECON_SetConfig(struct inner_data* data, const struct config_data* cf
|
|||
FillConsoleOutputAttribute(data->hConOut, cfg->def_attr, screen_size, top_left, &written);
|
||||
SetConsoleTextAttribute(data->hConOut, cfg->def_attr);
|
||||
}
|
||||
WINECON_SetColors(data, cfg);
|
||||
/* now let's look at the window / sb size changes...
|
||||
* since the server checks that sb is always bigger than window,
|
||||
* we have to take care of doing the operations in the right order
|
||||
|
@ -703,7 +725,6 @@ static struct inner_data* WINECON_Init(HINSTANCE hInst, DWORD pid, LPCWSTR appna
|
|||
/* fall through */
|
||||
case init_success:
|
||||
WINECON_GetServerConfig(data);
|
||||
memcpy(data->curcfg.color_map, cfg.color_map, sizeof(data->curcfg.color_map));
|
||||
data->cells = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
|
||||
data->curcfg.sb_width * data->curcfg.sb_height * sizeof(CHAR_INFO));
|
||||
if (!data->cells) WINECON_Fatal("OOM\n");
|
||||
|
|
|
@ -147,6 +147,7 @@ struct screen_buffer
|
|||
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 int color_map[16]; /* color table */
|
||||
rectangle_t win; /* current visible window on the screen buffer *
|
||||
* as seen in wineconsole */
|
||||
struct font_info font; /* console font information */
|
||||
|
@ -426,6 +427,7 @@ 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;
|
||||
memset( screen_buffer->color_map, 0, sizeof(screen_buffer->color_map) );
|
||||
list_add_head( &screen_buffer_list, &screen_buffer->entry );
|
||||
|
||||
if (fd == -1)
|
||||
|
@ -1032,6 +1034,11 @@ static int set_console_output_info( struct screen_buffer *screen_buffer,
|
|||
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() ));
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
@ -1690,6 +1697,8 @@ DECL_HANDLER(get_console_output_info)
|
|||
reply->max_height = screen_buffer->max_height;
|
||||
reply->font_width = screen_buffer->font.width;
|
||||
reply->font_height = screen_buffer->font.height;
|
||||
set_reply_data( screen_buffer->color_map,
|
||||
min( sizeof(screen_buffer->color_map), get_reply_max_size() ));
|
||||
release_object( screen_buffer );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1537,6 +1537,7 @@ 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 */
|
||||
@END
|
||||
#define SET_CONSOLE_OUTPUT_INFO_CURSOR_GEOM 0x01
|
||||
#define SET_CONSOLE_OUTPUT_INFO_CURSOR_POS 0x02
|
||||
|
@ -1545,6 +1546,7 @@ struct console_renderer_event
|
|||
#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
|
||||
|
||||
|
||||
/* Get info about a console (output only) */
|
||||
|
@ -1566,6 +1568,7 @@ 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 */
|
||||
@END
|
||||
|
||||
/* Add input records to a console input queue */
|
||||
|
|
|
@ -58,9 +58,9 @@ static inline void remove_data( data_size_t size )
|
|||
cur_size -= size;
|
||||
}
|
||||
|
||||
static void dump_uints( const int *ptr, int len )
|
||||
static void dump_uints( const char *prefix, const unsigned int *ptr, int len )
|
||||
{
|
||||
fputc( '{', stderr );
|
||||
fprintf( stderr, "%s{", prefix );
|
||||
while (len > 0)
|
||||
{
|
||||
fprintf( stderr, "%08x", *ptr++ );
|
||||
|
@ -407,6 +407,14 @@ static void dump_varargs_ints( const char *prefix, data_size_t size )
|
|||
remove_data( size );
|
||||
}
|
||||
|
||||
static void dump_varargs_uints( const char *prefix, data_size_t size )
|
||||
{
|
||||
const unsigned int *data = cur_data;
|
||||
|
||||
dump_uints( prefix, data, size / sizeof(*data) );
|
||||
remove_data( size );
|
||||
}
|
||||
|
||||
static void dump_varargs_uints64( const char *prefix, data_size_t size )
|
||||
{
|
||||
const unsigned __int64 *data = cur_data;
|
||||
|
@ -574,10 +582,8 @@ static void dump_varargs_context( const char *prefix, data_size_t size )
|
|||
}
|
||||
}
|
||||
if (ctx.flags & SERVER_CTX_EXTENDED_REGISTERS)
|
||||
{
|
||||
fprintf( stderr, ",extended=" );
|
||||
dump_uints( (const int *)ctx.ext.i386_regs, sizeof(ctx.ext.i386_regs) / sizeof(int) );
|
||||
}
|
||||
dump_uints( ",extended=", (const unsigned int *)ctx.ext.i386_regs,
|
||||
sizeof(ctx.ext.i386_regs) / sizeof(int) );
|
||||
break;
|
||||
case CPU_x86_64:
|
||||
if (ctx.flags & SERVER_CTX_CONTROL)
|
||||
|
@ -2035,6 +2041,7 @@ 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 );
|
||||
}
|
||||
|
||||
static void dump_get_console_output_info_request( const struct get_console_output_info_request *req )
|
||||
|
@ -2059,6 +2066,7 @@ static void dump_get_console_output_info_reply( const struct get_console_output_
|
|||
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 );
|
||||
}
|
||||
|
||||
static void dump_write_console_input_request( const struct write_console_input_request *req )
|
||||
|
|
Loading…
Reference in New Issue