Alexandre Julliard : wineconsole: Default to the user backend, falling back to curses if we can't create a window.

Alexandre Julliard julliard at winehq.org
Wed Sep 26 07:46:18 CDT 2007


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

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Wed Sep 26 14:21:46 2007 +0200

wineconsole: Default to the user backend, falling back to curses if we can't create a window.

---

 programs/wineconsole/curses.c      |    2 ++
 programs/wineconsole/user.c        |    2 +-
 programs/wineconsole/wineconsole.c |   24 ++++++++++++------------
 3 files changed, 15 insertions(+), 13 deletions(-)

diff --git a/programs/wineconsole/curses.c b/programs/wineconsole/curses.c
index 971c22d..2210cd9 100644
--- a/programs/wineconsole/curses.c
+++ b/programs/wineconsole/curses.c
@@ -1016,6 +1016,8 @@ enum init_return WCCURSES_InitBackend(struct inner_data* data)
 #else
 enum init_return WCCURSES_InitBackend(struct inner_data* data)
 {
+    WINE_ERR("(n)curses was not found at configuration time.\n"
+             "If you want (n)curses support, please install relevant packages.\n");
     return init_not_supported;
 }
 #endif
diff --git a/programs/wineconsole/user.c b/programs/wineconsole/user.c
index fdb0e16..deba453 100644
--- a/programs/wineconsole/user.c
+++ b/programs/wineconsole/user.c
@@ -1437,7 +1437,7 @@ enum init_return WCUSER_InitBackend(struct inner_data* data)
     CreateWindow(wndclass.lpszClassName, NULL,
 		 WS_OVERLAPPED|WS_CAPTION|WS_SYSMENU|WS_THICKFRAME|WS_MINIMIZEBOX|WS_HSCROLL|WS_VSCROLL,
 		 CW_USEDEFAULT, CW_USEDEFAULT, 0, 0, 0, 0, wndclass.hInstance, data);
-    if (!data->hWnd) return init_failed;
+    if (!data->hWnd) return init_not_supported;
 
     return init_success;
 }
diff --git a/programs/wineconsole/wineconsole.c b/programs/wineconsole/wineconsole.c
index 449cb64..a78e076 100644
--- a/programs/wineconsole/wineconsole.c
+++ b/programs/wineconsole/wineconsole.c
@@ -656,9 +656,18 @@ static struct inner_data* WINECON_Init(HINSTANCE hInst, DWORD pid, LPCWSTR appna
     WINE_TRACE("using hConOut %p\n", data->hConOut);
 
     /* filling data->curcfg from cfg */
- retry:
     switch ((*backend)(data))
     {
+    case init_not_supported:
+        if (backend == WCCURSES_InitBackend)
+        {
+            if (WCUSER_InitBackend( data ) != init_success) break;
+        }
+        else if (backend == WCUSER_InitBackend)
+        {
+            if (WCCURSES_InitBackend( data ) != init_success) break;
+        }
+        /* fall through */
     case init_success:
         WINECON_GetServerConfig(data);
         data->cells = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
@@ -684,16 +693,6 @@ static struct inner_data* WINECON_Init(HINSTANCE hInst, DWORD pid, LPCWSTR appna
         return data;
     case init_failed:
         break;
-    case init_not_supported:
-        if (backend == WCCURSES_InitBackend)
-        {
-            WINE_ERR("(n)curses was not found at configuration time.\n"
-                     "If you want (n)curses support, please install relevant packages.\n"
-                     "Now forcing user backend instead of (n)curses.\n");
-            backend = WCUSER_InitBackend;
-            goto retry;
-        }
-        break;
     }
 
  error:
@@ -768,7 +767,7 @@ static UINT WINECON_ParseOptions(const char* lpCmdLine, struct wc_init* wci)
     memset(wci, 0, sizeof(*wci));
     wci->ptr = lpCmdLine;
     wci->mode = from_process_name;
-    wci->backend = WCCURSES_InitBackend;
+    wci->backend = WCUSER_InitBackend;
 
     for (;;)
     {
@@ -792,6 +791,7 @@ static UINT WINECON_ParseOptions(const char* lpCmdLine, struct wc_init* wci)
             }
             else if (strncmp(wci->ptr + 10, "curses", 6) == 0)
             {
+                wci->backend = WCCURSES_InitBackend;
                 wci->ptr += 16;
             }
             else




More information about the wine-cvs mailing list