Jacek Caban : conhost: Introduce Unix mode.

Alexandre Julliard julliard at winehq.org
Mon Sep 21 15:12:16 CDT 2020


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

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Mon Sep 21 17:05:41 2020 +0200

conhost: Introduce Unix mode.

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

---

 programs/conhost/conhost.c | 28 +++++++++++++++++++++-------
 1 file changed, 21 insertions(+), 7 deletions(-)

diff --git a/programs/conhost/conhost.c b/programs/conhost/conhost.c
index 1d48194206..5df6848ba5 100644
--- a/programs/conhost/conhost.c
+++ b/programs/conhost/conhost.c
@@ -79,6 +79,7 @@ struct console
     HANDLE                server;              /* console server handle */
     unsigned int          mode;                /* input mode */
     struct screen_buffer *active;              /* active screen buffer */
+    int                   is_unix;             /* UNIX terminal mode */
     INPUT_RECORD         *records;             /* input records */
     unsigned int          record_count;        /* number of input records */
     unsigned int          record_size;         /* size of input records buffer */
@@ -356,10 +357,14 @@ static void tty_sync( struct console *console )
 
 static void init_tty_output( struct console *console )
 {
-    /* initialize tty output, but don't flush */
-    tty_write( console, "\x1b[2J", 4 ); /* clear screen */
-    set_tty_attr( console, console->active->attr );
-    tty_write( console, "\x1b[H", 3 );  /* move cursor to (0,0) */
+    if (!console->is_unix)
+    {
+        /* initialize tty output, but don't flush */
+        tty_write( console, "\x1b[2J", 4 ); /* clear screen */
+        set_tty_attr( console, console->active->attr );
+        tty_write( console, "\x1b[H", 3 );  /* move cursor to (0,0) */
+    }
+    else console->tty_attr = empty_char_info.attr;
     console->tty_cursor_visible = TRUE;
 }
 
@@ -2641,7 +2646,7 @@ static int main_loop( struct console *console, HANDLE signal )
 
 int __cdecl wmain(int argc, WCHAR *argv[])
 {
-    int headless = 0, i, width = 80, height = 150;
+    int headless = 0, i, width = 0, height = 0;
     HANDLE signal = NULL, input_thread;
     WCHAR *end;
 
@@ -2664,18 +2669,24 @@ int __cdecl wmain(int argc, WCHAR *argv[])
             headless = 1;
             continue;
         }
+        if (!wcscmp( argv[i], L"--unix"))
+        {
+            console.is_unix = 1;
+            headless = 1;
+            continue;
+        }
         if (!wcscmp( argv[i], L"--width" ))
         {
             if (++i == argc) return 1;
             width = wcstol( argv[i], &end, 0 );
-            if (!width || width > 0xffff || *end) return 1;
+            if ((!width && !console.is_unix) || width > 0xffff || *end) return 1;
             continue;
         }
         if (!wcscmp( argv[i], L"--height" ))
         {
             if (++i == argc) return 1;
             height = wcstol( argv[i], &end, 0 );
-            if (!height || height > 0xffff || *end) return 1;
+            if ((!height && !console.is_unix) || height > 0xffff || *end) return 1;
             continue;
         }
         if (!wcscmp( argv[i], L"--signal" ))
@@ -2708,6 +2719,9 @@ int __cdecl wmain(int argc, WCHAR *argv[])
         return 1;
     }
 
+    if (!width)  width = 80;
+    if (!height) height = 150;
+
     if (!(console.active = create_screen_buffer( &console, 1, width, height ))) return 1;
     if (headless)
     {




More information about the wine-cvs mailing list