Commit 3a6da8de authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

conhost: Support painting screen buffer.

parent c2ffbe5d
......@@ -318,10 +318,18 @@ static void update_output( struct screen_buffer *screen_buffer, RECT *rect )
char_info_t *ch;
char buf[8];
if (!is_active( screen_buffer ) || !screen_buffer->console->tty_output) return;
if (rect->top > rect->bottom || rect->right < rect->left) return;
if (!is_active( screen_buffer ) || rect->top > rect->bottom || rect->right < rect->left)
return;
TRACE( "%s\n", wine_dbgstr_rect( rect ));
if (screen_buffer->console->win)
{
update_window_region( screen_buffer->console, rect );
return;
}
if (!screen_buffer->console->tty_output) return;
hide_tty_cursor( screen_buffer->console );
for (y = rect->top; y <= rect->bottom; y++)
......
......@@ -131,6 +131,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 );
NTSTATUS change_screen_buffer_size( struct screen_buffer *screen_buffer, int new_width, int new_height );
......
......@@ -933,6 +933,22 @@ static LRESULT WINAPI window_proc( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lp
update_window( console );
break;
case WM_PAINT:
{
PAINTSTRUCT ps;
BeginPaint( console->win, &ps );
BitBlt( ps.hdc, 0, 0,
(console->active->win.right - console->active->win.left + 1) * console->active->font.width,
(console->active->win.bottom - console->active->win.top + 1) * console->active->font.height,
console->window->mem_dc,
console->active->win.left * console->active->font.width,
console->active->win.top * console->active->font.height,
SRCCOPY );
EndPaint( console->win, &ps );
break;
}
default:
return DefWindowProcW( hwnd, msg, wparam, lparam );
}
......@@ -947,6 +963,16 @@ void update_window_config( struct console *console )
PostMessageW( console->win, WM_UPDATE_CONFIG, 0, 0 );
}
void update_window_region( struct console *console, const RECT *update )
{
RECT *window_rect = &console->window->update;
window_rect->left = min( window_rect->left, update->left );
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 );
}
BOOL init_window( struct console *console )
{
struct console_config config;
......
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