From 8c6ced2955728af896fc359d985067a926a4cdab Mon Sep 17 00:00:00 2001 From: Hugh McMaster Date: Tue, 21 May 2013 12:13:48 +1000 Subject: server: protocol.def console.c --- server/console.c | 90 ++++++++++++++++++++++++++++----------------------- server/protocol.def | 36 +++++++++++++-------- 2 files changed, 72 insertions(+), 54 deletions(-) diff --git a/server/console.c b/server/console.c index 3f90937..a94594b 100644 --- a/server/console.c +++ b/server/console.c @@ -104,42 +104,46 @@ struct console_input_events static const struct object_ops console_input_events_ops = { sizeof(struct console_input_events), /* size */ - console_input_events_dump, /* dump */ - no_get_type, /* get_type */ - add_queue, /* add_queue */ - remove_queue, /* remove_queue */ - console_input_events_signaled, /* signaled */ - no_satisfied, /* satisfied */ - no_signal, /* signal */ - no_get_fd, /* get_fd */ - default_fd_map_access, /* map_access */ - default_get_sd, /* get_sd */ - default_set_sd, /* set_sd */ - no_lookup_name, /* lookup_name */ - no_open_file, /* open_file */ - no_close_handle, /* close_handle */ - console_input_events_destroy /* destroy */ + console_input_events_dump, /* dump */ + no_get_type, /* get_type */ + add_queue, /* add_queue */ + remove_queue, /* remove_queue */ + console_input_events_signaled, /* signaled */ + no_satisfied, /* satisfied */ + no_signal, /* signal */ + no_get_fd, /* get_fd */ + default_fd_map_access, /* map_access */ + default_get_sd, /* get_sd */ + default_set_sd, /* set_sd */ + no_lookup_name, /* lookup_name */ + no_open_file, /* open_file */ + no_close_handle, /* close_handle */ + console_input_events_destroy /* destroy */ }; struct screen_buffer { - struct object obj; /* object header */ - struct list entry; /* entry in list of all screen buffers */ - struct console_input *input; /* associated console input */ - int mode; /* output mode */ - int cursor_size; /* size of cursor (percentage filled) */ - int cursor_visible;/* cursor visibility flag */ - int cursor_x; /* position of cursor */ - int cursor_y; /* position of cursor */ - int width; /* size (w-h) of the screen buffer */ + struct object obj; /* object header */ + struct list entry; /* entry in list of all screen buffers */ + struct console_input *input; /* associated console input */ + int mode; /* output mode */ + int cursor_size; /* size of cursor (percentage filled) */ + int cursor_visible; /* cursor visibility flag */ + int cursor_x; /* position of cursor */ + int cursor_y; /* position of cursor */ + int width; /* size (w-h) of the screen buffer */ int height; - int max_width; /* size (w-h) of the window given font size */ + 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 */ - rectangle_t win; /* current visible window on the screen buffer * - * as seen in wineconsole */ - struct fd *fd; /* for bare console, attached output fd */ + unsigned short attr; /* default attribute for screen buffer */ + rectangle_t win; /* current visible window on the screen buffer * + * as seen in wineconsole */ + short int font_width; /* size (w-h) of active console font in pixels */ + short int font_height; + char_info_t *data; /* the data for each cell - a width x height matrix */ + + + struct fd *fd; /* for bare console, attached output fd */ }; static void screen_buffer_dump( struct object *obj, int verbose ); @@ -377,7 +381,8 @@ static void generate_sb_initial_events( struct console_input *console_input ) console_input_events_append( console_input, &evt ); } -static struct screen_buffer *create_console_output( struct console_input *console_input, int fd ) +static struct screen_buffer *create_console_output( struct console_input *console_input, int fd, + const struct create_console_output_request *req ) { struct screen_buffer *screen_buffer; int i; @@ -391,17 +396,20 @@ static struct screen_buffer *create_console_output( struct console_input *consol screen_buffer->input = console_input; screen_buffer->cursor_size = 100; screen_buffer->cursor_visible = 1; - screen_buffer->width = 80; - screen_buffer->height = 150; - screen_buffer->max_width = 80; - screen_buffer->max_height = 25; screen_buffer->cursor_x = 0; screen_buffer->cursor_y = 0; + screen_buffer->width = req->width; + screen_buffer->height = req->height; + screen_buffer->max_width = req->max_width; + screen_buffer->max_height = req->max_height; screen_buffer->attr = 0x0F; screen_buffer->win.left = 0; - screen_buffer->win.right = screen_buffer->max_width - 1; screen_buffer->win.top = 0; - screen_buffer->win.bottom = screen_buffer->max_height - 1; + screen_buffer->win.right = screen_buffer->width - 1; + screen_buffer->win.bottom = screen_buffer->height - 1; + screen_buffer->font_width = req->font_width; + screen_buffer->font_height = req->font_height; + if (fd == -1) screen_buffer->fd = NULL; else @@ -1615,7 +1623,7 @@ DECL_HANDLER(create_console_output) return; } - screen_buffer = create_console_output( console, fd ); + screen_buffer = create_console_output( console, fd, req ); if (screen_buffer) { /* FIXME: should store sharing and test it when opening the CONOUT$ device @@ -1653,13 +1661,15 @@ DECL_HANDLER(get_console_output_info) reply->cursor_y = screen_buffer->cursor_y; reply->width = screen_buffer->width; reply->height = screen_buffer->height; + reply->max_width = screen_buffer->max_width; + reply->max_height = screen_buffer->max_height; reply->attr = screen_buffer->attr; reply->win_left = screen_buffer->win.left; reply->win_top = screen_buffer->win.top; reply->win_right = screen_buffer->win.right; 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 234c41e..6e70dfd 100644 --- a/server/protocol.def +++ b/server/protocol.def @@ -1357,6 +1357,12 @@ struct console_renderer_event unsigned int attributes; /* object attributes */ unsigned int share; /* sharing credentials */ int fd; /* for bare consoles, fd the screen-buffer is attached to */ + short int width; /* screen buffer width */ + short int height; /* screen buffer height */ + short int max_width; /* maximum console width */ + short int max_height; /* maximum console height */ + short int font_width; /* console font width */ + short int font_height; /* console font height */ @REPLY obj_handle_t handle_out; /* handle to the screen buffer */ @END @@ -1372,13 +1378,13 @@ 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 max_width; /* maximum size (width x height) for the window */ + short int max_height; short int attr; /* default attribute */ 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 */ short int win_bottom; - short int max_width; /* maximum size (width x height) for the window */ - short int max_height; @END #define SET_CONSOLE_OUTPUT_INFO_CURSOR_GEOM 0x01 #define SET_CONSOLE_OUTPUT_INFO_CURSOR_POS 0x02 @@ -1390,21 +1396,23 @@ struct console_renderer_event /* Get info about a console (output only) */ @REQ(get_console_output_info) - obj_handle_t handle; /* handle to the console */ + obj_handle_t handle; /* handle to the console */ @REPLY - short int cursor_size; /* size of cursor (percentage filled) */ - short int cursor_visible;/* cursor visibility flag */ - short int cursor_x; /* position of cursor (x, y) */ + short int cursor_size; /* size of cursor (percentage filled) */ + short int cursor_visible; /* cursor visibility flag */ + short int cursor_x; /* position of cursor (x, y) */ 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 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 */ - short int win_bottom; - short int max_width; /* maximum size (width x height) for the window */ + short int width; /* width of the screen buffer */ + short int height; /* height of the screen buffer */ + short int max_width; /* maximum size (width x height) for the window */ short int max_height; + short int attr; /* default attribute */ + 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 */ + short int win_bottom; + short int font_width; /* width of active console font */ + short int font_height; /* height of active console font */ @END /* Add input records to a console input queue */ -- 1.7.10.4