struct rdp_input
{
void* rdp;
+ void* param1;
+ void* param2;
+
pcSynchronizeEvent SynchronizeEvent;
pcKeyboardEvent KeyboardEvent;
pcUnicodeKeyboardEvent UnicodeKeyboardEvent;
#include <freerdp/api.h>
#include <freerdp/types.h>
#include <freerdp/settings.h>
+#include <freerdp/input.h>
+#include <freerdp/update.h>
typedef boolean (*psPeerInitialize)(freerdp_peer* client);
typedef boolean (*psPeerGetFileDescriptor)(freerdp_peer* client, void** rfds, int* rcount);
void* param3;
void* param4;
+ rdpInput* input;
+ rdpUpdate* update;
rdpSettings* settings;
psPeerInitialize Initialize;
instance->GetFileDescriptor = freerdp_get_fds;
instance->CheckFileDescriptor = freerdp_check_fds;
instance->SendChannelData = freerdp_send_channel_data;
+
+ input_register_client_callbacks(rdp->input);
}
return instance;
rdp_send_client_fastpath_input_pdu(input->rdp, s);
}
+void input_register_client_callbacks(rdpInput* input)
+{
+ rdpRdp* rdp = (rdpRdp*)input->rdp;
+
+ if (rdp->settings->fastpath_input)
+ {
+ input->SynchronizeEvent = input_send_fastpath_synchronize_event;
+ input->KeyboardEvent = input_send_fastpath_keyboard_event;
+ input->UnicodeKeyboardEvent = input_send_fastpath_unicode_keyboard_event;
+ input->MouseEvent = input_send_fastpath_mouse_event;
+ input->ExtendedMouseEvent = input_send_fastpath_extended_mouse_event;
+ }
+ else
+ {
+ input->SynchronizeEvent = input_send_synchronize_event;
+ input->KeyboardEvent = input_send_keyboard_event;
+ input->UnicodeKeyboardEvent = input_send_unicode_keyboard_event;
+ input->MouseEvent = input_send_mouse_event;
+ input->ExtendedMouseEvent = input_send_extended_mouse_event;
+ }
+}
+
rdpInput* input_new(rdpRdp* rdp)
{
rdpInput* input;
if (input != NULL)
{
input->rdp = rdp;
- if (rdp->settings->fastpath_input)
- {
- input->SynchronizeEvent = input_send_fastpath_synchronize_event;
- input->KeyboardEvent = input_send_fastpath_keyboard_event;
- input->UnicodeKeyboardEvent = input_send_fastpath_unicode_keyboard_event;
- input->MouseEvent = input_send_fastpath_mouse_event;
- input->ExtendedMouseEvent = input_send_fastpath_extended_mouse_event;
- }
- else
- {
- input->SynchronizeEvent = input_send_synchronize_event;
- input->KeyboardEvent = input_send_keyboard_event;
- input->UnicodeKeyboardEvent = input_send_unicode_keyboard_event;
- input->MouseEvent = input_send_mouse_event;
- input->ExtendedMouseEvent = input_send_extended_mouse_event;
- }
}
return input;
void input_send_fastpath_mouse_event(rdpInput* input, uint16 flags, uint16 x, uint16 y);
void input_send_fastpath_extended_mouse_event(rdpInput* input, uint16 flags, uint16 x, uint16 y);
+void input_register_client_callbacks(rdpInput* input);
+
rdpInput* input_new(rdpRdp* rdp);
void input_free(rdpInput* input);
client->peer = (void*)peer;
client->settings = peer->rdp->settings;
+ client->input = peer->rdp->input;
+ client->update = peer->rdp->update;
transport_attach(peer->rdp->transport, sockfd);
return True;
}
+void test_peer_synchronize_event(rdpInput* input, uint32 flags)
+{
+ printf("Client sent a synchronize event\n");
+}
+
+void test_peer_keyboard_event(rdpInput* input, uint16 flags, uint16 code)
+{
+ printf("Client sent a keyboard event (flags:0x%X code:0x%X)\n", flags, code);
+}
+
+void test_peer_unicode_keyboard_event(rdpInput* input, uint16 code)
+{
+ printf("Client sent a unicode keyboard event (code:0x%X)\n", code);
+}
+
+void test_peer_mouse_event(rdpInput* input, uint16 flags, uint16 x, uint16 y)
+{
+ printf("Client sent a mouse event (flags:0x%X pos:%d,%d)\n", flags, x, y);
+}
+
+void test_peer_extended_mouse_event(rdpInput* input, uint16 flags, uint16 x, uint16 y)
+{
+ printf("Client sent an extended mouse event (flags:0x%X pos:%d,%d)\n", flags, x, y);
+}
+
static void* test_peer_mainloop(void* arg)
{
freerdp_peer* client = (freerdp_peer*)arg;
printf("We've got a client %s\n", client->settings->hostname);
+ /* Initialize the real server settings here */
client->settings->cert_file = xstrdup("server.crt");
client->settings->privatekey_file = xstrdup("server.key");
client->settings->nla_security = False;
client->PostConnect = test_peer_post_connect;
+
+ client->input->param1 = client;
+ client->input->SynchronizeEvent = test_peer_synchronize_event;
+ client->input->KeyboardEvent = test_peer_keyboard_event;
+ client->input->UnicodeKeyboardEvent = test_peer_unicode_keyboard_event;
+ client->input->MouseEvent = test_peer_mouse_event;
+ client->input->ExtendedMouseEvent = test_peer_extended_mouse_event;
+
client->Initialize(client);
while (1)