20#include <freerdp/config.h>
22#include <winpr/assert.h>
24#include <freerdp/client/rail.h>
25#include <freerdp/client/cliprdr.h>
26#include <freerdp/client/disp.h>
28#include "sdl_channels.hpp"
29#include "sdl_context.hpp"
30#include "sdl_disp.hpp"
32void sdl_OnChannelConnectedEventHandler(
void* context,
const ChannelConnectedEventArgs* e)
34 auto sdl = get_context(context);
39 if (strcmp(e->name, RAIL_SVC_CHANNEL_NAME) == 0)
42 else if (strcmp(e->name, CLIPRDR_SVC_CHANNEL_NAME) == 0)
44 auto clip =
reinterpret_cast<CliprdrClientContext*
>(e->pInterface);
47 if (!sdl->getClipboardChannelContext().init(clip))
48 WLog_Print(sdl->getWLog(), WLOG_WARN,
"Failed to initialize clipboard channel");
50 else if (strcmp(e->name, DISP_DVC_CHANNEL_NAME) == 0)
52 auto disp =
reinterpret_cast<DispClientContext*
>(e->pInterface);
55 if (!sdl->getDisplayChannelContext().init(disp))
56 WLog_Print(sdl->getWLog(), WLOG_WARN,
"Failed to initialize display channel");
59 freerdp_client_OnChannelConnectedEventHandler(context, e);
62void sdl_OnChannelDisconnectedEventHandler(
void* context,
const ChannelDisconnectedEventArgs* e)
64 auto sdl = get_context(context);
70 if (strcmp(e->name, RAIL_SVC_CHANNEL_NAME) == 0)
73 else if (strcmp(e->name, CLIPRDR_SVC_CHANNEL_NAME) == 0)
75 auto clip =
reinterpret_cast<CliprdrClientContext*
>(e->pInterface);
78 if (!sdl->getClipboardChannelContext().uninit(clip))
79 WLog_Print(sdl->getWLog(), WLOG_WARN,
"Failed to uninitialize clipboard channel");
80 clip->custom =
nullptr;
82 else if (strcmp(e->name, DISP_DVC_CHANNEL_NAME) == 0)
84 auto disp =
reinterpret_cast<DispClientContext*
>(e->pInterface);
87 if (!sdl->getDisplayChannelContext().uninit(disp))
88 WLog_Print(sdl->getWLog(), WLOG_WARN,
"Failed to uninitialize display channel");
89 disp->custom =
nullptr;
92 freerdp_client_OnChannelDisconnectedEventHandler(context, e);