FreeRDP
SDL3/sdl_channels.cpp
1 
20 #include <freerdp/config.h>
21 
22 #include <winpr/assert.h>
23 
24 #include <freerdp/client/rail.h>
25 #include <freerdp/client/cliprdr.h>
26 #include <freerdp/client/disp.h>
27 
28 #include "sdl_channels.hpp"
29 #include "sdl_freerdp.hpp"
30 #include "sdl_disp.hpp"
31 
32 void sdl_OnChannelConnectedEventHandler(void* context, const ChannelConnectedEventArgs* e)
33 {
34  auto sdl = get_context(context);
35 
36  WINPR_ASSERT(sdl);
37  WINPR_ASSERT(e);
38 
39  if (strcmp(e->name, RAIL_SVC_CHANNEL_NAME) == 0)
40  {
41  }
42  else if (strcmp(e->name, CLIPRDR_SVC_CHANNEL_NAME) == 0)
43  {
44  auto clip = reinterpret_cast<CliprdrClientContext*>(e->pInterface);
45  WINPR_ASSERT(clip);
46  sdl->clip.init(clip);
47  }
48  else if (strcmp(e->name, DISP_DVC_CHANNEL_NAME) == 0)
49  {
50  auto disp = reinterpret_cast<DispClientContext*>(e->pInterface);
51  WINPR_ASSERT(disp);
52  sdl->disp.init(disp);
53  }
54  else
55  freerdp_client_OnChannelConnectedEventHandler(context, e);
56 }
57 
58 void sdl_OnChannelDisconnectedEventHandler(void* context, const ChannelDisconnectedEventArgs* e)
59 {
60  auto sdl = get_context(context);
61 
62  WINPR_ASSERT(sdl);
63  WINPR_ASSERT(e);
64 
65  // TODO: Set resizeable depending on disp channel and /dynamic-resolution
66  if (strcmp(e->name, RAIL_SVC_CHANNEL_NAME) == 0)
67  {
68  }
69  else if (strcmp(e->name, CLIPRDR_SVC_CHANNEL_NAME) == 0)
70  {
71  auto clip = reinterpret_cast<CliprdrClientContext*>(e->pInterface);
72  WINPR_ASSERT(clip);
73  clip->custom = nullptr;
74  }
75  else if (strcmp(e->name, DISP_DVC_CHANNEL_NAME) == 0)
76  {
77  auto disp = reinterpret_cast<DispClientContext*>(e->pInterface);
78  WINPR_ASSERT(disp);
79  sdl->disp.uninit(disp);
80  }
81  else
82  freerdp_client_OnChannelDisconnectedEventHandler(context, e);
83 }