conhost: Delay window refresh on output update.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2021-03-30 21:28:01 +02:00 committed by Alexandre Julliard
parent 68f8c454ec
commit 8ccf24ccb0
3 changed files with 16 additions and 9 deletions

View File

@ -1211,7 +1211,7 @@ static void update_read_output( struct console *console )
if (console->is_unix)
set_tty_cursor_relative( screen_buffer->console, screen_buffer->cursor_x, screen_buffer->cursor_y );
tty_sync( screen_buffer->console );
update_window_config( screen_buffer->console );
update_window_config( screen_buffer->console, TRUE );
}
static NTSTATUS process_console_input( struct console *console )
@ -1703,7 +1703,7 @@ static NTSTATUS screen_buffer_activate( struct screen_buffer *screen_buffer )
SetRect( &update_rect, 0, 0, screen_buffer->width - 1, screen_buffer->height - 1 );
update_output( screen_buffer, &update_rect );
tty_sync( screen_buffer->console );
update_window_config( screen_buffer->console );
update_window_config( screen_buffer->console, FALSE );
return STATUS_SUCCESS;
}
@ -1896,7 +1896,7 @@ static NTSTATUS set_output_info( struct screen_buffer *screen_buffer,
if (is_active( screen_buffer ))
{
tty_sync( screen_buffer->console );
update_window_config( screen_buffer->console );
update_window_config( screen_buffer->console, FALSE );
}
return STATUS_SUCCESS;
}
@ -1955,7 +1955,7 @@ static NTSTATUS write_console( struct screen_buffer *screen_buffer, const WCHAR
scroll_to_cursor( screen_buffer );
update_output( screen_buffer, &update_rect );
tty_sync( screen_buffer->console );
update_window_config( screen_buffer->console );
update_window_config( screen_buffer->console, TRUE );
return STATUS_SUCCESS;
}

View File

@ -132,7 +132,7 @@ struct screen_buffer
BOOL init_window( struct console *console );
void update_window_region( struct console *console, const RECT *update );
void update_window_config( struct console *console );
void update_window_config( struct console *console, BOOL delay );
NTSTATUS write_console_input( struct console *console, const INPUT_RECORD *records,
unsigned int count, BOOL flush );

View File

@ -2170,8 +2170,10 @@ static LRESULT WINAPI window_proc( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lp
PostQuitMessage( 0 );
break;
case WM_TIMER:
case WM_UPDATE_CONFIG:
update_window( console );
if (console->window->update_state == UPDATE_PENDING)
update_window( console );
break;
case WM_PAINT:
@ -2457,11 +2459,16 @@ static LRESULT WINAPI window_proc( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lp
return 0;
}
void update_window_config( struct console *console )
void update_window_config( struct console *console, BOOL delay )
{
const int delay_timeout = 50;
if (!console->win || console->window->update_state != UPDATE_NONE) return;
console->window->update_state = UPDATE_PENDING;
PostMessageW( console->win, WM_UPDATE_CONFIG, 0, 0 );
if (delay)
SetTimer( console->win, 1, delay_timeout, NULL );
else
PostMessageW( console->win, WM_UPDATE_CONFIG, 0, 0 );
}
void update_window_region( struct console *console, const RECT *update )
@ -2471,7 +2478,7 @@ void update_window_region( struct console *console, const RECT *update )
window_rect->top = min( window_rect->top, update->top );
window_rect->right = max( window_rect->right, update->right );
window_rect->bottom = max( window_rect->bottom, update->bottom );
update_window_config( console );
update_window_config( console, TRUE );
}
BOOL init_window( struct console *console )