Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=50602
Signed-off-by: Roman Pišl rpisl@seznam.cz --- programs/conhost/window.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/programs/conhost/window.c b/programs/conhost/window.c index 55690377a7e..5e94a1d454e 100644 --- a/programs/conhost/window.c +++ b/programs/conhost/window.c @@ -1885,7 +1885,7 @@ static void apply_config( struct console *console, const struct console_config * console->active->attr = config->attr; console->active->popup_attr = config->popup_attr; console->active->win.left = config->win_pos.X; - console->active->win.right = config->win_pos.Y; + console->active->win.top = config->win_pos.Y; console->active->win.right = config->win_pos.X + config->win_width - 1; console->active->win.bottom = config->win_pos.Y + config->win_height - 1; memcpy( console->active->color_map, config->color_map, sizeof(config->color_map) );
Signed-off-by: Roman Pišl rpisl@seznam.cz --- programs/conhost/conhost.c | 21 +++++++++++++-------- programs/conhost/conhost.h | 2 ++ programs/conhost/window.c | 2 ++ 3 files changed, 17 insertions(+), 8 deletions(-)
diff --git a/programs/conhost/conhost.c b/programs/conhost/conhost.c index 0ac1c5f507b..dd22636be6a 100644 --- a/programs/conhost/conhost.c +++ b/programs/conhost/conhost.c @@ -1735,6 +1735,18 @@ static NTSTATUS get_output_info( struct screen_buffer *screen_buffer, size_t *ou return STATUS_SUCCESS; }
+void notify_screen_buffer_size( struct screen_buffer *screen_buffer ) +{ + if (is_active( screen_buffer ) && screen_buffer->console->mode & ENABLE_WINDOW_INPUT) + { + INPUT_RECORD ir; + ir.EventType = WINDOW_BUFFER_SIZE_EVENT; + ir.Event.WindowBufferSizeEvent.dwSize.X = screen_buffer->width; + ir.Event.WindowBufferSizeEvent.dwSize.Y = screen_buffer->height; + write_console_input( screen_buffer->console, &ir, 1, TRUE ); + } +} + NTSTATUS change_screen_buffer_size( struct screen_buffer *screen_buffer, int new_width, int new_height ) { int i, old_width, old_height, copy_width, copy_height; @@ -1839,14 +1851,7 @@ static NTSTATUS set_output_info( struct screen_buffer *screen_buffer, if (screen_buffer->cursor_x >= info->width) screen_buffer->cursor_x = info->width - 1; if (screen_buffer->cursor_y >= info->height) screen_buffer->cursor_y = info->height - 1;
- if (is_active( screen_buffer ) && screen_buffer->console->mode & ENABLE_WINDOW_INPUT) - { - INPUT_RECORD ir; - ir.EventType = WINDOW_BUFFER_SIZE_EVENT; - ir.Event.WindowBufferSizeEvent.dwSize.X = info->width; - ir.Event.WindowBufferSizeEvent.dwSize.Y = info->height; - write_console_input( screen_buffer->console, &ir, 1, TRUE ); - } + notify_screen_buffer_size( screen_buffer ); } if (params->mask & SET_CONSOLE_OUTPUT_INFO_ATTR) { diff --git a/programs/conhost/conhost.h b/programs/conhost/conhost.h index 3094fd6e5f0..6f3985352e2 100644 --- a/programs/conhost/conhost.h +++ b/programs/conhost/conhost.h @@ -136,6 +136,8 @@ void update_window_config( struct console *console );
NTSTATUS write_console_input( struct console *console, const INPUT_RECORD *records, unsigned int count, BOOL flush ); + +void notify_screen_buffer_size( struct screen_buffer *screen_buffer ); NTSTATUS change_screen_buffer_size( struct screen_buffer *screen_buffer, int new_width, int new_height );
static inline void empty_update_rect( struct screen_buffer *screen_buffer, RECT *rect ) diff --git a/programs/conhost/window.c b/programs/conhost/window.c index 5e94a1d454e..01917ee8b67 100644 --- a/programs/conhost/window.c +++ b/programs/conhost/window.c @@ -1901,6 +1901,8 @@ static void apply_config( struct console *console, const struct console_config * }
update_window( console ); + + notify_screen_buffer_size( console->active ); }
static void current_config( struct console *console, struct console_config *config )
On 01.02.2021 18:29, Roman Pišl wrote:
diff --git a/programs/conhost/window.c b/programs/conhost/window.c index 5e94a1d454e..01917ee8b67 100644 --- a/programs/conhost/window.c +++ b/programs/conhost/window.c @@ -1901,6 +1901,8 @@ static void apply_config( struct console *console, const struct console_config * }
update_window( console );
- notify_screen_buffer_size( console->active );
Should we do this only when the size actually changed?
Thanks,
Jacek
Dne 01. 02. 21 v 18:43 Jacek Caban napsal(a):
On 01.02.2021 18:29, Roman Pišl wrote:
diff --git a/programs/conhost/window.c b/programs/conhost/window.c index 5e94a1d454e..01917ee8b67 100644 --- a/programs/conhost/window.c +++ b/programs/conhost/window.c @@ -1901,6 +1901,8 @@ static void apply_config( struct console *console, const struct console_config * } update_window( console );
+ notify_screen_buffer_size( console->active );
Should we do this only when the size actually changed?
Good point. But the application usually updates also viewport within this event. And since there is no event for viewport change, not sending this event if there is only viewport change without buffer change is a half solution.
I also found this: https://github.com/microsoft/terminal/issues/281
Yes, there could be a test for viewport and buffer change, but isn't such complexity superfluous considering that apply_config is only called on init, config dialog and resize event?
Roman
Thanks,
Jacek
On 02.02.2021 08:44, Roman Pišl wrote:
Dne 01. 02. 21 v 18:43 Jacek Caban napsal(a):
On 01.02.2021 18:29, Roman Pišl wrote:
diff --git a/programs/conhost/window.c b/programs/conhost/window.c index 5e94a1d454e..01917ee8b67 100644 --- a/programs/conhost/window.c +++ b/programs/conhost/window.c @@ -1901,6 +1901,8 @@ static void apply_config( struct console *console, const struct console_config * } update_window( console );
+ notify_screen_buffer_size( console->active );
Should we do this only when the size actually changed?
Good point. But the application usually updates also viewport within this event. And since there is no event for viewport change, not sending this event if there is only viewport change without buffer change is a half solution.
I also found this: https://github.com/microsoft/terminal/issues/281
Yes, there could be a test for viewport and buffer change, but isn't such complexity superfluous considering that apply_config is only called on init, config dialog and resize event?
Agreed, that seems fine. I was also a bit worried that we'd call notify_screen_buffer_size() also during console initialization, but it's a no-op until ENABLE_WINDOW_INPUT is set (and it's not among default flags), so this looks fine.
Thanks,
Jacek
Signed-off-by: Jacek Caban jacek@codeweavers.com