libfreerdp-core: add client interface
authorMarc-André Moreau <marcandre.moreau@gmail.com>
Mon, 8 Apr 2013 19:37:56 +0000 (15:37 -0400)
committerMarc-André Moreau <marcandre.moreau@gmail.com>
Mon, 8 Apr 2013 19:37:56 +0000 (15:37 -0400)
client/X11/xf_interface.c
client/X11/xf_interface.h
include/freerdp/client.h [new file with mode: 0644]
include/freerdp/freerdp.h
include/freerdp/input.h
libfreerdp/core/freerdp.c

index 9ce38ea..3bf43ef 100644 (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);
index edd34b1..a81265d 100644 (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;
diff --git a/include/freerdp/client.h b/include/freerdp/client.h
new file mode 100644 (file)
index 0000000..7625f44
--- /dev/null
@@ -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 */
index 6b9aa53..0a3beb3 100644 (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.
index f437dde..a08637e 100644 (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 */
index bee2550..173c472 100644 (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;