xfreerdp: merge with benoit's client API update

This commit is contained in:
Marc-André Moreau 2013-06-13 17:52:24 -04:00
parent 63becd2633
commit 8eaa32ac8f
4 changed files with 75 additions and 98 deletions

View File

@ -1510,9 +1510,11 @@ int freerdp_client_global_uninit()
return 0;
}
int freerdp_client_start(xfContext* xfc)
int freerdp_client_start(rdpContext* context)
{
rdpSettings* settings = xfc->settings;
xfContext* xfc = (xfContext*) context;
rdpSettings* settings = context->settings;
if (!settings->ServerHostname)
{
@ -1525,12 +1527,14 @@ int freerdp_client_start(xfContext* xfc)
return 0;
}
int freerdp_client_stop(xfContext* xfc)
int freerdp_client_stop(rdpContext* context)
{
if (xfc->instance->settings->AsyncInput)
xfContext* xfc = (xfContext*) context;
if (context->instance->settings->AsyncInput)
{
wMessageQueue* queue;
queue = freerdp_get_message_queue(xfc->instance, FREERDP_INPUT_MESSAGE_QUEUE);
queue = freerdp_get_message_queue(context->instance, FREERDP_INPUT_MESSAGE_QUEUE);
MessageQueue_PostQuit(queue, 0);
}
else
@ -1541,36 +1545,39 @@ int freerdp_client_stop(xfContext* xfc)
return 0;
}
freerdp* freerdp_client_get_instance(cfInfo* cfi)
freerdp* freerdp_client_get_instance(rdpContext* context)
{
return cfi->instance;
return context->instance;
}
HANDLE freerdp_client_get_thread(cfInfo* cfi)
HANDLE freerdp_client_get_thread(rdpContext* context)
{
return cfi->thread;
xfContext* xfc = (xfContext*) context;
return xfc->thread;
}
rdpClient* freerdp_client_get_interface(cfInfo* cfi)
rdpClient* freerdp_client_get_interface(rdpContext* context)
{
return cfi->client;
return context->client;
}
double freerdp_client_get_scale(xfContext* xfc)
double freerdp_client_get_scale(rdpContext* context)
{
xfContext* xfc = (xfContext*) context;
return xfc->scale;
}
void freerdp_client_reset_scale(xfContext* xfc)
void freerdp_client_reset_scale(rdpContext* context)
{
xfc->scale = 1.0;
xfContext* xfc = (xfContext*) context;
XResizeWindow(xfc->display, xfc->window->handle, xfc->originalWidth * xfc->scale, xfc->originalHeight * xfc->scale);
IFCALL(xfc->client->OnResizeWindow, xfc->instance, xfc->originalWidth * xfc->scale, xfc->originalHeight * xfc->scale);
xf_draw_screen_scaled(xfc);
xfc->scale = 1.0;
XResizeWindow(xfc->display, xfc->window->handle, xfc->originalWidth * xfc->scale, xfc->originalHeight * xfc->scale);
IFCALL(xfc->client->OnResizeWindow, xfc->instance, xfc->originalWidth * xfc->scale, xfc->originalHeight * xfc->scale);
xf_draw_screen_scaled(xfc);
}
xfInfo* freerdp_client_new(int argc, char** argv)
rdpContext* freerdp_client_new(int argc, char** argv)
{
int index;
int status;
@ -1662,18 +1669,17 @@ xfInfo* freerdp_client_new(int argc, char** argv)
xf_list_monitors(xfc);
}
return xfc;
return (rdpContext*) xfc;
}
void freerdp_client_free(xfContext* xfc)
void freerdp_client_free(rdpContext* context)
{
if (xfc)
{
int index;
freerdp* instance;
rdpContext* context;
int index;
freerdp* instance;
xfContext* xfc = (xfContext*) context;
context = (rdpContext*) xfc;
if (context)
{
instance = context->instance;
xf_window_free(xfc);

View File

@ -34,7 +34,6 @@
#include <winpr/synch.h>
#include <winpr/thread.h>
typedef struct xf_context xfInfo;
typedef struct xf_context xfContext;
#ifdef __cplusplus
@ -45,23 +44,6 @@ extern "C" {
* Client Interface
*/
#define cfInfo xfContext
FREERDP_API int freerdp_client_global_init();
FREERDP_API int freerdp_client_global_uninit();
FREERDP_API int freerdp_client_start(cfInfo* cfc);
FREERDP_API int freerdp_client_stop(cfInfo* cfc);
FREERDP_API freerdp* freerdp_client_get_instance(cfInfo* cfc);
FREERDP_API HANDLE freerdp_client_get_thread(cfInfo* cfc);
FREERDP_API rdpClient* freerdp_client_get_interface(cfInfo* cfc);
FREERDP_API double freerdp_client_get_scale(cfInfo* cfc);
FREERDP_API void freerdp_client_reset_scale(cfInfo* cfc);
FREERDP_API cfInfo* freerdp_client_new(int argc, char** argv);
FREERDP_API void freerdp_client_free(cfInfo* cfc);
#ifdef __cplusplus
}
#endif

View File

@ -21,70 +21,59 @@
#include "config.h"
#endif
#include "freerdp/client.h"
#include <freerdp/client.h>
freerdp* freerdp_client_get_instance(rdpContext* cfc)
freerdp* freerdp_client_get_instance(rdpContext* context)
{
return cfc->instance;
return context->instance;
}
BOOL freerdp_client_get_param_bool(rdpContext* cfc, int id)
BOOL freerdp_client_get_param_bool(rdpContext* context, int id)
{
rdpSettings* settings = cfc->instance->settings;
return freerdp_get_param_bool(settings, id);
rdpSettings* settings = context->settings;
return freerdp_get_param_bool(settings, id);
}
int freerdp_client_set_param_bool(rdpContext* cfc, int id, BOOL param)
int freerdp_client_set_param_bool(rdpContext* context, int id, BOOL param)
{
rdpSettings* settings = cfc->instance->settings;
return freerdp_set_param_bool(settings, id, param);
rdpSettings* settings = context->settings;
return freerdp_set_param_bool(settings, id, param);
}
UINT32 freerdp_client_get_param_uint32(rdpContext* cfc, int id)
UINT32 freerdp_client_get_param_uint32(rdpContext* context, int id)
{
rdpSettings* settings = cfc->instance->settings;
return freerdp_get_param_uint32(settings, id);
rdpSettings* settings = context->settings;
return freerdp_get_param_uint32(settings, id);
}
int freerdp_client_set_param_uint32(rdpContext* cfc, int id, UINT32 param)
int freerdp_client_set_param_uint32(rdpContext* context, int id, UINT32 param)
{
rdpSettings* settings = cfc->instance->settings;
return freerdp_set_param_uint32(settings, id, param);
rdpSettings* settings = context->settings;
return freerdp_set_param_uint32(settings, id, param);
}
UINT64 freerdp_client_get_param_uint64(rdpContext* cfc, int id)
UINT64 freerdp_client_get_param_uint64(rdpContext* context, int id)
{
rdpSettings* settings = cfc->instance->settings;
return freerdp_get_param_uint64(settings, id);
rdpSettings* settings = context->settings;
return freerdp_get_param_uint64(settings, id);
}
int freerdp_client_set_param_uint64(rdpContext* cfc, int id, UINT64 param)
int freerdp_client_set_param_uint64(rdpContext* context, int id, UINT64 param)
{
rdpSettings* settings = cfc->instance->settings;
return freerdp_set_param_uint64(settings, id, param);
rdpSettings* settings = context->settings;
return freerdp_set_param_uint64(settings, id, param);
}
char* freerdp_client_get_param_string(rdpContext* cfc, int id)
char* freerdp_client_get_param_string(rdpContext* context, int id)
{
rdpSettings* settings = cfc->instance->settings;
return freerdp_get_param_string(settings, id);
rdpSettings* settings = context->settings;
return freerdp_get_param_string(settings, id);
}
int freerdp_client_set_param_string(rdpContext* cfc, int id, char* param)
int freerdp_client_set_param_string(rdpContext* context, int id, char* param)
{
rdpSettings* settings = cfc->instance->settings;
return freerdp_set_param_string(settings, id, param);
rdpSettings* settings = context->settings;
return freerdp_set_param_string(settings, id, param);
}

View File

@ -57,31 +57,31 @@ struct rdp_client
FREERDP_API int freerdp_client_global_init();
FREERDP_API int freerdp_client_global_uninit();
FREERDP_API int freerdp_client_start(rdpContext* cfc);
FREERDP_API int freerdp_client_stop(rdpContext* cfc);
FREERDP_API int freerdp_client_start(rdpContext* context);
FREERDP_API int freerdp_client_stop(rdpContext* context);
FREERDP_API freerdp* freerdp_client_get_instance(rdpContext* cfc);
FREERDP_API HANDLE freerdp_client_get_thread(rdpContext* cfc);
FREERDP_API rdpClient* freerdp_client_get_interface(rdpContext* cfc);
FREERDP_API double freerdp_client_get_scale(rdpContext* cfc);
FREERDP_API void freerdp_client_reset_scale(rdpContext* cfc);
FREERDP_API freerdp* freerdp_client_get_instance(rdpContext* context);
FREERDP_API HANDLE freerdp_client_get_thread(rdpContext* context);
FREERDP_API rdpClient* freerdp_client_get_interface(rdpContext* context);
FREERDP_API double freerdp_client_get_scale(rdpContext* context);
FREERDP_API void freerdp_client_reset_scale(rdpContext* context);
FREERDP_API rdpContext* freerdp_client_new(int argc, char** argv);
FREERDP_API void freerdp_client_free(rdpContext* cfc);
FREERDP_API BOOL freerdp_client_get_param_bool(rdpContext* cfc, int id);
FREERDP_API int freerdp_client_set_param_bool(rdpContext* cfc, int id, BOOL param);
FREERDP_API BOOL freerdp_client_get_param_bool(rdpContext* context, int id);
FREERDP_API int freerdp_client_set_param_bool(rdpContext* context, int id, BOOL param);
FREERDP_API UINT32 freerdp_client_get_param_uint32(rdpContext* cfc, int id);
FREERDP_API int freerdp_client_set_param_uint32(rdpContext* cfc, int id, UINT32 param);
FREERDP_API UINT32 freerdp_client_get_param_uint32(rdpContext* context, int id);
FREERDP_API int freerdp_client_set_param_uint32(rdpContext* context, int id, UINT32 param);
FREERDP_API UINT64 freerdp_client_get_param_uint64(rdpContext* cfc, int id);
FREERDP_API int freerdp_client_set_param_uint64(rdpContext* cfc, int id, UINT64 param);
FREERDP_API UINT64 freerdp_client_get_param_uint64(rdpContext* context, int id);
FREERDP_API int freerdp_client_set_param_uint64(rdpContext* context, int id, UINT64 param);
FREERDP_API char* freerdp_client_get_param_string(rdpContext* cfc, int id);
FREERDP_API int freerdp_client_set_param_string(rdpContext* cfc, int id, char* param);
FREERDP_API char* freerdp_client_get_param_string(rdpContext* context, int id);
FREERDP_API int freerdp_client_set_param_string(rdpContext* context, int id, char* param);
FREERDP_API void freerdp_client_mouse_event(rdpContext* cfc, DWORD flags, int x, int y);
FREERDP_API void freerdp_client_mouse_event(rdpContext* context, DWORD flags, int x, int y);
#ifdef __cplusplus
}