return TRUE;
}
-static BOOL wf_sw_desktop_resize(rdpContext* context)
+static BOOL wf_hw_end_paint(rdpContext* context)
{
- rdpGdi* gdi;
- rdpSettings* settings;
- wfContext* wfc = (wfContext*)context;
-
- if (!context || !context->instance)
- return FALSE;
-
- settings = context->instance->settings;
- gdi = context->gdi;
-
- if (!gdi || !settings)
- return FALSE;
-
- if (!gdi_resize(gdi, settings->DesktopWidth, settings->DesktopHeight))
- return FALSE;
-
- if (wfc->primary)
- {
- wf_image_free(wfc->primary);
- wfc->primary = wf_image_new(wfc, settings->DesktopWidth,
- settings->DesktopHeight, wfc->context.gdi->dstFormat, NULL);
- }
-
return TRUE;
}
return TRUE;
}
-static BOOL wf_hw_end_paint(rdpContext* context)
-{
- return TRUE;
-}
-
-static BOOL wf_hw_desktop_resize(rdpContext* context)
+static BOOL wf_desktop_resize(rdpContext* context)
{
BOOL same;
RECT rect;
same = (wfc->primary == wfc->drawing) ? TRUE : FALSE;
wf_image_free(wfc->primary);
wfc->primary = wf_image_new(wfc, settings->DesktopWidth,
- settings->DesktopHeight, wfc->context.gdi->dstFormat, NULL);
-
- if (same)
- wfc->drawing = wfc->primary;
+ settings->DesktopHeight, context->gdi->dstFormat, NULL);
}
+ if (!gdi_resize_ex(context->gdi, settings->DesktopWidth,
+ settings->DesktopHeight, 0,
+ context->gdi->dstFormat, wfc->primary->pdata, NULL))
+ return FALSE;
+
+ if (same)
+ wfc->drawing = wfc->primary;
+
if (wfc->fullscreen != TRUE)
{
if (wfc->hwnd)
(pChannelConnectedEventHandler) wf_OnChannelConnectedEventHandler);
PubSub_SubscribeChannelDisconnected(instance->context->pubSub,
(pChannelDisconnectedEventHandler) wf_OnChannelDisconnectedEventHandler);
-
- if (freerdp_channels_pre_connect(instance->context->channels,
- instance) != CHANNEL_RC_OK)
- return FALSE;
-
return TRUE;
}
wfc->primary = wf_image_new(wfc, settings->DesktopWidth,
settings->DesktopHeight, format, NULL);
- if (!gdi_init_ex(instance, format, 0, wfc->primary->pdata, wf_image_free))
+ if (!gdi_init_ex(instance, format, 0, wfc->primary->pdata, NULL))
return FALSE;
gdi = instance->context->gdi;
PubSub_OnEmbedWindow(context->pubSub, context, &e);
ShowWindow(wfc->hwnd, SW_SHOWNORMAL);
UpdateWindow(wfc->hwnd);
+ instance->update->BeginPaint = wf_begin_paint;
+ instance->update->DesktopResize = wf_desktop_resize;
- instance->update->BeginPaint = (pBeginPaint) wf_begin_paint;
if (settings->SoftwareGdi)
- {
- instance->update->EndPaint = (pEndPaint) wf_sw_end_paint;
- instance->update->DesktopResize = (pDesktopResize) wf_sw_desktop_resize;
- }
+ instance->update->EndPaint = wf_sw_end_paint;
else
- {
- instance->update->EndPaint = (pEndPaint) wf_hw_end_paint;
- instance->update->DesktopResize = (pDesktopResize) wf_hw_desktop_resize;
- }
+ instance->update->EndPaint = wf_hw_end_paint;
pointer_cache_register_callbacks(instance->update);
wf_register_pointer(context->graphics);
palette_cache_register_callbacks(instance->update);
}
- if (freerdp_channels_post_connect(context->channels, instance) != CHANNEL_RC_OK)
- return FALSE;
-
if (wfc->fullscreen)
floatbar_window_create(wfc);
return TRUE;
}
+static BOOL wf_post_disconnect(freerdp* instance)
+{
+ return TRUE;
+}
+
static CREDUI_INFOA wfUiInfo =
{
sizeof(CREDUI_INFOA),
instance->PreConnect = wf_pre_connect;
instance->PostConnect = wf_post_connect;
+ instance->PostDisconnect = wf_post_disconnect;
instance->Authenticate = wf_authenticate;
instance->GatewayAuthenticate = wf_gw_authenticate;
instance->VerifyCertificate = wf_verify_certificate;
};
static BOOL wf_decode_color(wfContext* wfc, const UINT32 srcColor,
- UINT32* color, UINT32* format)
+ UINT32* color, UINT32* format)
{
rdpGdi* gdi;
rdpSettings* settings;
return FALSE;
SrcFormat = gdi_get_pixel_format(gdi->context->settings->ColorDepth,
- FALSE);
+ FALSE);
if (format)
*format = SrcFormat;
- switch(GetBitsPerPixel(gdi->dstFormat))
+ switch (GetBitsPerPixel(gdi->dstFormat))
{
- case 32:
- DstFormat = PIXEL_FORMAT_ABGR32;
- break;
- case 24:
- DstFormat = PIXEL_FORMAT_BGR24;
- break;
- case 16:
- DstFormat = PIXEL_FORMAT_RGB16;
- break;
- default:
- return FALSE;
+ case 32:
+ DstFormat = PIXEL_FORMAT_ABGR32;
+ break;
+
+ case 24:
+ DstFormat = PIXEL_FORMAT_BGR24;
+ break;
+
+ case 16:
+ DstFormat = PIXEL_FORMAT_RGB16;
+ break;
+
+ default:
+ return FALSE;
}
*color = ConvertColor(srcColor, SrcFormat,
- DstFormat, &gdi->palette);
+ DstFormat, &gdi->palette);
return TRUE;
}
{
wfBitmap* glyph_bmp;
glyph_bmp = wf_image_new(wfc, glyph->cx, glyph->cy, PIXEL_FORMAT_MONO,
- glyph->aj);
+ glyph->aj);
return glyph_bmp;
}
}
static HBRUSH wf_create_brush(wfContext* wfc, rdpBrush* brush, UINT32 color,
- UINT32 bpp)
+ UINT32 bpp)
{
UINT32 i;
HBRUSH br;
lbr.lbStyle = brush->style;
if (lbr.lbStyle == BS_DIBPATTERN || lbr.lbStyle == BS_DIBPATTERN8X8
- || lbr.lbStyle == BS_DIBPATTERNPT)
+ || lbr.lbStyle == BS_DIBPATTERNPT)
lbr.lbColor = DIB_RGB_COLORS;
else
lbr.lbColor = color;
}
void wf_invalidate_region(wfContext* wfc, UINT32 x, UINT32 y, UINT32 width,
- UINT32 height)
+ UINT32 height)
{
RECT rect;
rdpGdi* gdi = wfc->context.gdi;
rect.bottom = height;
wf_scale_rect(wfc, &rect);
gdi_InvalidateRegion(gdi->primary->hdc, rect.left, rect.top, rect.right,
- rect.bottom);
+ rect.bottom);
}
void wf_update_offset(wfContext* wfc)
{
SetWindowLongPtr(wfc->hwnd, GWL_STYLE, WS_POPUP);
SetWindowPos(wfc->hwnd, HWND_TOP, 0, 0, GetSystemMetrics(SM_CXSCREEN),
- GetSystemMetrics(SM_CYSCREEN), SWP_FRAMECHANGED);
+ GetSystemMetrics(SM_CYSCREEN), SWP_FRAMECHANGED);
}
}
else if (!wfc->context.settings->Decorations)
SetWindowLongPtr(wfc->hwnd, GWL_STYLE, WS_CHILD);
/* Now resize to get full canvas size and room for caption and borders */
SetWindowPos(wfc->hwnd, HWND_TOP, 0, 0, settings->DesktopWidth,
- settings->DesktopHeight, SWP_FRAMECHANGED);
+ settings->DesktopHeight, SWP_FRAMECHANGED);
wf_update_canvas_diff(wfc);
SetWindowPos(wfc->hwnd, HWND_TOP, -1, -1, settings->DesktopWidth + wfc->diff.x,
- settings->DesktopHeight + wfc->diff.y, SWP_NOMOVE | SWP_FRAMECHANGED);
+ settings->DesktopHeight + wfc->diff.y, SWP_NOMOVE | SWP_FRAMECHANGED);
}
else
{
SetWindowLongPtr(wfc->hwnd, GWL_STYLE,
- WS_CAPTION | WS_OVERLAPPED | WS_SYSMENU | WS_MINIMIZEBOX | WS_SIZEBOX |
- WS_MAXIMIZEBOX);
+ WS_CAPTION | WS_OVERLAPPED | WS_SYSMENU | WS_MINIMIZEBOX | WS_SIZEBOX |
+ WS_MAXIMIZEBOX);
if (!wfc->client_height)
wfc->client_height = settings->DesktopHeight;
wf_update_canvas_diff(wfc);
/* Now resize to get full canvas size and room for caption and borders */
SetWindowPos(wfc->hwnd, HWND_TOP, wfc->client_x, wfc->client_y,
- wfc->client_width + wfc->diff.x, wfc->client_height + wfc->diff.y,
- 0 /*SWP_FRAMECHANGED*/);
+ wfc->client_width + wfc->diff.x, wfc->client_height + wfc->diff.y,
+ 0 /*SWP_FRAMECHANGED*/);
//wf_size_scrollbars(wfc, wfc->client_width, wfc->client_height);
}
}
static BOOL wf_gdi_palette_update(rdpContext* context,
- const PALETTE_UPDATE* palette)
+ const PALETTE_UPDATE* palette)
{
return TRUE;
}
if (bounds != NULL)
{
hrgn = CreateRectRgn(bounds->left, bounds->top, bounds->right + 1,
- bounds->bottom + 1);
+ bounds->bottom + 1);
SelectClipRgn(wfc->drawing->hdc, hrgn);
DeleteObject(hrgn);
}
return FALSE;
if (!BitBlt(wfc->drawing->hdc, dstblt->nLeftRect, dstblt->nTopRect,
- dstblt->nWidth, dstblt->nHeight, NULL, 0, 0, gdi_rop3_code(dstblt->bRop)))
+ dstblt->nWidth, dstblt->nHeight, NULL, 0, 0, gdi_rop3_code(dstblt->bRop)))
return FALSE;
wf_invalidate_region(wfc, dstblt->nLeftRect, dstblt->nTopRect,
- dstblt->nWidth, dstblt->nHeight);
+ dstblt->nWidth, dstblt->nHeight);
return TRUE;
}
return FALSE;
brush = wf_create_brush(wfc, &patblt->brush, fgcolor,
- context->settings->ColorDepth);
+ context->settings->ColorDepth);
org_bkmode = SetBkMode(wfc->drawing->hdc, OPAQUE);
org_bkcolor = SetBkColor(wfc->drawing->hdc, bgcolor);
org_textcolor = SetTextColor(wfc->drawing->hdc, fgcolor);
org_brush = (HBRUSH)SelectObject(wfc->drawing->hdc, brush);
rc = PatBlt(wfc->drawing->hdc, patblt->nLeftRect, patblt->nTopRect,
- patblt->nWidth, patblt->nHeight, gdi_rop3_code(patblt->bRop));
+ patblt->nWidth, patblt->nHeight, gdi_rop3_code(patblt->bRop));
SelectObject(wfc->drawing->hdc, org_brush);
DeleteObject(brush);
SetBkMode(wfc->drawing->hdc, org_bkmode);
if (wfc->drawing == wfc->primary)
wf_invalidate_region(wfc, patblt->nLeftRect, patblt->nTopRect, patblt->nWidth,
- patblt->nHeight);
+ patblt->nHeight);
return rc;
}
return FALSE;
if (!BitBlt(wfc->drawing->hdc, scrblt->nLeftRect, scrblt->nTopRect,
- scrblt->nWidth, scrblt->nHeight, wfc->primary->hdc,
- scrblt->nXSrc, scrblt->nYSrc, gdi_rop3_code(scrblt->bRop)))
+ scrblt->nWidth, scrblt->nHeight, wfc->primary->hdc,
+ scrblt->nXSrc, scrblt->nYSrc, gdi_rop3_code(scrblt->bRop)))
return FALSE;
wf_invalidate_region(wfc, scrblt->nLeftRect, scrblt->nTopRect,
- scrblt->nWidth, scrblt->nHeight);
+ scrblt->nWidth, scrblt->nHeight);
return TRUE;
}
static BOOL wf_gdi_opaque_rect(rdpContext* context,
- const OPAQUE_RECT_ORDER* opaque_rect)
+ const OPAQUE_RECT_ORDER* opaque_rect)
{
RECT rect;
HBRUSH brush;
if (wfc->drawing == wfc->primary)
wf_invalidate_region(wfc, rect.left, rect.top, rect.right - rect.left + 1,
- rect.bottom - rect.top + 1);
+ rect.bottom - rect.top + 1);
return TRUE;
}
static BOOL wf_gdi_multi_opaque_rect(rdpContext* context,
- const MULTI_OPAQUE_RECT_ORDER* multi_opaque_rect)
+ const MULTI_OPAQUE_RECT_ORDER* multi_opaque_rect)
{
UINT32 i;
RECT rect;
return FALSE;
if (!wf_decode_color(wfc, multi_opaque_rect->color, &brush_color,
- NULL))
+ NULL))
return FALSE;
for (i = 0; i < multi_opaque_rect->numRectangles; i++)
if (wfc->drawing == wfc->primary)
wf_invalidate_region(wfc, rect.left, rect.top, rect.right - rect.left + 1,
- rect.bottom - rect.top + 1);
+ rect.bottom - rect.top + 1);
DeleteObject(brush);
}
x = (line_to->nXStart < line_to->nXEnd) ? line_to->nXStart : line_to->nXEnd;
y = (line_to->nYStart < line_to->nYEnd) ? line_to->nYStart : line_to->nYEnd;
w = (line_to->nXStart < line_to->nXEnd) ? (line_to->nXEnd - line_to->nXStart)
- : (line_to->nXStart - line_to->nXEnd);
+ : (line_to->nXStart - line_to->nXEnd);
h = (line_to->nYStart < line_to->nYEnd) ? (line_to->nYEnd - line_to->nYStart)
- : (line_to->nYStart - line_to->nYEnd);
+ : (line_to->nYStart - line_to->nYEnd);
if (wfc->drawing == wfc->primary)
wf_invalidate_region(wfc, x, y, w, h);
if (wfc->drawing == wfc->primary)
wf_invalidate_region(wfc, wfc->client_x, wfc->client_y, wfc->client_width,
- wfc->client_height);
+ wfc->client_height);
Polyline(wfc->drawing->hdc, pts, numPoints);
free(pts);
if (!bitmap || !wfc->drawing || !wfc->drawing->hdc)
return FALSE;
- BitBlt(wfc->drawing->hdc, memblt->nLeftRect, memblt->nTopRect,
- memblt->nWidth, memblt->nHeight, bitmap->hdc,
- memblt->nXSrc, memblt->nYSrc, gdi_rop3_code(memblt->bRop));
+ if (!BitBlt(wfc->drawing->hdc, memblt->nLeftRect, memblt->nTopRect,
+ memblt->nWidth, memblt->nHeight, bitmap->hdc,
+ memblt->nXSrc, memblt->nYSrc, gdi_rop3_code(memblt->bRop)))
+ return FALSE;
if (wfc->drawing == wfc->primary)
wf_invalidate_region(wfc, memblt->nLeftRect, memblt->nTopRect, memblt->nWidth,
- memblt->nHeight);
+ memblt->nHeight);
return TRUE;
}
static BOOL wf_gdi_surface_frame_marker(rdpContext* context,
- const SURFACE_FRAME_MARKER* surface_frame_marker)
+ const SURFACE_FRAME_MARKER* surface_frame_marker)
{
rdpSettings* settings;
return FALSE;
if (surface_frame_marker->frameAction == SURFACECMD_FRAMEACTION_END
- && settings->FrameAcknowledge > 0)
+ && settings->FrameAcknowledge > 0)
{
IFCALL(context->instance->update->SurfaceFrameAcknowledge, context,
- surface_frame_marker->frameId);
+ surface_frame_marker->frameId);
}
return TRUE;