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
41WINPR_ATTR_NODISCARD
42static UINT sf_peer_ainput_mouse_event(WINPR_ATTR_UNUSED ainput_server_context* context,
43 UINT64 timestamp, UINT64 flags, INT32 x, INT32 y)
44{
45 /* TODO: Implement */
46 WINPR_ASSERT(context);
47
48 WLog_WARN(TAG, "not implemented: 0x%08" PRIx64 ", 0x%08" PRIx64 ", %" PRId32 "x%" PRId32,
49 timestamp, flags, x, y);
50 return CHANNEL_RC_OK;
51}
52
53void sf_peer_ainput_init(testPeerContext* context)
54{
55 WINPR_ASSERT(context);
56
57 context->ainput = ainput_server_context_new(context->vcm);
58 WINPR_ASSERT(context->ainput);
59
60 context->ainput->rdpcontext = &context->_p;
61 context->ainput->data = context;
62
63 context->ainput->MouseEvent = sf_peer_ainput_mouse_event;
64}
65
66BOOL sf_peer_ainput_start(testPeerContext* context)
67{
68 if (!context || !context->ainput || !context->ainput->Open)
69 return FALSE;
70
71 return context->ainput->Open(context->ainput) == CHANNEL_RC_OK;
72}
73
74BOOL sf_peer_ainput_stop(testPeerContext* context)
75{
76 if (!context || !context->ainput || !context->ainput->Close)
77 return FALSE;
78
79 return context->ainput->Close(context->ainput) == CHANNEL_RC_OK;
80}
81
82BOOL sf_peer_ainput_running(testPeerContext* context)
83{
84 if (!context || !context->ainput || !context->ainput->IsOpen)
85 return FALSE;
86
87 return context->ainput->IsOpen(context->ainput);
88}
89
90void sf_peer_ainput_uninit(testPeerContext* context)
91{
92 ainput_server_context_free(context->ainput);
93}