libfreerdp-core: add client interface

This commit is contained in:
Marc-André Moreau 2013-04-08 15:37:56 -04:00
parent 3f626f8a20
commit 68e253e209
6 changed files with 58 additions and 19 deletions

View File

@ -830,8 +830,8 @@ BOOL xf_post_connect(freerdp* instance)
xf_cliprdr_init(xfi, channels);
if (xfi->ui.OnResizeWindow)
xfi->ui.OnResizeWindow(instance, settings->DesktopWidth, settings->DesktopHeight);
if (xfi->client->OnResizeWindow)
xfi->client->OnResizeWindow(instance, settings->DesktopWidth, settings->DesktopHeight);
return TRUE;
}
@ -1491,8 +1491,10 @@ xfInfo* xf_new(HANDLE hInstance, HANDLE hWndParent, int argc, char** argv)
ZeroMemory(xfi, sizeof(xfInfo));
((xfContext*) instance->context)->xfi = xfi;
xfi->instance = instance;
settings = instance->settings;
xfi->client = instance->context->client;
status = freerdp_client_parse_command_line_arguments(instance->context->argc,
instance->context->argv, settings);

View File

@ -82,25 +82,13 @@ struct xf_context
};
typedef struct xf_context xfContext;
/**
* User Interface Events
*/
typedef void (*pOnResizeWindow)(freerdp* instance, int width, int height);
struct rdp_ui
{
pOnResizeWindow OnResizeWindow;
};
typedef struct rdp_ui rdpUi;
struct xf_info
{
freerdp* instance;
xfContext* context;
rdpContext* _context;
rdpUi ui;
rdpClient* client;
GC gc;
int bpp;

43
include/freerdp/client.h Normal file
View File

@ -0,0 +1,43 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* Client Interface
*
* Copyright 2013 Marc-Andre Moreau <marcandre.moreau@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef FREERDP_CLIENT_H
#define FREERDP_CLIENT_H
typedef struct rdp_client rdpClient;
#include <freerdp/api.h>
#include <freerdp/freerdp.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef void (*pOnResizeWindow)(freerdp* instance, int width, int height);
struct rdp_client
{
pOnResizeWindow OnResizeWindow;
};
#ifdef __cplusplus
}
#endif
#endif /* FREERDP_CLIENT_H */

View File

@ -39,6 +39,8 @@ typedef struct rdp_freerdp_peer freerdp_peer;
#include <winpr/stream.h>
#include <freerdp/client.h>
#include <freerdp/input.h>
#include <freerdp/update.h>
#include <freerdp/message.h>
@ -104,7 +106,8 @@ struct rdp_context
rdpInput* input; /* 38 */
rdpUpdate* update; /* 39 */
rdpSettings* settings; /* 40 */
UINT32 paddingC[64 - 41]; /* 41 */
rdpClient* client; /* 41 */
UINT32 paddingC[64 - 42]; /* 42 */
};
/** Defines the options for a given instance of RDP connection.

View File

@ -39,9 +39,9 @@ typedef struct rdp_input rdpInput;
#define PTR_FLAGS_WHEEL_NEGATIVE 0x0100
#define PTR_FLAGS_MOVE 0x0800
#define PTR_FLAGS_DOWN 0x8000
#define PTR_FLAGS_BUTTON1 0x1000 //left
#define PTR_FLAGS_BUTTON2 0x2000 //right
#define PTR_FLAGS_BUTTON3 0x4000 //middle
#define PTR_FLAGS_BUTTON1 0x1000 /* left */
#define PTR_FLAGS_BUTTON2 0x2000 /* right */
#define PTR_FLAGS_BUTTON3 0x4000 /* middle */
#define WheelRotationMask 0x01FF
/* Extended Pointer Flags */

View File

@ -314,6 +314,9 @@ void freerdp_context_new(freerdp* instance)
instance->context->update = instance->update;
instance->context->settings = instance->settings;
instance->context->client = (rdpContext*) malloc(sizeof(rdpClient));
ZeroMemory(instance->context->client, sizeof(rdpClient));
instance->update->context = instance->context;
instance->update->pointer->context = instance->context;
instance->update->primary->context = instance->context;