Roman Pišl : conhost: Improve notification when resizing window.

Alexandre Julliard julliard at winehq.org
Wed Feb 3 15:39:28 CST 2021


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

Author: Roman Pišl <rpisl at seznam.cz>
Date:   Mon Feb  1 18:29:16 2021 +0100

conhost: Improve notification when resizing window.

Signed-off-by: Roman Pišl <rpisl at seznam.cz>
Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 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 )




More information about the wine-cvs mailing list