Use common client channel handling

This commit is contained in:
akallabeth 2022-01-19 11:05:55 +01:00 committed by akallabeth
parent 4ca5078027
commit b2b70fcf6d
12 changed files with 42 additions and 179 deletions

View File

@ -73,23 +73,12 @@ static void android_OnChannelConnectedEventHandler(void* context,
afc = (androidContext*)context;
settings = afc->common.context.settings;
if (strcmp(e->name, RDPGFX_DVC_CHANNEL_NAME) == 0)
{
if (settings->SoftwareGdi)
{
gdi_graphics_pipeline_init(afc->common.context.gdi,
(RdpgfxClientContext*)e->pInterface);
}
else
{
WLog_WARN(TAG, "GFX without software GDI requested. "
" This is not supported, add /gdi:sw");
}
}
else if (strcmp(e->name, CLIPRDR_SVC_CHANNEL_NAME) == 0)
if (strcmp(e->name, CLIPRDR_SVC_CHANNEL_NAME) == 0)
{
android_cliprdr_init(afc, (CliprdrClientContext*)e->pInterface);
}
}
else
freerdp_client_OnChannelConnectedEventHandler(context, e);
}
static void android_OnChannelDisconnectedEventHandler(void* context,
@ -107,23 +96,12 @@ static void android_OnChannelDisconnectedEventHandler(void* context,
afc = (androidContext*)context;
settings = afc->common.context.settings;
if (strcmp(e->name, RDPGFX_DVC_CHANNEL_NAME) == 0)
{
if (settings->SoftwareGdi)
{
gdi_graphics_pipeline_uninit(afc->common.context.gdi,
(RdpgfxClientContext*)e->pInterface);
}
else
{
WLog_WARN(TAG, "GFX without software GDI requested. "
" This is not supported, add /gdi:sw");
}
}
else if (strcmp(e->name, CLIPRDR_SVC_CHANNEL_NAME) == 0)
if (strcmp(e->name, CLIPRDR_SVC_CHANNEL_NAME) == 0)
{
android_cliprdr_uninit(afc, (CliprdrClientContext*)e->pInterface);
}
}
else
freerdp_client_OnChannelDisconnectedEventHandler(context, e);
}
static BOOL android_begin_paint(rdpContext* context)

View File

@ -826,22 +826,15 @@ static void mac_OnChannelConnectedEventHandler(void *context, const ChannelConne
settings = mfc->common.context.settings;
WINPR_ASSERT(settings);
if (strcmp(e->name, RDPEI_DVC_CHANNEL_NAME) == 0)
{
}
else if (strcmp(e->name, RDPGFX_DVC_CHANNEL_NAME) == 0)
{
if (settings->SoftwareGdi)
gdi_graphics_pipeline_init(mfc->common.context.gdi,
(RdpgfxClientContext *)e->pInterface);
}
else if (strcmp(e->name, CLIPRDR_SVC_CHANNEL_NAME) == 0)
if (strcmp(e->name, CLIPRDR_SVC_CHANNEL_NAME) == 0)
{
mac_cliprdr_init(mfc, (CliprdrClientContext *)e->pInterface);
}
else if (strcmp(e->name, ENCOMSP_SVC_CHANNEL_NAME) == 0)
{
}
else
freerdp_client_OnChannelConnectedEventHandler(context, e);
}
static void mac_OnChannelDisconnectedEventHandler(void *context,
@ -856,22 +849,15 @@ static void mac_OnChannelDisconnectedEventHandler(void *context,
settings = mfc->common.context.settings;
WINPR_ASSERT(settings);
if (strcmp(e->name, RDPEI_DVC_CHANNEL_NAME) == 0)
{
}
else if (strcmp(e->name, RDPGFX_DVC_CHANNEL_NAME) == 0)
{
if (settings->SoftwareGdi)
gdi_graphics_pipeline_uninit(mfc->common.context.gdi,
(RdpgfxClientContext *)e->pInterface);
}
else if (strcmp(e->name, CLIPRDR_SVC_CHANNEL_NAME) == 0)
if (strcmp(e->name, CLIPRDR_SVC_CHANNEL_NAME) == 0)
{
mac_cliprdr_uninit(mfc, (CliprdrClientContext *)e->pInterface);
}
else if (strcmp(e->name, ENCOMSP_SVC_CHANNEL_NAME) == 0)
{
}
else
freerdp_client_OnChannelDisconnectedEventHandler(context, e);
}
BOOL mac_pre_connect(freerdp *instance)

View File

@ -80,16 +80,7 @@ void tf_OnChannelConnectedEventHandler(void* context, const ChannelConnectedEven
WINPR_ASSERT(tf);
WINPR_ASSERT(e);
if (strcmp(e->name, RDPEI_DVC_CHANNEL_NAME) == 0)
{
tf->rdpei = (RdpeiClientContext*)e->pInterface;
}
else if (strcmp(e->name, RDPGFX_DVC_CHANNEL_NAME) == 0)
{
RdpgfxClientContext* gfx = (RdpgfxClientContext*)e->pInterface;
gdi_graphics_pipeline_init(tf->common.context.gdi, gfx);
}
else if (strcmp(e->name, RAIL_SVC_CHANNEL_NAME) == 0)
if (strcmp(e->name, RAIL_SVC_CHANNEL_NAME) == 0)
{
}
else if (strcmp(e->name, CLIPRDR_SVC_CHANNEL_NAME) == 0)
@ -102,6 +93,8 @@ void tf_OnChannelConnectedEventHandler(void* context, const ChannelConnectedEven
{
tf_encomsp_init(tf, (EncomspClientContext*)e->pInterface);
}
else
freerdp_client_OnChannelConnectedEventHandler(context, e);
}
void tf_OnChannelDisconnectedEventHandler(void* context, const ChannelDisconnectedEventArgs* e)
@ -111,15 +104,7 @@ void tf_OnChannelDisconnectedEventHandler(void* context, const ChannelDisconnect
WINPR_ASSERT(tf);
WINPR_ASSERT(e);
if (strcmp(e->name, RDPEI_DVC_CHANNEL_NAME) == 0)
{
tf->rdpei = NULL;
}
else if (strcmp(e->name, RDPGFX_DVC_CHANNEL_NAME) == 0)
{
gdi_graphics_pipeline_uninit(tf->common.context.gdi, (RdpgfxClientContext*)e->pInterface);
}
else if (strcmp(e->name, RAIL_SVC_CHANNEL_NAME) == 0)
if (strcmp(e->name, RAIL_SVC_CHANNEL_NAME) == 0)
{
}
else if (strcmp(e->name, CLIPRDR_SVC_CHANNEL_NAME) == 0)
@ -132,4 +117,6 @@ void tf_OnChannelDisconnectedEventHandler(void* context, const ChannelDisconnect
{
tf_encomsp_uninit(tf, (EncomspClientContext*)e->pInterface);
}
else
freerdp_client_OnChannelDisconnectedEventHandler(context, e);
}

View File

@ -33,8 +33,6 @@ typedef struct
rdpClientContext common;
/* Channels */
RdpeiClientContext* rdpei;
RdpgfxClientContext* gfx;
EncomspClientContext* encomsp;
} tfContext;

View File

@ -108,13 +108,8 @@ void wlf_OnChannelConnectedEventHandler(void* context, const ChannelConnectedEve
WINPR_ASSERT(wlf);
WINPR_ASSERT(e);
if (strcmp(e->name, RDPEI_DVC_CHANNEL_NAME) == 0)
if (FALSE)
{
wlf->rdpei = (RdpeiClientContext*)e->pInterface;
}
else if (strcmp(e->name, RDPGFX_DVC_CHANNEL_NAME) == 0)
{
gdi_graphics_pipeline_init(wlf->common.context.gdi, (RdpgfxClientContext*)e->pInterface);
}
else if (strcmp(e->name, RAIL_SVC_CHANNEL_NAME) == 0)
{
@ -131,18 +126,8 @@ void wlf_OnChannelConnectedEventHandler(void* context, const ChannelConnectedEve
{
wlf_disp_init(wlf->disp, (DispClientContext*)e->pInterface);
}
else if (strcmp(e->name, GEOMETRY_DVC_CHANNEL_NAME) == 0)
{
gdi_video_geometry_init(wlf->common.context.gdi, (GeometryClientContext*)e->pInterface);
}
else if (strcmp(e->name, VIDEO_CONTROL_DVC_CHANNEL_NAME) == 0)
{
gdi_video_control_init(wlf->common.context.gdi, (VideoClientContext*)e->pInterface);
}
else if (strcmp(e->name, VIDEO_DATA_DVC_CHANNEL_NAME) == 0)
{
gdi_video_data_init(wlf->common.context.gdi, (VideoClientContext*)e->pInterface);
}
else
freerdp_client_OnChannelConnectedEventHandler(context, e);
}
void wlf_OnChannelDisconnectedEventHandler(void* context, const ChannelDisconnectedEventArgs* e)
@ -152,13 +137,8 @@ void wlf_OnChannelDisconnectedEventHandler(void* context, const ChannelDisconnec
WINPR_ASSERT(wlf);
WINPR_ASSERT(e);
if (strcmp(e->name, RDPEI_DVC_CHANNEL_NAME) == 0)
if (FALSE)
{
wlf->rdpei = NULL;
}
else if (strcmp(e->name, RDPGFX_DVC_CHANNEL_NAME) == 0)
{
gdi_graphics_pipeline_uninit(wlf->common.context.gdi, (RdpgfxClientContext*)e->pInterface);
}
else if (strcmp(e->name, RAIL_SVC_CHANNEL_NAME) == 0)
{
@ -175,16 +155,6 @@ void wlf_OnChannelDisconnectedEventHandler(void* context, const ChannelDisconnec
{
wlf_disp_uninit(wlf->disp, (DispClientContext*)e->pInterface);
}
else if (strcmp(e->name, GEOMETRY_DVC_CHANNEL_NAME) == 0)
{
gdi_video_geometry_uninit(wlf->common.context.gdi, (GeometryClientContext*)e->pInterface);
}
else if (strcmp(e->name, VIDEO_CONTROL_DVC_CHANNEL_NAME) == 0)
{
gdi_video_control_uninit(wlf->common.context.gdi, (VideoClientContext*)e->pInterface);
}
else if (strcmp(e->name, VIDEO_DATA_DVC_CHANNEL_NAME) == 0)
{
gdi_video_data_uninit(wlf->common.context.gdi, (VideoClientContext*)e->pInterface);
}
else
freerdp_client_OnChannelDisconnectedEventHandler(context, e);
}

View File

@ -413,7 +413,7 @@ BOOL wlf_handle_touch_up(freerdp* instance, const UwacTouchUp* ev)
if (!scale_signed_coordinates(instance->context, &x, &y, TRUE))
return FALSE;
RdpeiClientContext* rdpei = wlf->rdpei;
RdpeiClientContext* rdpei = wlf->common.rdpei;
if (wlf->contacts[i].emulate_mouse == TRUE)
{
@ -469,7 +469,7 @@ BOOL wlf_handle_touch_down(freerdp* instance, const UwacTouchDown* ev)
if (!scale_signed_coordinates(instance->context, &x, &y, TRUE))
return FALSE;
RdpeiClientContext* rdpei = wlf->rdpei;
RdpeiClientContext* rdpei = wlf->common.rdpei;
// Emulate mouse click if touch is not possible, like in login screen
if (!rdpei)
@ -532,7 +532,7 @@ BOOL wlf_handle_touch_motion(freerdp* instance, const UwacTouchMotion* ev)
if (!scale_signed_coordinates(instance->context, &x, &y, TRUE))
return FALSE;
RdpeiClientContext* rdpei = ((wlfContext*)instance->context)->rdpei;
RdpeiClientContext* rdpei = ((wlfContext*)instance->context)->common.rdpei;
if (wlf->contacts[i].emulate_mouse == TRUE)
{

View File

@ -55,8 +55,6 @@ typedef struct
BOOL focusing;
/* Channels */
RdpeiClientContext* rdpei;
RdpgfxClientContext* gfx;
EncomspClientContext* encomsp;
wfClipboard* clipboard;
wlfDispContext* disp;

View File

@ -44,18 +44,7 @@ void wf_OnChannelConnectedEventHandler(void* context, const ChannelConnectedEven
settings = wfc->common.context.settings;
WINPR_ASSERT(settings);
if (strcmp(e->name, RDPEI_DVC_CHANNEL_NAME) == 0)
{
}
else if (strcmp(e->name, RDPGFX_DVC_CHANNEL_NAME) == 0)
{
if (!settings->SoftwareGdi)
WLog_WARN(TAG, "Channel " RDPGFX_DVC_CHANNEL_NAME
" does not support hardware acceleration, using fallback.");
gdi_graphics_pipeline_init(wfc->common.context.gdi, (RdpgfxClientContext*)e->pInterface);
}
else if (strcmp(e->name, RAIL_SVC_CHANNEL_NAME) == 0)
if (strcmp(e->name, RAIL_SVC_CHANNEL_NAME) == 0)
{
wf_rail_init(wfc, (RailClientContext*)e->pInterface);
}
@ -70,18 +59,8 @@ void wf_OnChannelConnectedEventHandler(void* context, const ChannelConnectedEven
{
wfc->disp = (DispClientContext*)e->pInterface;
}
else if (strcmp(e->name, GEOMETRY_DVC_CHANNEL_NAME) == 0)
{
gdi_video_geometry_init(wfc->common.context.gdi, (GeometryClientContext*)e->pInterface);
}
else if (strcmp(e->name, VIDEO_CONTROL_DVC_CHANNEL_NAME) == 0)
{
gdi_video_control_init(wfc->common.context.gdi, (VideoClientContext*)e->pInterface);
}
else if (strcmp(e->name, VIDEO_DATA_DVC_CHANNEL_NAME) == 0)
{
gdi_video_data_init(wfc->common.context.gdi, (VideoClientContext*)e->pInterface);
}
else
freerdp_client_OnChannelConnectedEventHandler(context, e);
}
void wf_OnChannelDisconnectedEventHandler(void* context, const ChannelDisconnectedEventArgs* e)
@ -95,14 +74,7 @@ void wf_OnChannelDisconnectedEventHandler(void* context, const ChannelDisconnect
settings = wfc->common.context.settings;
WINPR_ASSERT(settings);
if (strcmp(e->name, RDPEI_DVC_CHANNEL_NAME) == 0)
{
}
else if (strcmp(e->name, RDPGFX_DVC_CHANNEL_NAME) == 0)
{
gdi_graphics_pipeline_uninit(wfc->common.context.gdi, (RdpgfxClientContext*)e->pInterface);
}
else if (strcmp(e->name, RAIL_SVC_CHANNEL_NAME) == 0)
if (strcmp(e->name, RAIL_SVC_CHANNEL_NAME) == 0)
{
wf_rail_uninit(wfc, (RailClientContext*)e->pInterface);
}
@ -117,16 +89,6 @@ void wf_OnChannelDisconnectedEventHandler(void* context, const ChannelDisconnect
{
wfc->disp = NULL;
}
else if (strcmp(e->name, GEOMETRY_DVC_CHANNEL_NAME) == 0)
{
gdi_video_geometry_uninit(wfc->common.context.gdi, (GeometryClientContext*)e->pInterface);
}
else if (strcmp(e->name, VIDEO_CONTROL_DVC_CHANNEL_NAME) == 0)
{
gdi_video_control_uninit(wfc->common.context.gdi, (VideoClientContext*)e->pInterface);
}
else if (strcmp(e->name, VIDEO_DATA_DVC_CHANNEL_NAME) == 0)
{
gdi_video_data_uninit(wfc->common.context.gdi, (VideoClientContext*)e->pInterface);
}
else
freerdp_client_OnChannelDisconnectedEventHandler(context, e);
}

View File

@ -46,7 +46,6 @@
#endif
#include <freerdp/log.h>
#include <freerdp/event.h>
#include <freerdp/freerdp.h>
#include <freerdp/constants.h>

View File

@ -49,9 +49,8 @@ void xf_OnChannelConnectedEventHandler(void* context, const ChannelConnectedEven
settings = xfc->common.context.settings;
WINPR_ASSERT(settings);
if (strcmp(e->name, RDPEI_DVC_CHANNEL_NAME) == 0)
if (FALSE)
{
xfc->rdpei = (RdpeiClientContext*)e->pInterface;
}
#if defined(CHANNEL_TSMF_CLIENT)
else if (strcmp(e->name, TSMF_DVC_CHANNEL_NAME) == 0)
@ -79,10 +78,6 @@ void xf_OnChannelConnectedEventHandler(void* context, const ChannelConnectedEven
{
xf_disp_init(xfc->xfDisp, (DispClientContext*)e->pInterface);
}
else if (strcmp(e->name, GEOMETRY_DVC_CHANNEL_NAME) == 0)
{
gdi_video_geometry_init(xfc->common.context.gdi, (GeometryClientContext*)e->pInterface);
}
else if (strcmp(e->name, VIDEO_CONTROL_DVC_CHANNEL_NAME) == 0)
{
if (settings->SoftwareGdi)
@ -90,10 +85,8 @@ void xf_OnChannelConnectedEventHandler(void* context, const ChannelConnectedEven
else
xf_video_control_init(xfc, (VideoClientContext*)e->pInterface);
}
else if (strcmp(e->name, VIDEO_DATA_DVC_CHANNEL_NAME) == 0)
{
gdi_video_data_init(xfc->common.context.gdi, (VideoClientContext*)e->pInterface);
}
else
freerdp_client_OnChannelConnectedEventHandler(context, e);
}
void xf_OnChannelDisconnectedEventHandler(void* context, const ChannelDisconnectedEventArgs* e)
@ -108,9 +101,8 @@ void xf_OnChannelDisconnectedEventHandler(void* context, const ChannelDisconnect
settings = xfc->common.context.settings;
WINPR_ASSERT(settings);
if (strcmp(e->name, RDPEI_DVC_CHANNEL_NAME) == 0)
if (FALSE)
{
xfc->rdpei = NULL;
}
else if (strcmp(e->name, DISP_DVC_CHANNEL_NAME) == 0)
{
@ -138,10 +130,6 @@ void xf_OnChannelDisconnectedEventHandler(void* context, const ChannelDisconnect
{
xf_encomsp_uninit(xfc, (EncomspClientContext*)e->pInterface);
}
else if (strcmp(e->name, GEOMETRY_DVC_CHANNEL_NAME) == 0)
{
gdi_video_geometry_uninit(xfc->common.context.gdi, (GeometryClientContext*)e->pInterface);
}
else if (strcmp(e->name, VIDEO_CONTROL_DVC_CHANNEL_NAME) == 0)
{
if (settings->SoftwareGdi)
@ -149,8 +137,6 @@ void xf_OnChannelDisconnectedEventHandler(void* context, const ChannelDisconnect
else
xf_video_control_uninit(xfc, (VideoClientContext*)e->pInterface);
}
else if (strcmp(e->name, VIDEO_DATA_DVC_CHANNEL_NAME) == 0)
{
gdi_video_data_uninit(xfc->common.context.gdi, (VideoClientContext*)e->pInterface);
}
else
freerdp_client_OnChannelDisconnectedEventHandler(context, e);
}

View File

@ -561,7 +561,7 @@ static int xf_input_touch_remote(xfContext* xfc, XIDeviceEvent* event, int evtyp
int x, y;
int touchId;
int contactId;
RdpeiClientContext* rdpei = xfc->rdpei;
RdpeiClientContext* rdpei = xfc->common.rdpei;
if (!rdpei)
return 0;

View File

@ -271,7 +271,6 @@ struct xf_context
xfClipboard* clipboard;
CliprdrClientContext* cliprdr;
xfVideoContext* xfVideo;
RdpeiClientContext* rdpei;
EncomspClientContext* encomsp;
xfDispContext* xfDisp;