Commit 99bc6404 authored by Eric Pouech's avatar Eric Pouech Committed by Alexandre Julliard

If (n)curses wasn't available at compile time:

- print sensible information - fall back to user backend
parent 6936db11
......@@ -717,10 +717,10 @@ static int WCCURSES_MainLoop(struct inner_data* data)
* Initialisation part II: creation of window.
*
*/
BOOL WCCURSES_InitBackend(struct inner_data* data)
enum init_return WCCURSES_InitBackend(struct inner_data* data)
{
data->private = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(struct inner_data_curse));
if (!data->private) return FALSE;
if (!data->private) return init_failed;
data->fnMainLoop = WCCURSES_MainLoop;
data->fnPosCursor = WCCURSES_PosCursor;
......@@ -737,7 +737,7 @@ BOOL WCCURSES_InitBackend(struct inner_data* data)
(obj_handle_t*)&PRIVATE(data)->hInput))
{
WINE_FIXME("Cannot open 0\n");
return 0;
return init_failed;
}
/* FIXME: should find a good way to enable buffer scrolling
......@@ -782,12 +782,12 @@ BOOL WCCURSES_InitBackend(struct inner_data* data)
mousemask(0, &PRIVATE(data)->initial_mouse_mask);
}
return TRUE;
return init_success;
}
#else
BOOL WCCURSES_InitBackend(struct inner_data* data)
{
return FALSE;
return init_not_supported;
}
#endif
......@@ -1353,14 +1353,14 @@ static int WCUSER_MainLoop(struct inner_data* data)
* Initialisation part II: creation of window.
*
*/
BOOL WCUSER_InitBackend(struct inner_data* data)
enum init_return WCUSER_InitBackend(struct inner_data* data)
{
static WCHAR wClassName[] = {'W','i','n','e','C','o','n','s','o','l','e','C','l','a','s','s',0};
WNDCLASS wndclass;
data->private = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(struct inner_data_user));
if (!data->private) return FALSE;
if (!data->private) return init_failed;
data->fnMainLoop = WCUSER_MainLoop;
data->fnPosCursor = WCUSER_PosCursor;
......@@ -1389,7 +1389,7 @@ BOOL 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 (!PRIVATE(data)->hWnd) return FALSE;
if (!PRIVATE(data)->hWnd) return init_failed;
return TRUE;
return init_success;
}
......@@ -89,5 +89,8 @@ extern void WINECON_RegSave(const struct config_data* cfg);
extern void WINECON_DumpConfig(const char* pfx, const struct config_data* cfg);
/* backends... */
extern BOOL WCUSER_InitBackend(struct inner_data* data);
extern BOOL WCCURSES_InitBackend(struct inner_data* data);
enum init_return {
init_success, init_failed, init_not_supported
};
extern enum init_return WCUSER_InitBackend(struct inner_data* data);
extern enum init_return WCCURSES_InitBackend(struct inner_data* data);
......@@ -529,7 +529,7 @@ static void WINECON_Delete(struct inner_data* data)
* active screen buffer)
*/
static struct inner_data* WINECON_Init(HINSTANCE hInst, DWORD pid, LPCWSTR appname,
BOOL (*backend)(struct inner_data*))
enum init_return (*backend)(struct inner_data*))
{
struct inner_data* data = NULL;
DWORD ret;
......@@ -605,12 +605,26 @@ 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 */
if ((*backend)(data))
retry:
switch ((*backend)(data))
{
case init_success:
WINECON_SetConfig(data, &cfg, TRUE);
data->curcfg.registry = cfg.registry;
WINECON_DumpConfig("fint", &data->curcfg);
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:
......@@ -665,10 +679,10 @@ static BOOL WINECON_Spawn(struct inner_data* data, LPWSTR cmdLine)
}
struct wc_init {
LPCSTR ptr;
LPCSTR ptr;
enum {from_event, from_process_name} mode;
BOOL (*backend)(struct inner_data*);
HANDLE event;
enum init_return (*backend)(struct inner_data*);
HANDLE event;
};
/******************************************************************
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment