From: Armin Novak Date: Fri, 18 Jan 2019 13:38:51 +0000 (+0100) Subject: Unified buffer update and screen refresh on focus X-Git-Tag: 2.0.0~557^2~3 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0b17406eec3bb46726d275197ecd01e823a46a7f;p=platform%2Fupstream%2Ffreerdp.git Unified buffer update and screen refresh on focus --- diff --git a/client/Wayland/wlfreerdp.c b/client/Wayland/wlfreerdp.c index 04a9c68..658c7ae 100644 --- a/client/Wayland/wlfreerdp.c +++ b/client/Wayland/wlfreerdp.c @@ -69,34 +69,25 @@ static BOOL wl_begin_paint(rdpContext* context) return TRUE; } - -static BOOL wl_end_paint(rdpContext* context) +static BOOL wl_update_buffer(wlfContext* context_w, UINT32 x, UINT32 y, UINT32 w, UINT32 h) { rdpGdi* gdi; char* data; - wlfContext* context_w; - INT32 x, y; - UINT32 w, h; UINT32 i; - if (!context || !context->gdi || !context->gdi->primary) + if (!context_w) return FALSE; - gdi = context->gdi; - - if (gdi->primary->hdc->hwnd->invalid->null) - return TRUE; - - x = gdi->primary->hdc->hwnd->invalid->x; - y = gdi->primary->hdc->hwnd->invalid->y; - w = gdi->primary->hdc->hwnd->invalid->w; - h = gdi->primary->hdc->hwnd->invalid->h; - context_w = (wlfContext*) context; data = UwacWindowGetDrawingBuffer(context_w->window); if (!data) return FALSE; + gdi = context_w->context.gdi; + + if (!gdi) + return FALSE; + for (i = 0; i < h; i++) { memcpy(data + ((i + y) * (gdi->width * GetBytesPerPixel( @@ -113,6 +104,29 @@ static BOOL wl_end_paint(rdpContext* context) return wl_update_content(context_w); } +static BOOL wl_end_paint(rdpContext* context) +{ + rdpGdi* gdi; + wlfContext* context_w; + INT32 x, y; + UINT32 w, h; + + if (!context || !context->gdi || !context->gdi->primary) + return FALSE; + + gdi = context->gdi; + + if (gdi->primary->hdc->hwnd->invalid->null) + return TRUE; + + x = gdi->primary->hdc->hwnd->invalid->x; + y = gdi->primary->hdc->hwnd->invalid->y; + w = gdi->primary->hdc->hwnd->invalid->w; + h = gdi->primary->hdc->hwnd->invalid->h; + context_w = (wlfContext*) context; + return wl_update_buffer(context_w, x, y, w, h); +} + static BOOL wl_pre_connect(freerdp* instance) { @@ -189,12 +203,8 @@ static BOOL wl_post_connect(freerdp* instance) UwacWindowSetOpaqueRegion(context->window, 0, 0, gdi->width, gdi->height); instance->update->BeginPaint = wl_begin_paint; instance->update->EndPaint = wl_end_paint; - memcpy(UwacWindowGetDrawingBuffer(context->window), gdi->primary_buffer, - gdi->width * gdi->height * 4); - UwacWindowAddDamage(context->window, 0, 0, gdi->width, gdi->height); - context->haveDamage = TRUE; freerdp_keyboard_init(instance->context->settings->KeyboardLayout); - return wl_update_content(context); + return wl_update_buffer(context, 0, 0, gdi->width, gdi->height); } static void wl_post_disconnect(freerdp* instance) @@ -214,6 +224,17 @@ static void wl_post_disconnect(freerdp* instance) UwacDestroyWindow(&context->window); } +static BOOL wl_refresh_display(wlfContext* context) +{ + rdpGdi* gdi; + + if (!context || !context->context.gdi) + return FALSE; + + gdi = context->context.gdi; + return wl_update_buffer(context, 0, 0, gdi->width, gdi->height); +} + static BOOL handle_uwac_events(freerdp* instance, UwacDisplay* display) { UwacEvent event; @@ -222,6 +243,8 @@ static BOOL handle_uwac_events(freerdp* instance, UwacDisplay* display) if (UwacDisplayDispatch(display, 1) < 0) return FALSE; + context = (wlfContext*)instance->context; + while (UwacHasEvent(display)) { if (UwacNextEvent(display, &event) != UWAC_SUCCESS) @@ -234,7 +257,6 @@ static BOOL handle_uwac_events(freerdp* instance, UwacDisplay* display) if (!instance) continue; - context = (wlfContext*)instance->context; context->waitingFrameDone = FALSE; if (context->haveDamage && !wl_update_content(context)) @@ -278,6 +300,12 @@ static BOOL handle_uwac_events(freerdp* instance, UwacDisplay* display) break; + case UWAC_EVENT_CONFIGURE: + if (!wl_refresh_display(context)) + return FALSE; + + break; + default: break; }