Jacek Caban : conhost: Use better default values in create_screen_buffer.
Alexandre Julliard
julliard at winehq.org
Wed Oct 7 16:04:09 CDT 2020
Module: wine
Branch: master
Commit: 0c25f5ee466b181e9caa6b15257be1db8a66b602
URL: https://source.winehq.org/git/wine.git/?a=commit;h=0c25f5ee466b181e9caa6b15257be1db8a66b602
Author: Jacek Caban <jacek at codeweavers.com>
Date: Tue Oct 6 18:54:03 2020 +0200
conhost: Use better default values in create_screen_buffer.
Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/kernel32/tests/console.c | 21 +++++++++++++++++++++
programs/conhost/conhost.c | 21 ++++++++++++++++-----
2 files changed, 37 insertions(+), 5 deletions(-)
diff --git a/dlls/kernel32/tests/console.c b/dlls/kernel32/tests/console.c
index 97dc9c61ce..deb5030553 100644
--- a/dlls/kernel32/tests/console.c
+++ b/dlls/kernel32/tests/console.c
@@ -3950,6 +3950,8 @@ static void test_AllocConsole(void)
static void test_pseudo_console_child(HANDLE input, HANDLE output)
{
+ CONSOLE_SCREEN_BUFFER_INFO sb_info;
+ CONSOLE_CURSOR_INFO cursor_info;
DWORD mode;
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);
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_WriteConsoleInputW(input);
}
diff --git a/programs/conhost/conhost.c b/programs/conhost/conhost.c
index 8f09ebbb3f..b91c81a5e5 100644
--- a/programs/conhost/conhost.c
+++ b/programs/conhost/conhost.c
@@ -184,19 +184,30 @@ static struct screen_buffer *create_screen_buffer( struct console *console, int
screen_buffer->console = console;
screen_buffer->id = id;
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->width = width;
screen_buffer->height = height;
screen_buffer->attr = 0x07;
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.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 ))
{
free( screen_buffer );
More information about the wine-cvs
mailing list