Jacek Caban : conhost: Update window config in ioctl handlers when needed.

Alexandre Julliard julliard at winehq.org
Thu Oct 8 15:20:06 CDT 2020


Module: wine
Branch: master
Commit: c2ffbe5d364d07971e0c893c6d52e5606dfbaef7
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=c2ffbe5d364d07971e0c893c6d52e5606dfbaef7

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Thu Oct  8 17:30:48 2020 +0200

conhost: Update window config in ioctl handlers when needed.

Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 programs/conhost/conhost.c | 13 ++++++++++---
 programs/conhost/conhost.h |  2 ++
 programs/conhost/window.c  | 13 +++++++++++++
 3 files changed, 25 insertions(+), 3 deletions(-)

diff --git a/programs/conhost/conhost.c b/programs/conhost/conhost.c
index 5c5f184e6e..ac7508ed8e 100644
--- a/programs/conhost/conhost.c
+++ b/programs/conhost/conhost.c
@@ -1162,6 +1162,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 );
 }
 
 static NTSTATUS process_console_input( struct console *console )
@@ -1632,9 +1633,10 @@ static NTSTATUS screen_buffer_activate( struct screen_buffer *screen_buffer )
     RECT update_rect;
     TRACE( "%p\n", screen_buffer );
     screen_buffer->console->active = 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 );
     tty_sync( screen_buffer->console );
+    update_window_config( screen_buffer->console );
     return STATUS_SUCCESS;
 }
 
@@ -1840,7 +1842,11 @@ static NTSTATUS set_output_info( struct screen_buffer *screen_buffer,
         }
     }
 
-    if (is_active( screen_buffer )) tty_sync( screen_buffer->console );
+    if (is_active( screen_buffer ))
+    {
+        tty_sync( screen_buffer->console );
+        update_window_config( screen_buffer->console );
+    }
     return STATUS_SUCCESS;
 }
 
@@ -1898,6 +1904,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 );
     return STATUS_SUCCESS;
 }
 
@@ -2384,7 +2391,7 @@ static NTSTATUS console_input_ioctl( struct console *console, unsigned int code,
             blocking = in_size && *(unsigned int *)in_data;
             if (blocking && !console->record_count && *out_size)
             {
-                TRACE( "pending read" );
+                TRACE( "pending read\n" );
                 console->read_ioctl = IOCTL_CONDRV_READ_INPUT;
                 console->pending_read = *out_size;
                 return STATUS_PENDING;
diff --git a/programs/conhost/conhost.h b/programs/conhost/conhost.h
index 49c3cccbce..690472dcc7 100644
--- a/programs/conhost/conhost.h
+++ b/programs/conhost/conhost.h
@@ -131,6 +131,8 @@ struct screen_buffer
 };
 
 BOOL init_window( struct console *console );
+void update_window_config( struct console *console );
+
 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 4085fd7a57..7d9b416e25 100644
--- a/programs/conhost/window.c
+++ b/programs/conhost/window.c
@@ -29,6 +29,8 @@
 
 WINE_DEFAULT_DEBUG_CHANNEL(conhost);
 
+#define WM_UPDATE_CONFIG  (WM_USER + 1)
+
 enum update_state
 {
     UPDATE_NONE,
@@ -927,6 +929,10 @@ static LRESULT WINAPI window_proc( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lp
         PostQuitMessage( 0 );
         break;
 
+    case WM_UPDATE_CONFIG:
+        update_window( console );
+        break;
+
     default:
         return DefWindowProcW( hwnd, msg, wparam, lparam );
     }
@@ -934,6 +940,13 @@ static LRESULT WINAPI window_proc( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lp
     return 0;
 }
 
+void update_window_config( struct console *console )
+{
+    if (!console->win || console->window->update_state != UPDATE_NONE) return;
+    console->window->update_state = UPDATE_PENDING;
+    PostMessageW( console->win, WM_UPDATE_CONFIG, 0, 0 );
+}
+
 BOOL init_window( struct console *console )
 {
     struct console_config config;




More information about the wine-cvs mailing list