Commit 09c9fedf authored by Eric Pouech's avatar Eric Pouech Committed by Alexandre Julliard

Added a (n)curses backend to the wineconsole.

parent 5ac2a538
...@@ -4,11 +4,13 @@ TOPOBJDIR = ../.. ...@@ -4,11 +4,13 @@ TOPOBJDIR = ../..
SRCDIR = @srcdir@ SRCDIR = @srcdir@
VPATH = @srcdir@ VPATH = @srcdir@
MODULE = wineconsole.exe MODULE = wineconsole.exe
EXTRALIBS = @CURSESLIBS@
APPMODE = gui APPMODE = gui
IMPORTS = gdi32 user32 advapi32 kernel32 ntdll IMPORTS = advapi32 kernel32 ntdll
DELAYIMPORTS = comctl32 DELAYIMPORTS = comctl32 user32 gdi32
C_SRCS = \ C_SRCS = \
curses.c \
dialog.c \ dialog.c \
registry.c \ registry.c \
user.c \ user.c \
......
...@@ -160,7 +160,7 @@ void WINECON_RegLoad(const WCHAR* appname, struct config_data* cfg) ...@@ -160,7 +160,7 @@ void WINECON_RegLoad(const WCHAR* appname, struct config_data* cfg)
cfg->cursor_size = 25; cfg->cursor_size = 25;
cfg->cursor_visible = 1; cfg->cursor_visible = 1;
cfg->exit_on_die = 1; cfg->exit_on_die = 1;
cfg->face_name[0] = 0; memset(cfg->face_name, 0, sizeof(cfg->face_name));
cfg->cell_height = 12; cfg->cell_height = 12;
cfg->cell_width = 8; cfg->cell_width = 8;
cfg->font_weight = 0; cfg->font_weight = 0;
......
...@@ -23,8 +23,8 @@ ...@@ -23,8 +23,8 @@
#include <stdio.h> #include <stdio.h>
#include "wine/server.h" #include "wine/server.h"
#include "wine/unicode.h"
#include "winecon_private.h" #include "winecon_private.h"
#include "winnls.h"
#include "wine/debug.h" #include "wine/debug.h"
...@@ -428,11 +428,11 @@ static void WINECON_Delete(struct inner_data* data) ...@@ -428,11 +428,11 @@ static void WINECON_Delete(struct inner_data* data)
{ {
if (!data) return; if (!data) return;
if (data->fnDeleteBackend) data->fnDeleteBackend(data);
if (data->hConIn) CloseHandle(data->hConIn); if (data->hConIn) CloseHandle(data->hConIn);
if (data->hConOut) CloseHandle(data->hConOut); if (data->hConOut) CloseHandle(data->hConOut);
if (data->hSynchro) CloseHandle(data->hSynchro); if (data->hSynchro) CloseHandle(data->hSynchro);
if (data->cells) HeapFree(GetProcessHeap(), 0, data->cells); if (data->cells) HeapFree(GetProcessHeap(), 0, data->cells);
if (data->fnDeleteBackend) data->fnDeleteBackend(data);
HeapFree(GetProcessHeap(), 0, data); HeapFree(GetProcessHeap(), 0, data);
} }
...@@ -499,7 +499,7 @@ static struct inner_data* WINECON_Init(HINSTANCE hInst, DWORD pid, LPCWSTR appna ...@@ -499,7 +499,7 @@ static struct inner_data* WINECON_Init(HINSTANCE hInst, DWORD pid, LPCWSTR appna
{ {
req->handle = (obj_handle_t)data->hConIn; req->handle = (obj_handle_t)data->hConIn;
req->mask = SET_CONSOLE_INPUT_INFO_TITLE; req->mask = SET_CONSOLE_INPUT_INFO_TITLE;
wine_server_add_data( req, appname, strlenW(appname) * sizeof(WCHAR) ); wine_server_add_data( req, appname, lstrlenW(appname) * sizeof(WCHAR) );
ret = !wine_server_call_err( req ); ret = !wine_server_call_err( req );
} }
SERVER_END_REQ; SERVER_END_REQ;
...@@ -580,7 +580,7 @@ static BOOL WINECON_Spawn(struct inner_data* data, LPWSTR cmdLine) ...@@ -580,7 +580,7 @@ static BOOL WINECON_Spawn(struct inner_data* data, LPWSTR cmdLine)
* *
* *
*/ */
static BOOL WINECON_HasEvent(LPCSTR ptr, unsigned *evt) static BOOL WINECON_HasEvent(LPCSTR ptr, unsigned* evt)
{ {
while (*ptr == ' ' || *ptr == '\t') ptr++; while (*ptr == ' ' || *ptr == '\t') ptr++;
if (strncmp(ptr, "--use-event=", 12)) return FALSE; if (strncmp(ptr, "--use-event=", 12)) return FALSE;
...@@ -599,15 +599,12 @@ int PASCAL WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR lpCmdLine, INT nCmdSh ...@@ -599,15 +599,12 @@ int PASCAL WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR lpCmdLine, INT nCmdSh
{ {
struct inner_data* data; struct inner_data* data;
int ret = 1; int ret = 1;
unsigned evt; unsigned evt;
BOOL (*backend)(struct inner_data*);
backend = WCUSER_InitBackend;
/* case of wineconsole <evt>, signal process that created us that we're up and running */ /* case of wineconsole <evt>, signal process that created us that we're up and running */
if (WINECON_HasEvent(lpCmdLine, &evt)) if (WINECON_HasEvent(lpCmdLine, &evt))
{ {
if (!(data = WINECON_Init(hInst, 0, NULL, backend))) return 0; if (!(data = WINECON_Init(hInst, 0, NULL, WCUSER_InitBackend))) return 0;
ret = SetEvent((HANDLE)evt); ret = SetEvent((HANDLE)evt);
if (!ret) if (!ret)
{ {
...@@ -628,6 +625,7 @@ int PASCAL WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR lpCmdLine, INT nCmdSh ...@@ -628,6 +625,7 @@ int PASCAL WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR lpCmdLine, INT nCmdSh
* the correct way would be to check the existence of the left part of ptr * the correct way would be to check the existence of the left part of ptr
* (to be a file) * (to be a file)
*/ */
/* FIXME: could also add an option to choose another backend if needed */
while (*wcmdLine && *wcmdLine++ != ' '); while (*wcmdLine && *wcmdLine++ != ' ');
/* FIXME: see above */ /* FIXME: see above */
...@@ -635,7 +633,7 @@ int PASCAL WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR lpCmdLine, INT nCmdSh ...@@ -635,7 +633,7 @@ int PASCAL WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR lpCmdLine, INT nCmdSh
while (*src && *src != ' ') *dst++ = *src++; while (*src && *src != ' ') *dst++ = *src++;
*dst = 0; *dst = 0;
if (!(data = WINECON_Init(hInst, GetCurrentProcessId(), buffer, backend))) return 0; if (!(data = WINECON_Init(hInst, GetCurrentProcessId(), buffer, WCCURSE_InitBackend))) return 0;
ret = WINECON_Spawn(data, wcmdLine); ret = WINECON_Spawn(data, wcmdLine);
if (!ret) if (!ret)
{ {
......
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