2013-05-14 03:17:25 +04:00
|
|
|
/**
|
|
|
|
* FreeRDP: A Remote Desktop Protocol Implementation
|
|
|
|
* X11 Client Channels
|
|
|
|
*
|
|
|
|
* Copyright 2013 Marc-Andre Moreau <marcandre.moreau@gmail.com>
|
|
|
|
*
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
|
|
|
|
2022-02-16 13:20:38 +03:00
|
|
|
#include <freerdp/config.h>
|
2013-05-14 03:17:25 +04:00
|
|
|
|
2022-01-19 11:27:39 +03:00
|
|
|
#include <winpr/assert.h>
|
2018-02-08 10:44:46 +03:00
|
|
|
#include <freerdp/gdi/video.h>
|
2013-05-14 03:17:25 +04:00
|
|
|
#include "xf_channels.h"
|
|
|
|
|
2013-06-15 21:41:05 +04:00
|
|
|
#include "xf_client.h"
|
2013-05-14 03:17:25 +04:00
|
|
|
#include "xfreerdp.h"
|
|
|
|
|
2014-06-05 02:03:25 +04:00
|
|
|
#include "xf_gfx.h"
|
2020-02-25 17:21:16 +03:00
|
|
|
#if defined(CHANNEL_TSMF_CLIENT)
|
2014-11-11 00:23:04 +03:00
|
|
|
#include "xf_tsmf.h"
|
2020-02-25 17:21:16 +03:00
|
|
|
#endif
|
2014-11-12 00:35:30 +03:00
|
|
|
#include "xf_rail.h"
|
2014-10-15 06:24:07 +04:00
|
|
|
#include "xf_cliprdr.h"
|
2017-11-29 12:26:04 +03:00
|
|
|
#include "xf_disp.h"
|
2017-12-15 13:15:24 +03:00
|
|
|
#include "xf_video.h"
|
2014-06-05 02:03:25 +04:00
|
|
|
|
2022-01-19 11:08:02 +03:00
|
|
|
void xf_OnChannelConnectedEventHandler(void* context, const ChannelConnectedEventArgs* e)
|
2013-05-14 03:17:25 +04:00
|
|
|
{
|
2019-11-06 17:24:51 +03:00
|
|
|
xfContext* xfc = (xfContext*)context;
|
2021-10-18 11:18:21 +03:00
|
|
|
rdpSettings* settings;
|
|
|
|
|
|
|
|
WINPR_ASSERT(xfc);
|
|
|
|
WINPR_ASSERT(e);
|
|
|
|
WINPR_ASSERT(e->name);
|
|
|
|
|
2022-01-19 11:27:39 +03:00
|
|
|
settings = xfc->common.context.settings;
|
2021-10-18 11:18:21 +03:00
|
|
|
WINPR_ASSERT(settings);
|
2013-05-14 03:17:25 +04:00
|
|
|
|
2022-01-19 13:05:55 +03:00
|
|
|
if (FALSE)
|
2013-05-14 03:17:25 +04:00
|
|
|
{
|
|
|
|
}
|
2020-02-25 17:21:16 +03:00
|
|
|
#if defined(CHANNEL_TSMF_CLIENT)
|
2014-11-11 00:23:04 +03:00
|
|
|
else if (strcmp(e->name, TSMF_DVC_CHANNEL_NAME) == 0)
|
|
|
|
{
|
2019-11-06 17:24:51 +03:00
|
|
|
xf_tsmf_init(xfc, (TsmfClientContext*)e->pInterface);
|
2014-11-11 00:23:04 +03:00
|
|
|
}
|
2020-02-25 17:21:16 +03:00
|
|
|
#endif
|
2014-06-05 02:03:25 +04:00
|
|
|
else if (strcmp(e->name, RDPGFX_DVC_CHANNEL_NAME) == 0)
|
|
|
|
{
|
2019-11-06 17:24:51 +03:00
|
|
|
xf_graphics_pipeline_init(xfc, (RdpgfxClientContext*)e->pInterface);
|
2014-06-05 02:03:25 +04:00
|
|
|
}
|
2014-11-12 00:35:30 +03:00
|
|
|
else if (strcmp(e->name, RAIL_SVC_CHANNEL_NAME) == 0)
|
|
|
|
{
|
2019-11-06 17:24:51 +03:00
|
|
|
xf_rail_init(xfc, (RailClientContext*)e->pInterface);
|
2014-11-12 00:35:30 +03:00
|
|
|
}
|
2014-10-15 06:24:07 +04:00
|
|
|
else if (strcmp(e->name, CLIPRDR_SVC_CHANNEL_NAME) == 0)
|
|
|
|
{
|
2019-11-06 17:24:51 +03:00
|
|
|
xf_cliprdr_init(xfc, (CliprdrClientContext*)e->pInterface);
|
2014-10-15 06:24:07 +04:00
|
|
|
}
|
2014-07-01 01:17:06 +04:00
|
|
|
else if (strcmp(e->name, ENCOMSP_SVC_CHANNEL_NAME) == 0)
|
|
|
|
{
|
2019-11-06 17:24:51 +03:00
|
|
|
xf_encomsp_init(xfc, (EncomspClientContext*)e->pInterface);
|
2014-07-01 01:17:06 +04:00
|
|
|
}
|
2017-11-29 12:26:04 +03:00
|
|
|
else if (strcmp(e->name, DISP_DVC_CHANNEL_NAME) == 0)
|
|
|
|
{
|
2018-09-24 17:44:25 +03:00
|
|
|
xf_disp_init(xfc->xfDisp, (DispClientContext*)e->pInterface);
|
2017-11-29 12:26:04 +03:00
|
|
|
}
|
2017-12-15 13:15:24 +03:00
|
|
|
else if (strcmp(e->name, VIDEO_CONTROL_DVC_CHANNEL_NAME) == 0)
|
|
|
|
{
|
2021-10-18 11:18:21 +03:00
|
|
|
if (settings->SoftwareGdi)
|
2022-01-19 11:27:39 +03:00
|
|
|
gdi_video_control_init(xfc->common.context.gdi, (VideoClientContext*)e->pInterface);
|
2021-10-18 11:18:21 +03:00
|
|
|
else
|
|
|
|
xf_video_control_init(xfc, (VideoClientContext*)e->pInterface);
|
2017-12-15 13:15:24 +03:00
|
|
|
}
|
2022-01-19 13:05:55 +03:00
|
|
|
else
|
|
|
|
freerdp_client_OnChannelConnectedEventHandler(context, e);
|
2013-05-14 03:17:25 +04:00
|
|
|
}
|
|
|
|
|
2022-01-19 11:08:02 +03:00
|
|
|
void xf_OnChannelDisconnectedEventHandler(void* context, const ChannelDisconnectedEventArgs* e)
|
2013-05-14 03:17:25 +04:00
|
|
|
{
|
2019-11-06 17:24:51 +03:00
|
|
|
xfContext* xfc = (xfContext*)context;
|
2021-10-18 11:18:21 +03:00
|
|
|
rdpSettings* settings;
|
|
|
|
|
|
|
|
WINPR_ASSERT(xfc);
|
|
|
|
WINPR_ASSERT(e);
|
|
|
|
WINPR_ASSERT(e->name);
|
|
|
|
|
2022-01-19 11:27:39 +03:00
|
|
|
settings = xfc->common.context.settings;
|
2021-10-18 11:18:21 +03:00
|
|
|
WINPR_ASSERT(settings);
|
2013-07-11 19:53:15 +04:00
|
|
|
|
2022-01-19 13:05:55 +03:00
|
|
|
if (FALSE)
|
2014-06-20 21:52:13 +04:00
|
|
|
{
|
|
|
|
}
|
2018-09-24 17:44:25 +03:00
|
|
|
else if (strcmp(e->name, DISP_DVC_CHANNEL_NAME) == 0)
|
|
|
|
{
|
|
|
|
xf_disp_uninit(xfc->xfDisp, (DispClientContext*)e->pInterface);
|
|
|
|
}
|
2020-02-25 17:21:16 +03:00
|
|
|
#if defined(CHANNEL_TSMF_CLIENT)
|
2014-11-11 00:23:04 +03:00
|
|
|
else if (strcmp(e->name, TSMF_DVC_CHANNEL_NAME) == 0)
|
|
|
|
{
|
2019-11-06 17:24:51 +03:00
|
|
|
xf_tsmf_uninit(xfc, (TsmfClientContext*)e->pInterface);
|
2014-11-11 00:23:04 +03:00
|
|
|
}
|
2020-02-25 17:21:16 +03:00
|
|
|
#endif
|
2014-06-20 21:52:13 +04:00
|
|
|
else if (strcmp(e->name, RDPGFX_DVC_CHANNEL_NAME) == 0)
|
|
|
|
{
|
2019-11-06 17:24:51 +03:00
|
|
|
xf_graphics_pipeline_uninit(xfc, (RdpgfxClientContext*)e->pInterface);
|
2014-06-20 21:52:13 +04:00
|
|
|
}
|
2014-11-12 00:35:30 +03:00
|
|
|
else if (strcmp(e->name, RAIL_SVC_CHANNEL_NAME) == 0)
|
|
|
|
{
|
2019-11-06 17:24:51 +03:00
|
|
|
xf_rail_uninit(xfc, (RailClientContext*)e->pInterface);
|
2014-11-12 00:35:30 +03:00
|
|
|
}
|
2014-10-15 06:24:07 +04:00
|
|
|
else if (strcmp(e->name, CLIPRDR_SVC_CHANNEL_NAME) == 0)
|
|
|
|
{
|
2019-11-06 17:24:51 +03:00
|
|
|
xf_cliprdr_uninit(xfc, (CliprdrClientContext*)e->pInterface);
|
2014-10-15 06:24:07 +04:00
|
|
|
}
|
2014-07-01 01:17:06 +04:00
|
|
|
else if (strcmp(e->name, ENCOMSP_SVC_CHANNEL_NAME) == 0)
|
|
|
|
{
|
2019-11-06 17:24:51 +03:00
|
|
|
xf_encomsp_uninit(xfc, (EncomspClientContext*)e->pInterface);
|
2014-07-01 01:17:06 +04:00
|
|
|
}
|
2018-01-26 17:21:49 +03:00
|
|
|
else if (strcmp(e->name, VIDEO_CONTROL_DVC_CHANNEL_NAME) == 0)
|
|
|
|
{
|
2018-02-08 10:44:46 +03:00
|
|
|
if (settings->SoftwareGdi)
|
2022-01-19 11:27:39 +03:00
|
|
|
gdi_video_control_uninit(xfc->common.context.gdi, (VideoClientContext*)e->pInterface);
|
2018-02-08 10:44:46 +03:00
|
|
|
else
|
|
|
|
xf_video_control_uninit(xfc, (VideoClientContext*)e->pInterface);
|
2018-01-26 17:21:49 +03:00
|
|
|
}
|
2022-01-19 13:05:55 +03:00
|
|
|
else
|
|
|
|
freerdp_client_OnChannelDisconnectedEventHandler(context, e);
|
2013-05-14 03:17:25 +04:00
|
|
|
}
|