[PATCH] conhost: Copy font properties to the new screen buffer

Hugh McMaster hugh.mcmaster at outlook.com
Wed Aug 4 07:48:12 CDT 2021


Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=50187
Signed-off-by: Hugh McMaster <hugh.mcmaster at outlook.com>
---
 programs/conhost/conhost.c | 20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)

diff --git a/programs/conhost/conhost.c b/programs/conhost/conhost.c
index 061f09989eb..8a787214356 100644
--- a/programs/conhost/conhost.c
+++ b/programs/conhost/conhost.c
@@ -68,6 +68,7 @@ static void destroy_screen_buffer( struct screen_buffer *screen_buffer )
     if (screen_buffer->console->active == screen_buffer)
         screen_buffer->console->active = NULL;
     wine_rb_remove( &screen_buffer_map, &screen_buffer->entry );
+    free( screen_buffer->font.face_name );
     free( screen_buffer->data );
     free( screen_buffer );
 }
@@ -90,12 +91,18 @@ static struct screen_buffer *create_screen_buffer( struct console *console, int
 
     if (console->active)
     {
-        screen_buffer->max_width  = console->active->max_width;
-        screen_buffer->max_height = console->active->max_height;
-        screen_buffer->win.right  = console->active->win.right  - console->active->win.left;
-        screen_buffer->win.bottom = console->active->win.bottom - console->active->win.top;
-        screen_buffer->attr       = console->active->attr;
-        screen_buffer->popup_attr = console->active->attr;
+        screen_buffer->max_width   = console->active->max_width;
+        screen_buffer->max_height  = console->active->max_height;
+        screen_buffer->win.right   = console->active->win.right  - console->active->win.left;
+        screen_buffer->win.bottom  = console->active->win.bottom - console->active->win.top;
+        screen_buffer->attr        = console->active->attr;
+        screen_buffer->popup_attr  = console->active->attr;
+        screen_buffer->font.width  = console->active->font.width;
+        screen_buffer->font.height = console->active->font.height;
+        screen_buffer->font.face_len = console->active->font.face_len;
+        if (!(screen_buffer->font.face_name = malloc(screen_buffer->font.face_len))) return NULL;
+        memcpy(screen_buffer->font.face_name, console->active->font.face_name,
+               screen_buffer->font.face_len);
     }
     else
     {
@@ -105,6 +112,7 @@ static struct screen_buffer *create_screen_buffer( struct console *console, int
         screen_buffer->win.bottom = height - 1;
         screen_buffer->attr       = FOREGROUND_BLUE|FOREGROUND_GREEN|FOREGROUND_RED;
         screen_buffer->popup_attr = 0xf5;
+        screen_buffer->font.face_name = NULL;
     }
 
     if (wine_rb_put( &screen_buffer_map, LongToPtr(id), &screen_buffer->entry ))
-- 
2.32.0




More information about the wine-devel mailing list