diff --git a/client/X11/xf_channels.c b/client/X11/xf_channels.c index 776c5ead9..92e6b8157 100644 --- a/client/X11/xf_channels.c +++ b/client/X11/xf_channels.c @@ -72,10 +72,7 @@ void xf_OnChannelConnectedEventHandler(rdpContext* context, ChannelConnectedEven } else if (strcmp(e->name, GEOMETRY_DVC_CHANNEL_NAME) == 0) { - if (settings->SoftwareGdi) - gdi_video_geometry_init(xfc->context.gdi, (GeometryClientContext*)e->pInterface); - else - xf_video_geometry_init(xfc, (GeometryClientContext*)e->pInterface); + gdi_video_geometry_init(xfc->context.gdi, (GeometryClientContext*)e->pInterface); } else if (strcmp(e->name, VIDEO_CONTROL_DVC_CHANNEL_NAME) == 0) { @@ -86,10 +83,7 @@ void xf_OnChannelConnectedEventHandler(rdpContext* context, ChannelConnectedEven } else if (strcmp(e->name, VIDEO_DATA_DVC_CHANNEL_NAME) == 0) { - if (settings->SoftwareGdi) - gdi_video_data_init(xfc->context.gdi, (VideoClientContext*)e->pInterface); - else - xf_video_data_init(xfc, (VideoClientContext*)e->pInterface); + gdi_video_data_init(xfc->context.gdi, (VideoClientContext*)e->pInterface); } } @@ -127,10 +121,7 @@ void xf_OnChannelDisconnectedEventHandler(rdpContext* context, ChannelDisconnect } else if (strcmp(e->name, GEOMETRY_DVC_CHANNEL_NAME) == 0) { - if (settings->SoftwareGdi) - gdi_video_geometry_uninit(xfc->context.gdi, (GeometryClientContext*)e->pInterface); - else - xf_video_geometry_uninit(xfc, (GeometryClientContext*)e->pInterface); + gdi_video_geometry_uninit(xfc->context.gdi, (GeometryClientContext*)e->pInterface); } else if (strcmp(e->name, VIDEO_CONTROL_DVC_CHANNEL_NAME) == 0) { @@ -141,9 +132,6 @@ void xf_OnChannelDisconnectedEventHandler(rdpContext* context, ChannelDisconnect } else if (strcmp(e->name, VIDEO_DATA_DVC_CHANNEL_NAME) == 0) { - if (settings->SoftwareGdi) - gdi_video_data_uninit(xfc->context.gdi, (VideoClientContext*)e->pInterface); - else - xf_video_data_uninit(xfc, (VideoClientContext*)e->pInterface); + gdi_video_data_uninit(xfc->context.gdi, (VideoClientContext*)e->pInterface); } } diff --git a/client/X11/xf_video.c b/client/X11/xf_video.c index 2f05ec693..5fc8f2fb1 100644 --- a/client/X11/xf_video.c +++ b/client/X11/xf_video.c @@ -20,6 +20,7 @@ #include #include +#include #include "xf_video.h" @@ -31,22 +32,6 @@ typedef struct XImage* image; } xfVideoSurface; - -void xf_video_geometry_init(xfContext* xfc, GeometryClientContext* geom) -{ - xfc->geometry = geom; - - if (xfc->video) - { - VideoClientContext* video = xfc->video; - video->setGeometry(video, xfc->geometry); - } -} - -void xf_video_geometry_uninit(xfContext* xfc, GeometryClientContext* geom) -{ -} - static VideoSurface* xfVideoCreateSurface(VideoClientContext* video, BYTE* data, UINT32 x, UINT32 y, UINT32 width, UINT32 height) { @@ -75,61 +60,51 @@ static VideoSurface* xfVideoCreateSurface(VideoClientContext* video, BYTE* data, } -static BOOL xfVideoShowSurface(VideoClientContext* video, xfVideoSurface* surface) +static BOOL xfVideoShowSurface(VideoClientContext* video, VideoSurface* surface) { + xfVideoSurface* xfSurface = (xfVideoSurface*)surface; xfContext* xfc = video->custom; #ifdef WITH_XRENDER if (xfc->context.settings->SmartSizing || xfc->context.settings->MultiTouchGestures) { - XPutImage(xfc->display, xfc->primary, xfc->gc, surface->image, - 0, 0, surface->base.x, surface->base.y, surface->base.w, surface->base.h); - xf_draw_screen(xfc, surface->base.x, surface->base.y, surface->base.w, surface->base.h); + XPutImage(xfc->display, xfc->primary, xfc->gc, xfSurface->image, + 0, 0, surface->x, surface->y, surface->w, surface->h); + xf_draw_screen(xfc, surface->x, surface->y, surface->w, surface->h); } else #endif { - XPutImage(xfc->display, xfc->drawable, xfc->gc, surface->image, + XPutImage(xfc->display, xfc->drawable, xfc->gc, xfSurface->image, 0, 0, - surface->base.x, surface->base.y, surface->base.w, surface->base.h); + surface->x, surface->y, surface->w, surface->h); } return TRUE; } -static BOOL xfVideoDeleteSurface(VideoClientContext* video, xfVideoSurface* surface) +static BOOL xfVideoDeleteSurface(VideoClientContext* video, VideoSurface* surface) { - XFree(surface->image); + xfVideoSurface* xfSurface = (xfVideoSurface*)surface; + + if (xfSurface) + XFree(xfSurface->image); + free(surface); return TRUE; } void xf_video_control_init(xfContext* xfc, VideoClientContext* video) { - xfc->video = video; + gdi_video_control_init(xfc->context.gdi, video); video->custom = xfc; video->createSurface = xfVideoCreateSurface; - video->showSurface = (pcVideoShowSurface)xfVideoShowSurface; - video->deleteSurface = (pcVideoDeleteSurface)xfVideoDeleteSurface; - video->setGeometry(video, xfc->geometry); + video->showSurface = xfVideoShowSurface; + video->deleteSurface = xfVideoDeleteSurface; } void xf_video_control_uninit(xfContext* xfc, VideoClientContext* video) { -} - -static void xf_video_timer(xfContext* xfc, TimerEventArgs* timer) -{ - xfc->video->timer(xfc->video, timer->now); -} - -void xf_video_data_init(xfContext* xfc, VideoClientContext* video) -{ - PubSub_SubscribeTimer(xfc->context.pubSub, (pTimerEventHandler)xf_video_timer); -} - -void xf_video_data_uninit(xfContext* xfc, VideoClientContext* context) -{ - PubSub_UnsubscribeTimer(xfc->context.pubSub, (pTimerEventHandler)xf_video_timer); + gdi_video_control_uninit(xfc->context.gdi, video); } diff --git a/client/X11/xf_video.h b/client/X11/xf_video.h index 94e1982e8..9f50b5c9b 100644 --- a/client/X11/xf_video.h +++ b/client/X11/xf_video.h @@ -27,15 +27,9 @@ struct _xfVideoContext; typedef struct _xfVideoContext xfVideoContext; -void xf_video_geometry_init(xfContext* xfc, GeometryClientContext* geom); -void xf_video_geometry_uninit(xfContext* xfc, GeometryClientContext* geom); - void xf_video_control_init(xfContext* xfc, VideoClientContext* video); void xf_video_control_uninit(xfContext* xfc, VideoClientContext* video); -void xf_video_data_init(xfContext* xfc, VideoClientContext* video); -void xf_video_data_uninit(xfContext* xfc, VideoClientContext* context); - xfVideoContext* xf_video_new(xfContext* xfc); void xf_video_free(xfVideoContext* context); diff --git a/client/X11/xfreerdp.h b/client/X11/xfreerdp.h index 70d366c3e..04aabb0e7 100644 --- a/client/X11/xfreerdp.h +++ b/client/X11/xfreerdp.h @@ -216,9 +216,7 @@ struct xf_context TsmfClientContext* tsmf; xfClipboard* clipboard; CliprdrClientContext* cliprdr; - xfVideoContext *xfVideo; - GeometryClientContext *geometry; - VideoClientContext *video; + xfVideoContext* xfVideo; RdpeiClientContext* rdpei; EncomspClientContext* encomsp; xfDispContext* xfDisp;