Commit 8ccf24cc authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

conhost: Delay window refresh on output update.

parent 68f8c454
...@@ -1211,7 +1211,7 @@ static void update_read_output( struct console *console ) ...@@ -1211,7 +1211,7 @@ static void update_read_output( struct console *console )
if (console->is_unix) if (console->is_unix)
set_tty_cursor_relative( screen_buffer->console, screen_buffer->cursor_x, screen_buffer->cursor_y ); set_tty_cursor_relative( screen_buffer->console, screen_buffer->cursor_x, screen_buffer->cursor_y );
tty_sync( screen_buffer->console ); 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 ) static NTSTATUS process_console_input( struct console *console )
...@@ -1703,7 +1703,7 @@ static NTSTATUS screen_buffer_activate( struct screen_buffer *screen_buffer ) ...@@ -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 ); SetRect( &update_rect, 0, 0, screen_buffer->width - 1, screen_buffer->height - 1 );
update_output( screen_buffer, &update_rect ); update_output( screen_buffer, &update_rect );
tty_sync( screen_buffer->console ); tty_sync( screen_buffer->console );
update_window_config( screen_buffer->console ); update_window_config( screen_buffer->console, FALSE );
return STATUS_SUCCESS; return STATUS_SUCCESS;
} }
...@@ -1896,7 +1896,7 @@ static NTSTATUS set_output_info( struct screen_buffer *screen_buffer, ...@@ -1896,7 +1896,7 @@ static NTSTATUS set_output_info( struct screen_buffer *screen_buffer,
if (is_active( screen_buffer )) if (is_active( screen_buffer ))
{ {
tty_sync( screen_buffer->console ); tty_sync( screen_buffer->console );
update_window_config( screen_buffer->console ); update_window_config( screen_buffer->console, FALSE );
} }
return STATUS_SUCCESS; return STATUS_SUCCESS;
} }
...@@ -1955,7 +1955,7 @@ static NTSTATUS write_console( struct screen_buffer *screen_buffer, const WCHAR ...@@ -1955,7 +1955,7 @@ static NTSTATUS write_console( struct screen_buffer *screen_buffer, const WCHAR
scroll_to_cursor( screen_buffer ); scroll_to_cursor( screen_buffer );
update_output( screen_buffer, &update_rect ); update_output( screen_buffer, &update_rect );
tty_sync( screen_buffer->console ); tty_sync( screen_buffer->console );
update_window_config( screen_buffer->console ); update_window_config( screen_buffer->console, TRUE );
return STATUS_SUCCESS; return STATUS_SUCCESS;
} }
......
...@@ -132,7 +132,7 @@ struct screen_buffer ...@@ -132,7 +132,7 @@ struct screen_buffer
BOOL init_window( struct console *console ); BOOL init_window( struct console *console );
void update_window_region( struct console *console, const RECT *update ); 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, NTSTATUS write_console_input( struct console *console, const INPUT_RECORD *records,
unsigned int count, BOOL flush ); unsigned int count, BOOL flush );
......
...@@ -2170,8 +2170,10 @@ static LRESULT WINAPI window_proc( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lp ...@@ -2170,8 +2170,10 @@ static LRESULT WINAPI window_proc( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lp
PostQuitMessage( 0 ); PostQuitMessage( 0 );
break; break;
case WM_TIMER:
case WM_UPDATE_CONFIG: case WM_UPDATE_CONFIG:
update_window( console ); if (console->window->update_state == UPDATE_PENDING)
update_window( console );
break; break;
case WM_PAINT: case WM_PAINT:
...@@ -2457,11 +2459,16 @@ static LRESULT WINAPI window_proc( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lp ...@@ -2457,11 +2459,16 @@ static LRESULT WINAPI window_proc( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lp
return 0; 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; if (!console->win || console->window->update_state != UPDATE_NONE) return;
console->window->update_state = UPDATE_PENDING; 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 ) void update_window_region( struct console *console, const RECT *update )
...@@ -2471,7 +2478,7 @@ 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->top = min( window_rect->top, update->top );
window_rect->right = max( window_rect->right, update->right ); window_rect->right = max( window_rect->right, update->right );
window_rect->bottom = max( window_rect->bottom, update->bottom ); window_rect->bottom = max( window_rect->bottom, update->bottom );
update_window_config( console ); update_window_config( console, TRUE );
} }
BOOL init_window( struct console *console ) BOOL init_window( struct console *console )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment