FreeRDP
Loading...
Searching...
No Matches
sf_ainput.c
1
22#include <freerdp/config.h>
23
24#include <winpr/assert.h>
25
26#include "sfreerdp.h"
27
28#include "sf_ainput.h"
29
30#include <freerdp/server/server-common.h>
31#include <freerdp/server/ainput.h>
32
33#include <freerdp/log.h>
34#define TAG SERVER_TAG("sample.ainput")
35
41static UINT sf_peer_ainput_mouse_event(WINPR_ATTR_UNUSED ainput_server_context* context,
42 UINT64 timestamp, UINT64 flags, INT32 x, INT32 y)
43{
44 /* TODO: Implement */
45 WINPR_ASSERT(context);
46
47 WLog_WARN(TAG, "not implemented: 0x%08" PRIx64 ", 0x%08" PRIx64 ", %" PRId32 "x%" PRId32,
48 timestamp, flags, x, y);
49 return CHANNEL_RC_OK;
50}
51
52void sf_peer_ainput_init(testPeerContext* context)
53{
54 WINPR_ASSERT(context);
55
56 context->ainput = ainput_server_context_new(context->vcm);
57 WINPR_ASSERT(context->ainput);
58
59 context->ainput->rdpcontext = &context->_p;
60 context->ainput->data = context;
61
62 context->ainput->MouseEvent = sf_peer_ainput_mouse_event;
63}
64
65BOOL sf_peer_ainput_start(testPeerContext* context)
66{
67 if (!context || !context->ainput || !context->ainput->Open)
68 return FALSE;
69
70 return context->ainput->Open(context->ainput) == CHANNEL_RC_OK;
71}
72
73BOOL sf_peer_ainput_stop(testPeerContext* context)
74{
75 if (!context || !context->ainput || !context->ainput->Close)
76 return FALSE;
77
78 return context->ainput->Close(context->ainput) == CHANNEL_RC_OK;
79}
80
81BOOL sf_peer_ainput_running(testPeerContext* context)
82{
83 if (!context || !context->ainput || !context->ainput->IsOpen)
84 return FALSE;
85
86 return context->ainput->IsOpen(context->ainput);
87}
88
89void sf_peer_ainput_uninit(testPeerContext* context)
90{
91 ainput_server_context_free(context->ainput);
92}