FreeRDP
Loading...
Searching...
No Matches
SDL2/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
32void 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 clip->custom = context;
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
58void 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(nin): 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}
84
85void sdl_OnUserNotificationEventHandler(void* context, const UserNotificationEventArgs* e)
86{
87 WINPR_UNUSED(context);
88 WINPR_ASSERT(e);
89 WINPR_ASSERT(e->e.Sender);
90
91 if (e->cancelPreviousNotification)
92 return;
93
94 WINPR_ASSERT(e->message);
95 auto parent = SDL_GetMouseFocus();
96 if (!parent)
97 parent = SDL_GetKeyboardFocus();
98 SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_INFORMATION, e->e.Sender, e->message, parent);
99}