From d082517c3364ed01ed98ad4468437da7b9259ea3 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Wed, 26 Sep 2007 14:21:46 +0200 Subject: [PATCH] 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 971c22d58d..2210cd9640 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 fdb0e16b35..deba453abc 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 449cb64627..a78e07630e 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