Moved pre and post channel hooks.

This commit is contained in:
Armin Novak 2016-08-10 13:33:34 +02:00
parent 2e76529e5d
commit 22ddec810b
13 changed files with 98 additions and 186 deletions

View File

@ -288,14 +288,6 @@ static BOOL android_pre_connect(freerdp* instance)
}
freerdp_callback("OnPreConnect", "(I)V", instance);
rc = freerdp_channels_pre_connect(instance->context->channels, instance);
if (rc != CHANNEL_RC_OK)
{
WLog_ERR(TAG, "freerdp_channels_pre_connect failed with %l08X", rc);
return FALSE;
}
return TRUE;
}
@ -386,11 +378,6 @@ static BOOL android_post_connect(freerdp* instance)
instance->update->EndPaint = android_end_paint;
instance->update->DesktopResize = android_desktop_resize;
pointer_cache_register_callbacks(update);
if (freerdp_channels_post_connect(instance->context->channels,
instance) != CHANNEL_RC_OK)
return FALSE;
freerdp_callback("OnSettingsChanged", "(IIII)V", instance,
settings->DesktopWidth, settings->DesktopHeight,
settings->ColorDepth);

View File

@ -156,11 +156,6 @@ BOOL df_pre_connect(freerdp* instance)
dfi->clrconv->rgb555 = 0;
dfi->clrconv->palette = (rdpPalette*) malloc(sizeof(rdpPalette));
ZeroMemory(dfi->clrconv->palette, sizeof(rdpPalette));
if (freerdp_channels_pre_connect(instance->context->channels,
instance) != CHANNEL_RC_OK)
return FALSE;
return (instance->context->cache = cache_new(instance->settings)) != NULL;
}
@ -211,8 +206,7 @@ BOOL df_post_connect(freerdp* instance)
df_keyboard_init();
pointer_cache_register_callbacks(instance->update);
df_register_graphics(instance->context->graphics);
return freerdp_channels_post_connect(instance->context->channels,
instance) == CHANNEL_RC_OK;
return TRUE;
}
BOOL df_verify_certificate(freerdp* instance, char* subject, char* issuer,

View File

@ -926,10 +926,6 @@ BOOL mac_pre_connect(freerdp* instance)
instance->settings))
return FALSE;
if (freerdp_channels_pre_connect(instance->context->channels,
instance) != CHANNEL_RC_OK)
return FALSE;
return TRUE;
}
@ -957,10 +953,6 @@ BOOL mac_post_connect(freerdp* instance)
pointer_cache_register_callbacks(instance->update);
graphics_register_pointer(instance->context->graphics, &rdp_pointer);
if (freerdp_channels_post_connect(instance->context->channels,
instance) != CHANNEL_RC_OK)
return FALSE;
/* setup pasteboard (aka clipboard) for copy operations (write only) */
view->pasteboard_wr = [NSPasteboard generalPasteboard];
/* setup pasteboard for read operations */

View File

@ -99,11 +99,6 @@ static BOOL tf_pre_connect(freerdp* instance)
settings->OrderSupport[NEG_POLYGON_CB_INDEX] = TRUE;
settings->OrderSupport[NEG_ELLIPSE_SC_INDEX] = TRUE;
settings->OrderSupport[NEG_ELLIPSE_CB_INDEX] = TRUE;
if (freerdp_channels_pre_connect(instance->context->channels,
instance) != CHANNEL_RC_OK)
return FALSE;
return TRUE;
}
@ -114,8 +109,7 @@ static BOOL tf_post_connect(freerdp* instance)
instance->update->BeginPaint = tf_begin_paint;
instance->update->EndPaint = tf_end_paint;
return (freerdp_channels_post_connect(instance->context->channels,
instance) == CHANNEL_RC_OK);
return TRUE;
}
static void* tf_client_thread_proc(freerdp* instance)

View File

@ -149,10 +149,6 @@ static BOOL wl_pre_connect(freerdp* instance)
instance->settings))
return FALSE;
if (freerdp_channels_pre_connect(instance->context->channels,
instance) != CHANNEL_RC_OK)
return FALSE;
return TRUE;
}
@ -180,11 +176,6 @@ static BOOL wl_post_connect(freerdp* instance)
UwacWindowSetTitle(window, "FreeRDP");
instance->update->BeginPaint = wl_begin_paint;
instance->update->EndPaint = wl_end_paint;
if (freerdp_channels_post_connect(instance->context->channels,
instance) != CHANNEL_RC_OK)
return FALSE;
memcpy(UwacWindowGetDrawingBuffer(context->window), gdi->primary_buffer,
gdi->width * gdi->height * 4);
UwacWindowAddDamage(context->window, 0, 0, gdi->width, gdi->height);

View File

@ -115,31 +115,8 @@ static BOOL wf_sw_end_paint(rdpContext* context)
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;
}
@ -160,12 +137,7 @@ static BOOL wf_begin_paint(rdpContext* context)
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;
@ -182,12 +154,17 @@ static BOOL wf_hw_desktop_resize(rdpContext* context)
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)
@ -302,11 +279,6 @@ static BOOL wf_pre_connect(freerdp* instance)
(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;
}
@ -349,7 +321,7 @@ static BOOL wf_post_connect(freerdp* instance)
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;
@ -398,18 +370,13 @@ static BOOL wf_post_connect(freerdp* instance)
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);
@ -425,15 +392,17 @@ static BOOL wf_post_connect(freerdp* instance)
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),
@ -1012,6 +981,7 @@ static BOOL wfreerdp_client_new(freerdp* instance, rdpContext* context)
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;

View File

@ -64,7 +64,7 @@ static const BYTE wf_rop2_table[] =
};
static BOOL wf_decode_color(wfContext* wfc, const UINT32 srcColor,
UINT32* color, UINT32* format)
UINT32* color, UINT32* format)
{
rdpGdi* gdi;
rdpSettings* settings;
@ -80,28 +80,31 @@ static BOOL wf_decode_color(wfContext* wfc, const UINT32 srcColor,
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;
}
@ -121,7 +124,7 @@ static wfBitmap* wf_glyph_new(wfContext* wfc, GLYPH_DATA* glyph)
{
wfBitmap* glyph_bmp;
glyph_bmp = wf_image_new(wfc, glyph->cx, glyph->cy, PIXEL_FORMAT_MONO,
glyph->aj);
glyph->aj);
return glyph_bmp;
}
@ -161,7 +164,7 @@ static BYTE* wf_glyph_convert(wfContext* wfc, int width, int height, BYTE* data)
}
static HBRUSH wf_create_brush(wfContext* wfc, rdpBrush* brush, UINT32 color,
UINT32 bpp)
UINT32 bpp)
{
UINT32 i;
HBRUSH br;
@ -172,7 +175,7 @@ static HBRUSH wf_create_brush(wfContext* wfc, rdpBrush* brush, UINT32 color,
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;
@ -261,7 +264,7 @@ static BOOL wf_scale_rect(wfContext* wfc, RECT* source)
}
void wf_invalidate_region(wfContext* wfc, UINT32 x, UINT32 y, UINT32 width,
UINT32 height)
UINT32 height)
{
RECT rect;
rdpGdi* gdi = wfc->context.gdi;
@ -277,7 +280,7 @@ void wf_invalidate_region(wfContext* wfc, UINT32 x, UINT32 y, UINT32 width,
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)
@ -343,7 +346,7 @@ void wf_resize_window(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)
@ -351,16 +354,16 @@ void wf_resize_window(wfContext* wfc)
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;
@ -377,8 +380,8 @@ void wf_resize_window(wfContext* wfc)
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);
}
@ -413,7 +416,7 @@ void wf_toggle_fullscreen(wfContext* wfc)
}
static BOOL wf_gdi_palette_update(rdpContext* context,
const PALETTE_UPDATE* palette)
const PALETTE_UPDATE* palette)
{
return TRUE;
}
@ -442,7 +445,7 @@ static BOOL wf_gdi_set_bounds(rdpContext* context, const rdpBounds* bounds)
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);
}
@ -460,11 +463,11 @@ static BOOL wf_gdi_dstblt(rdpContext* context, const DSTBLT_ORDER* dstblt)
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;
}
@ -490,13 +493,13 @@ static BOOL wf_gdi_patblt(rdpContext* context, PATBLT_ORDER* patblt)
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);
@ -505,7 +508,7 @@ static BOOL wf_gdi_patblt(rdpContext* context, PATBLT_ORDER* patblt)
if (wfc->drawing == wfc->primary)
wf_invalidate_region(wfc, patblt->nLeftRect, patblt->nTopRect, patblt->nWidth,
patblt->nHeight);
patblt->nHeight);
return rc;
}
@ -518,17 +521,17 @@ static BOOL wf_gdi_scrblt(rdpContext* context, const SCRBLT_ORDER* scrblt)
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;
@ -551,13 +554,13 @@ static BOOL wf_gdi_opaque_rect(rdpContext* context,
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;
@ -569,7 +572,7 @@ static BOOL wf_gdi_multi_opaque_rect(rdpContext* context,
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++)
@ -584,7 +587,7 @@ static BOOL wf_gdi_multi_opaque_rect(rdpContext* context,
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);
}
@ -614,9 +617,9 @@ static BOOL wf_gdi_line_to(rdpContext* context, const LINE_TO_ORDER* line_to)
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);
@ -665,7 +668,7 @@ static BOOL wf_gdi_polyline(rdpContext* context, const POLYLINE_ORDER* polyline)
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);
@ -690,19 +693,20 @@ static BOOL wf_gdi_memblt(rdpContext* context, MEMBLT_ORDER* memblt)
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;
@ -715,10 +719,10 @@ static BOOL wf_gdi_surface_frame_marker(rdpContext* context,
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;

View File

@ -1124,9 +1124,6 @@ static BOOL xf_pre_connect(freerdp* instance)
if (!freerdp_client_load_addins(channels, instance->settings))
return FALSE;
if (freerdp_channels_pre_connect(channels, instance) != CHANNEL_RC_OK)
return FALSE;
if (!settings->Username && !settings->CredentialsFromStdin)
{
char* login_name = getlogin();
@ -1278,9 +1275,6 @@ static BOOL xf_post_connect(freerdp* instance)
if (!(xfc->clipboard = xf_clipboard_new(xfc)))
return FALSE;
if (freerdp_channels_post_connect(channels, instance) != CHANNEL_RC_OK)
return FALSE;
EventArgsInit(&e, "xfreerdp");
e.width = settings->DesktopWidth;
e.height = settings->DesktopHeight;

View File

@ -167,14 +167,6 @@ static BOOL ios_pre_connect(freerdp* instance)
return FALSE;
}
rc = freerdp_channels_pre_connect(instance->context->channels, instance);
if (rc != CHANNEL_RC_OK)
{
WLog_ERR(TAG, "freerdp_channels_pre_connect failed with %l08X", rc);
return FALSE;
}
return TRUE;
}
@ -268,11 +260,6 @@ static BOOL ios_post_connect(freerdp* instance)
instance->update->DesktopResize = ios_ui_resize_window;
pointer_cache_register_callbacks(instance->update);
// Channel allocation
if (freerdp_channels_post_connect(instance->context->channels,
instance) != CHANNEL_RC_OK)
return FALSE;
[mfi->session performSelectorOnMainThread:@selector(sessionDidConnect)
withObject:nil waitUntilDone:YES];
return TRUE;

View File

@ -38,10 +38,6 @@ FREERDP_API int freerdp_channels_client_load(rdpChannels* channels,
FREERDP_API int freerdp_channels_load_plugin(rdpChannels* channels,
rdpSettings* settings,
const char* name, void* data);
FREERDP_API UINT freerdp_channels_pre_connect(rdpChannels* channels,
freerdp* instance);
FREERDP_API UINT freerdp_channels_post_connect(rdpChannels* channels,
freerdp* instance);
FREERDP_API BOOL freerdp_channels_get_fds(rdpChannels* channels,
freerdp* instance, void** read_fds,
int* read_count, void** write_fds, int* write_count);

View File

@ -115,5 +115,8 @@ FREERDP_LOCAL UINT freerdp_channels_disconnect(rdpChannels* channels,
FREERDP_LOCAL void freerdp_channels_close(rdpChannels* channels,
freerdp* instance);
FREERDP_LOCAL void freerdp_channels_free(rdpChannels* channels);
FREERDP_LOCAL UINT freerdp_channels_pre_connect(rdpChannels* channels,
freerdp* instance);
FREERDP_LOCAL UINT freerdp_channels_post_connect(rdpChannels* channels,
freerdp* instance);
#endif /* FREERDP_CORE_CLIENT_H */

View File

@ -94,6 +94,7 @@ rdpChannels* freerdp_channel_get_channels_context(void)
*/
BOOL freerdp_connect(freerdp* instance)
{
UINT status2;
rdpRdp* rdp;
BOOL status = TRUE;
rdpSettings* settings;
@ -113,6 +114,10 @@ BOOL freerdp_connect(freerdp* instance)
instance->context->codecs = codecs_new(instance->context);
IFCALLRET(instance->PreConnect, status, instance);
if (status)
status2 = freerdp_channels_pre_connect(instance->context->channels,
instance);
if (settings->KeyboardLayout == KBD_JAPANESE_INPUT_SYSTEM_MS_IME2002)
{
settings->KeyboardType = 7;
@ -120,7 +125,7 @@ BOOL freerdp_connect(freerdp* instance)
settings->KeyboardFunctionKey = 12;
}
if (!status)
if (!status || (status2 != CHANNEL_RC_OK))
{
if (!freerdp_get_last_error(rdp->context))
freerdp_set_last_error(instance->context, FREERDP_ERROR_PRE_CONNECT_FAILED);
@ -143,6 +148,8 @@ BOOL freerdp_connect(freerdp* instance)
if (status)
{
UINT status2;
if (instance->settings->DumpRemoteFx)
{
instance->update->pcap_rfx = pcap_open(instance->settings->DumpRemoteFxFile,
@ -154,7 +161,11 @@ BOOL freerdp_connect(freerdp* instance)
IFCALLRET(instance->PostConnect, status, instance);
if (!status || !update_post_connect(instance->update))
if (status)
status2 = freerdp_channels_post_connect(instance->context->channels, instance);
if (!status || (status2 != CHANNEL_RC_OK)
|| !update_post_connect(instance->update))
{
WLog_ERR(TAG, "freerdp_post_connect failed");

View File

@ -135,9 +135,6 @@ BOOL shw_pre_connect(freerdp* instance)
if (!freerdp_client_load_addins(context->channels, instance->settings))
return FALSE;
if (freerdp_channels_pre_connect(context->channels, instance) != CHANNEL_RC_OK)
return FALSE;
return TRUE;
}
@ -157,8 +154,7 @@ BOOL shw_post_connect(freerdp* instance)
instance->update->EndPaint = shw_end_paint;
instance->update->DesktopResize = shw_desktop_resize;
instance->update->SurfaceFrameMarker = shw_surface_frame_marker;
return (freerdp_channels_post_connect(instance->context->channels, instance) == CHANNEL_RC_OK) ;
return TRUE;
}
void* shw_client_thread(void* arg)
@ -291,13 +287,6 @@ BOOL shw_freerdp_client_new(freerdp* instance, rdpContext* context)
if (!(shw->StopEvent = CreateEvent(NULL, TRUE, FALSE, NULL)))
return FALSE;
if (!(context->channels = freerdp_channels_new()))
{
CloseHandle(shw->StopEvent);
shw->StopEvent = NULL;
return FALSE;
}
instance->PreConnect = shw_pre_connect;
instance->PostConnect = shw_post_connect;
instance->Authenticate = shw_authenticate;