wfreerdp: unify client interface

This commit is contained in:
Marc-André Moreau 2013-04-08 22:10:59 -04:00
parent 720a23e07a
commit 6dfa196966
4 changed files with 27 additions and 21 deletions

View File

@ -47,11 +47,11 @@ INT WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
int status;
wfInfo* wfi;
wf_global_init();
freerdp_client_global_init();
wfi = wf_new(hInstance, NULL, __argc, __argv);
wfi = freerdp_client_new(__argc, __argv);
status = wf_start(wfi);
status = freerdp_client_start(wfi);
if (status < 0)
{
@ -64,7 +64,7 @@ INT WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
WaitForSingleObject(wfi->thread, INFINITE);
}
wf_free(wfi);
freerdp_client_free(wfi);
return 0;
}

View File

@ -685,7 +685,7 @@ DWORD WINAPI wf_keyboard_thread(LPVOID lpParam)
return (DWORD) NULL;
}
int wf_global_init()
int freerdp_client_global_init()
{
WSADATA wsaData;
@ -711,21 +711,21 @@ int wf_global_init()
return 0;
}
int wf_global_uninit()
int freerdp_client_global_uninit()
{
WSACleanup();
return 0;
}
wfInfo* wf_new(HINSTANCE hInstance, HWND hWndParent, int argc, char** argv)
wfInfo* freerdp_client_new(int argc, char** argv)
{
int index;
wfInfo* wfi;
freerdp* instance;
HINSTANCE hInstance;
if (!hInstance)
hInstance = GetModuleHandle(NULL);
hInstance = GetModuleHandle(NULL);
instance = freerdp_new();
instance->PreConnect = wf_pre_connect;
@ -740,7 +740,9 @@ wfInfo* wf_new(HINSTANCE hInstance, HWND hWndParent, int argc, char** argv)
freerdp_context_new(instance);
wfi = ((wfContext*) (instance->context))->wfi;
wfi->instance = instance;
wfi->client = instance->context->client;
instance->context->argc = argc;
instance->context->argv = argv;
@ -752,7 +754,7 @@ wfInfo* wf_new(HINSTANCE hInstance, HWND hWndParent, int argc, char** argv)
instance->context->argv[index] = _strdup(argv[index]);
}
wfi->hWndParent = hWndParent;
wfi->hWndParent = NULL;
wfi->hInstance = hInstance;
wfi->cursor = LoadCursor(NULL, IDC_ARROW);
wfi->icon = LoadIcon(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_ICON1));
@ -775,7 +777,7 @@ wfInfo* wf_new(HINSTANCE hInstance, HWND hWndParent, int argc, char** argv)
return wfi;
}
int wf_start(wfInfo* wfi)
int freerdp_client_start(wfInfo* wfi)
{
int status;
freerdp* instance = wfi->instance;
@ -797,12 +799,12 @@ int wf_start(wfInfo* wfi)
return 0;
}
int wf_stop(wfInfo* wfi)
int freerdp_client_stop(wfInfo* wfi)
{
return 0;
}
int wf_free(wfInfo* wfi)
int freerdp_client_free(wfInfo* wfi)
{
freerdp* instance = wfi->instance;

View File

@ -67,6 +67,8 @@ typedef struct wf_context wfContext;
struct wf_info
{
rdpClient* client;
int width;
int height;
int offset_x;
@ -107,13 +109,15 @@ struct wf_info
BOOL sw_gdi;
};
FREERDP_API int wf_global_init();
FREERDP_API int wf_global_uninit();
#define cfInfo wfInfo
FREERDP_API int wf_start(wfInfo* wfi);
FREERDP_API int wf_stop(wfInfo* wfi);
FREERDP_API int freerdp_client_global_init();
FREERDP_API int freerdp_client_global_uninit();
FREERDP_API wfInfo* wf_new(HINSTANCE hInstance, HWND hWndParent, int argc, char** argv);
FREERDP_API int wf_free(wfInfo* wfi);
FREERDP_API int freerdp_client_start(wfInfo* cfi);
FREERDP_API int freerdp_client_stop(wfInfo* cfi);
FREERDP_API cfInfo* freerdp_client_new(int argc, char** argv);
FREERDP_API int freerdp_client_free(wfInfo* cfi);
#endif

View File

@ -26,12 +26,12 @@
#include <winpr/spec.h>
#include <winpr/handle.h>
#ifndef _WIN32
#ifdef __cplusplus
extern "C" {
#endif
#ifndef _WIN32
typedef struct _STARTUPINFOA
{
DWORD cb;