Do not update client if output suppressed.

This commit is contained in:
Armin Novak 2018-02-08 10:34:49 +01:00
parent 253beda330
commit c0ec81c3c7
7 changed files with 47 additions and 31 deletions

View File

@ -289,8 +289,6 @@ static BOOL xf_desktop_resize(rdpContext* context)
static BOOL xf_sw_begin_paint(rdpContext* context)
{
rdpGdi* gdi = context->gdi;
gdi->primary->hdc->hwnd->invalid->null = TRUE;
gdi->primary->hdc->hwnd->ninvalid = 0;
return TRUE;
}
@ -303,6 +301,10 @@ static BOOL xf_sw_end_paint(rdpContext* context)
HGDI_RGN cinvalid;
xfContext* xfc = (xfContext*) context;
rdpGdi* gdi = context->gdi;
if (gdi->suppressOutput)
return TRUE;
x = gdi->primary->hdc->hwnd->invalid->x;
y = gdi->primary->hdc->hwnd->invalid->y;
w = gdi->primary->hdc->hwnd->invalid->w;
@ -355,6 +357,8 @@ static BOOL xf_sw_end_paint(rdpContext* context)
xf_unlock_x11(xfc, FALSE);
}
gdi->primary->hdc->hwnd->invalid->null = TRUE;
gdi->primary->hdc->hwnd->ninvalid = 0;
return TRUE;
}
@ -392,9 +396,6 @@ out:
static BOOL xf_hw_begin_paint(rdpContext* context)
{
xfContext* xfc = (xfContext*) context;
xfc->hdc->hwnd->invalid->null = TRUE;
xfc->hdc->hwnd->ninvalid = 0;
return TRUE;
}
@ -404,6 +405,9 @@ static BOOL xf_hw_end_paint(rdpContext* context)
UINT32 w, h;
xfContext* xfc = (xfContext*) context;
if (xfc->context.gdi->suppressOutput)
return TRUE;
if (!xfc->remote_app)
{
if (!xfc->complex_regions)
@ -459,6 +463,8 @@ static BOOL xf_hw_end_paint(rdpContext* context)
xf_unlock_x11(xfc, FALSE);
}
xfc->hdc->hwnd->invalid->null = TRUE;
xfc->hdc->hwnd->ninvalid = 0;
return TRUE;
}

View File

@ -158,28 +158,6 @@ static const char* x11_event_string(int event)
#define DEBUG_X11(...) do { } while (0)
#endif
static BOOL xf_send_suppress_output(xfContext* xfc, XEvent* event, BOOL suppress)
{
RECTANGLE_16 rect;
rdpSettings* settings;
rdpUpdate* update;
if (!xfc || !xfc->context.settings || !xfc->context.update)
return FALSE;
if (xfc->suppress_output == suppress)
return TRUE;
xfc->suppress_output = suppress;
settings = xfc->context.settings;
update = xfc->context.update;
rect.left = 0;
rect.top = 0;
rect.right = settings->DesktopWidth;
rect.bottom = settings->DesktopHeight;
return update->SuppressOutput(&xfc->context, !suppress, &rect);
}
BOOL xf_event_action_script_init(xfContext* xfc)
{
char* xevent;
@ -791,7 +769,7 @@ static BOOL xf_event_MapNotify(xfContext* xfc, XEvent* event, BOOL app)
xfAppWindow* appWindow;
if (!app)
xf_send_suppress_output(xfc, event, FALSE);
gdi_send_suppress_output(xfc->context.gdi, FALSE);
else
{
appWindow = xf_AppWindowFromX11Window(xfc, event->xany.window);
@ -816,7 +794,7 @@ static BOOL xf_event_UnmapNotify(xfContext* xfc, XEvent* event, BOOL app)
xf_keyboard_release_all_keypress(xfc);
if (!app)
xf_send_suppress_output(xfc, event, TRUE);
gdi_send_suppress_output(xfc->context.gdi, TRUE);
else
{
appWindow = xf_AppWindowFromX11Window(xfc, event->xany.window);
@ -922,7 +900,7 @@ static BOOL xf_event_PropertyNotify(xfContext* xfc, XEvent* event, BOOL app)
}
}
else if (minimizedChanged)
xf_send_suppress_output(xfc, event, minimized);
gdi_send_suppress_output(xfc->context.gdi, minimized);
}
return TRUE;

View File

@ -114,6 +114,9 @@ static UINT xf_UpdateSurfaces(RdpgfxClientContext* context)
if (!gdi->graphicsReset)
return status;
if (gdi->suppressOutput)
return CHANNEL_RC_OK;
context->GetSurfaceIds(context, &pSurfaceIds, &count);
for (index = 0; index < count; index++)

View File

@ -158,7 +158,6 @@ struct xf_context
BOOL focused;
BOOL use_xinput;
BOOL mouse_active;
BOOL suppress_output;
BOOL fullscreen_toggle;
BOOL controlToggle;
UINT32 KeyboardLayout;

View File

@ -517,6 +517,7 @@ struct rdp_gdi
BOOL inGfxFrame;
BOOL graphicsReset;
BOOL suppressOutput;
UINT16 outputSurfaceId;
RdpgfxClientContext* gfx;
@ -544,6 +545,8 @@ FREERDP_API BOOL gdi_init_ex(freerdp* instance, UINT32 format,
void (*pfree)(void*));
FREERDP_API void gdi_free(freerdp* instance);
FREERDP_API BOOL gdi_send_suppress_output(rdpGdi* gdi, BOOL suppress);
#ifdef __cplusplus
}
#endif

View File

@ -32,6 +32,7 @@
#include <freerdp/log.h>
#include <freerdp/freerdp.h>
#include <freerdp/gdi/gdi.h>
#include <freerdp/gdi/dc.h>
#include <freerdp/gdi/pen.h>
#include <freerdp/gdi/shape.h>
@ -1330,3 +1331,25 @@ void gdi_free(freerdp* instance)
instance->context->gdi = (rdpGdi*) NULL;
}
BOOL gdi_send_suppress_output(rdpGdi* gdi, BOOL suppress)
{
RECTANGLE_16 rect;
rdpSettings* settings;
rdpUpdate* update;
if (!gdi || !gdi->context->settings || !gdi->context->update)
return FALSE;
if (gdi->suppressOutput == suppress)
return TRUE;
gdi->suppressOutput = suppress;
settings = gdi->context->settings;
update = gdi->context->update;
rect.left = 0;
rect.top = 0;
rect.right = settings->DesktopWidth;
rect.bottom = settings->DesktopHeight;
return update->SuppressOutput(gdi->context, !suppress, &rect);
}

View File

@ -102,6 +102,10 @@ static UINT gdi_OutputUpdate(rdpGdi* gdi, gdiGfxSurface* surface)
const RECTANGLE_16* rects;
UINT32 i, nbRects;
rdpUpdate* update = gdi->context->update;
if (gdi->suppressOutput)
return CHANNEL_RC_OK;
surfaceX = surface->outputOriginX;
surfaceY = surface->outputOriginY;
surfaceRect.left = 0;