conhost: Use better default values in create_screen_buffer.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2020-10-06 18:54:03 +02:00 committed by Alexandre Julliard
parent f377ac1f2d
commit 0c25f5ee46
2 changed files with 37 additions and 5 deletions

View File

@ -3950,6 +3950,8 @@ static void test_AllocConsole(void)
static void test_pseudo_console_child(HANDLE input, HANDLE output) static void test_pseudo_console_child(HANDLE input, HANDLE output)
{ {
CONSOLE_SCREEN_BUFFER_INFO sb_info;
CONSOLE_CURSOR_INFO cursor_info;
DWORD mode; DWORD mode;
BOOL ret; BOOL ret;
@ -3985,6 +3987,25 @@ static void test_pseudo_console_child(HANDLE input, HANDLE output)
ret = SetConsoleMode(output, mode | ENABLE_WRAP_AT_EOL_OUTPUT); ret = SetConsoleMode(output, mode | ENABLE_WRAP_AT_EOL_OUTPUT);
ok(ret, "SetConsoleMode failed: %u\n", GetLastError()); ok(ret, "SetConsoleMode failed: %u\n", GetLastError());
ret = GetConsoleScreenBufferInfo(output, &sb_info);
ok(ret, "GetConsoleScreenBufferInfo failed: %u\n", GetLastError());
ok(sb_info.dwSize.X == 40, "dwSize.X = %u\n", sb_info.dwSize.X);
ok(sb_info.dwSize.Y == 30, "dwSize.Y = %u\n", sb_info.dwSize.Y);
ok(sb_info.dwCursorPosition.X == 0, "dwCursorPosition.X = %u\n", sb_info.dwCursorPosition.X);
ok(sb_info.dwCursorPosition.Y == 0, "dwCursorPosition.Y = %u\n", sb_info.dwCursorPosition.Y);
ok(sb_info.wAttributes == 7, "wAttributes = %x\n", sb_info.wAttributes);
ok(sb_info.srWindow.Left == 0, "srWindow.Left = %u\n", sb_info.srWindow.Left);
ok(sb_info.srWindow.Top == 0, "srWindow.Top = %u\n", sb_info.srWindow.Top);
ok(sb_info.srWindow.Right == 39, "srWindow.Right = %u\n", sb_info.srWindow.Right);
ok(sb_info.srWindow.Bottom == 29, "srWindow.Bottom = %u\n", sb_info.srWindow.Bottom);
ok(sb_info.dwMaximumWindowSize.X == 40, "dwMaximumWindowSize.X = %u\n", sb_info.dwMaximumWindowSize.X);
ok(sb_info.dwMaximumWindowSize.Y == 30, "dwMaximumWindowSize.Y = %u\n", sb_info.dwMaximumWindowSize.Y);
ret = GetConsoleCursorInfo(output, &cursor_info);
ok(ret, "GetConsoleCursorInfo failed: %u\n", GetLastError());
ok(cursor_info.dwSize == 25, "dwSize = %u\n", cursor_info.dwSize);
ok(cursor_info.bVisible == TRUE, "bVisible = %x\n", cursor_info.bVisible);
test_console_title(); test_console_title();
test_WriteConsoleInputW(input); test_WriteConsoleInputW(input);
} }

View File

@ -184,19 +184,30 @@ static struct screen_buffer *create_screen_buffer( struct console *console, int
screen_buffer->console = console; screen_buffer->console = console;
screen_buffer->id = id; screen_buffer->id = id;
screen_buffer->mode = ENABLE_PROCESSED_OUTPUT | ENABLE_WRAP_AT_EOL_OUTPUT; screen_buffer->mode = ENABLE_PROCESSED_OUTPUT | ENABLE_WRAP_AT_EOL_OUTPUT;
screen_buffer->cursor_size = 100; screen_buffer->cursor_size = 25;
screen_buffer->cursor_visible = 1; screen_buffer->cursor_visible = 1;
screen_buffer->width = width; screen_buffer->width = width;
screen_buffer->height = height; screen_buffer->height = height;
screen_buffer->attr = 0x07; screen_buffer->attr = 0x07;
screen_buffer->popup_attr = 0xf5; screen_buffer->popup_attr = 0xf5;
screen_buffer->max_width = 80;
screen_buffer->max_height = 25;
screen_buffer->win.right = min( screen_buffer->max_width - 1, width - 1 );
screen_buffer->win.bottom = min( screen_buffer->max_height - 1, height - 1);
screen_buffer->font.weight = FW_NORMAL; screen_buffer->font.weight = FW_NORMAL;
screen_buffer->font.pitch_family = FIXED_PITCH | FF_DONTCARE; screen_buffer->font.pitch_family = FIXED_PITCH | FF_DONTCARE;
if (console->active)
{
screen_buffer->max_width = console->active->max_width;
screen_buffer->max_height = console->active->max_height;
screen_buffer->win.right = console->active->win.right - console->active->win.left;
screen_buffer->win.bottom = console->active->win.bottom - console->active->win.top;
}
else
{
screen_buffer->max_width = width;
screen_buffer->max_height = height;
screen_buffer->win.right = width - 1;
screen_buffer->win.bottom = height - 1;
}
if (wine_rb_put( &screen_buffer_map, LongToPtr(id), &screen_buffer->entry )) if (wine_rb_put( &screen_buffer_map, LongToPtr(id), &screen_buffer->entry ))
{ {
free( screen_buffer ); free( screen_buffer );