server: add input callbacks.
This commit is contained in:
parent
ab7a53ea51
commit
57ac9a59eb
@ -59,6 +59,9 @@ typedef void (*pcExtendedMouseEvent)(rdpInput* input, uint16 flags, uint16 x, ui
|
||||
struct rdp_input
|
||||
{
|
||||
void* rdp;
|
||||
void* param1;
|
||||
void* param2;
|
||||
|
||||
pcSynchronizeEvent SynchronizeEvent;
|
||||
pcKeyboardEvent KeyboardEvent;
|
||||
pcUnicodeKeyboardEvent UnicodeKeyboardEvent;
|
||||
|
@ -25,6 +25,8 @@ typedef struct rdp_freerdp_peer freerdp_peer;
|
||||
#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);
|
||||
@ -40,6 +42,8 @@ struct rdp_freerdp_peer
|
||||
void* param3;
|
||||
void* param4;
|
||||
|
||||
rdpInput* input;
|
||||
rdpUpdate* update;
|
||||
rdpSettings* settings;
|
||||
|
||||
psPeerInitialize Initialize;
|
||||
|
@ -88,6 +88,8 @@ freerdp* freerdp_new()
|
||||
instance->GetFileDescriptor = freerdp_get_fds;
|
||||
instance->CheckFileDescriptor = freerdp_check_fds;
|
||||
instance->SendChannelData = freerdp_send_channel_data;
|
||||
|
||||
input_register_client_callbacks(rdp->input);
|
||||
}
|
||||
|
||||
return instance;
|
||||
|
@ -175,15 +175,10 @@ void input_send_fastpath_extended_mouse_event(rdpInput* input, uint16 flags, uin
|
||||
rdp_send_client_fastpath_input_pdu(input->rdp, s);
|
||||
}
|
||||
|
||||
rdpInput* input_new(rdpRdp* rdp)
|
||||
void input_register_client_callbacks(rdpInput* input)
|
||||
{
|
||||
rdpInput* input;
|
||||
rdpRdp* rdp = (rdpRdp*)input->rdp;
|
||||
|
||||
input = (rdpInput*) xzalloc(sizeof(rdpInput));
|
||||
|
||||
if (input != NULL)
|
||||
{
|
||||
input->rdp = rdp;
|
||||
if (rdp->settings->fastpath_input)
|
||||
{
|
||||
input->SynchronizeEvent = input_send_fastpath_synchronize_event;
|
||||
@ -200,6 +195,17 @@ rdpInput* input_new(rdpRdp* rdp)
|
||||
input->MouseEvent = input_send_mouse_event;
|
||||
input->ExtendedMouseEvent = input_send_extended_mouse_event;
|
||||
}
|
||||
}
|
||||
|
||||
rdpInput* input_new(rdpRdp* rdp)
|
||||
{
|
||||
rdpInput* input;
|
||||
|
||||
input = (rdpInput*) xzalloc(sizeof(rdpInput));
|
||||
|
||||
if (input != NULL)
|
||||
{
|
||||
input->rdp = rdp;
|
||||
}
|
||||
|
||||
return input;
|
||||
|
@ -60,6 +60,8 @@ void input_send_fastpath_unicode_keyboard_event(rdpInput* input, uint16 code);
|
||||
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);
|
||||
|
||||
|
@ -225,6 +225,8 @@ freerdp_peer* freerdp_peer_new(int sockfd)
|
||||
|
||||
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);
|
||||
|
||||
|
@ -49,6 +49,31 @@ boolean test_peer_post_connect(freerdp_peer* client)
|
||||
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;
|
||||
@ -63,11 +88,20 @@ static void* test_peer_mainloop(void* 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)
|
||||
|
Loading…
Reference in New Issue
Block a user