static boolean remmina_rdp_pre_connect(freerdp* instance) { rfContext* rfi; rdpSettings* settings; RemminaProtocolWidget* gp; rfi = (rfContext*) instance->context; settings = instance->settings; gp = rfi->protocol_widget; settings->bitmap_cache = True; settings->offscreen_bitmap_cache = True; settings->order_support[NEG_DSTBLT_INDEX] = True; settings->order_support[NEG_PATBLT_INDEX] = True; settings->order_support[NEG_SCRBLT_INDEX] = True; settings->order_support[NEG_OPAQUE_RECT_INDEX] = True; settings->order_support[NEG_DRAWNINEGRID_INDEX] = False; settings->order_support[NEG_MULTIDSTBLT_INDEX] = False; settings->order_support[NEG_MULTIPATBLT_INDEX] = False; settings->order_support[NEG_MULTISCRBLT_INDEX] = False; settings->order_support[NEG_MULTIOPAQUERECT_INDEX] = True; settings->order_support[NEG_MULTI_DRAWNINEGRID_INDEX] = False; settings->order_support[NEG_LINETO_INDEX] = True; settings->order_support[NEG_POLYLINE_INDEX] = True; settings->order_support[NEG_MEMBLT_INDEX] = True; settings->order_support[NEG_MEM3BLT_INDEX] = False; settings->order_support[NEG_MEMBLT_V2_INDEX] = True; settings->order_support[NEG_MEM3BLT_V2_INDEX] = False; settings->order_support[NEG_SAVEBITMAP_INDEX] = False; settings->order_support[NEG_GLYPH_INDEX_INDEX] = True; settings->order_support[NEG_FAST_INDEX_INDEX] = True; settings->order_support[NEG_FAST_GLYPH_INDEX] = False; settings->order_support[NEG_POLYGON_SC_INDEX] = False; settings->order_support[NEG_POLYGON_CB_INDEX] = False; settings->order_support[NEG_ELLIPSE_SC_INDEX] = False; settings->order_support[NEG_ELLIPSE_CB_INDEX] = False; if (settings->rfx_codec == True) { settings->frame_acknowledge = False; settings->large_pointer = True; settings->performance_flags = PERF_FLAG_NONE; rfi->rfx_context = rfx_context_new(); rfx_context_set_cpu_opt(rfi->rfx_context, CPU_SSE2); } freerdp_channels_pre_connect(rfi->channels, instance); rfi->clrconv = xnew(CLRCONV); rfi->clrconv->alpha = true; rfi->clrconv->invert = false; rfi->clrconv->rgb555 = false; rfi->clrconv->palette = xnew(rdpPalette); instance->context->cache = cache_new(instance->settings); return True; }
/* Called when we have a new peer connecting */ void mf_peer_context_new(freerdp_peer* client, mfPeerContext* context) { context->info = mf_info_get_instance(); context->rfx_context = rfx_context_new(); context->rfx_context->mode = RLGR3; context->rfx_context->width = client->settings->DesktopWidth; context->rfx_context->height = client->settings->DesktopHeight; rfx_context_set_pixel_format(context->rfx_context, RDP_PIXEL_FORMAT_B8G8R8A8); rfx_context_set_cpu_opt(context->rfx_context, CPU_SSE2); //context->nsc_context = nsc_context_new(); //nsc_context_set_pixel_format(context->nsc_context, RDP_PIXEL_FORMAT_B8G8R8A8); context->s = stream_new(0xFFFF); //#ifdef WITH_SERVER_CHANNELS context->vcm = WTSCreateVirtualChannelManager(client); //#endif mf_info_peer_register(context->info, context); }
boolean wf_post_connect(freerdp* instance) { rdpGdi* gdi; wfInfo* wfi; rdpCache* cache; wfContext* context; int width, height; wchar_t win_title[64]; rdpSettings* settings; settings = instance->settings; context = (wfContext*) instance->context; cache = instance->context->cache; wfi = context->wfi; wfi->dstBpp = 32; width = settings->width; height = settings->height; if (wfi->sw_gdi) { gdi_init(instance, CLRCONV_ALPHA | CLRCONV_INVERT | CLRBUF_32BPP, NULL); gdi = instance->context->gdi; wfi->hdc = gdi->primary->hdc; wfi->primary = wf_image_new(wfi, width, height, wfi->dstBpp, gdi->primary_buffer); rfx_context_set_cpu_opt(gdi->rfx_context, wfi_detect_cpu()); } else { wf_gdi_register_update_callbacks(instance->update); wfi->srcBpp = instance->settings->color_depth; wfi->primary = wf_image_new(wfi, width, height, wfi->dstBpp, NULL); wfi->hdc = gdi_GetDC(); wfi->hdc->bitsPerPixel = wfi->dstBpp; wfi->hdc->bytesPerPixel = wfi->dstBpp / 8; wfi->hdc->alpha = wfi->clrconv->alpha; wfi->hdc->invert = wfi->clrconv->invert; wfi->hdc->hwnd = (HGDI_WND) xmalloc(sizeof(GDI_WND)); wfi->hdc->hwnd->invalid = gdi_CreateRectRgn(0, 0, 0, 0); wfi->hdc->hwnd->invalid->null = 1; wfi->hdc->hwnd->count = 32; wfi->hdc->hwnd->cinvalid = (HGDI_RGN) xmalloc(sizeof(GDI_RGN) * wfi->hdc->hwnd->count); wfi->hdc->hwnd->ninvalid = 0; wfi->image = wf_bitmap_new(wfi, 64, 64, 32, NULL); wfi->image->_bitmap.data = NULL; if (settings->rfx_codec) { wfi->tile = wf_bitmap_new(wfi, 64, 64, 32, NULL); wfi->rfx_context = rfx_context_new(); rfx_context_set_cpu_opt(wfi->rfx_context, wfi_detect_cpu()); } if (settings->ns_codec) wfi->nsc_context = nsc_context_new(); } if (settings->window_title != NULL) _snwprintf(win_title, sizeof(win_title), L"%S", settings->window_title); else if (settings->port == 3389) _snwprintf(win_title, ARRAY_SIZE(win_title), L"FreeRDP: %S", settings->hostname); else _snwprintf(win_title, ARRAY_SIZE(win_title), L"FreeRDP: %S:%d", settings->hostname, settings->port); if (wfi->hwnd == 0) { wfi->hwnd = CreateWindowEx((DWORD) NULL, g_wnd_class_name, win_title, 0, 0, 0, 0, 0, NULL, NULL, g_hInstance, NULL); SetWindowLongPtr(wfi->hwnd, GWLP_USERDATA, (LONG_PTR) wfi); } if (wfi->fullscreen) { SetWindowLongPtr(wfi->hwnd, GWL_STYLE, WS_POPUP); SetWindowPos(wfi->hwnd, HWND_TOP, 0, 0, width, height, SWP_FRAMECHANGED); } else { POINT diff; RECT rc_client, rc_wnd; SetWindowLongPtr(wfi->hwnd, GWL_STYLE, WS_CAPTION | WS_OVERLAPPED | WS_SYSMENU | WS_MINIMIZEBOX); /* Now resize to get full canvas size and room for caption and borders */ SetWindowPos(wfi->hwnd, HWND_TOP, 10, 10, width, height, SWP_FRAMECHANGED); GetClientRect(wfi->hwnd, &rc_client); GetWindowRect(wfi->hwnd, &rc_wnd); diff.x = (rc_wnd.right - rc_wnd.left) - rc_client.right; diff.y = (rc_wnd.bottom - rc_wnd.top) - rc_client.bottom; SetWindowPos(wfi->hwnd, HWND_TOP, -1, -1, width + diff.x, height + diff.y, SWP_NOMOVE | SWP_FRAMECHANGED); } BitBlt(wfi->primary->hdc, 0, 0, width, height, NULL, 0, 0, BLACKNESS); wfi->drawing = wfi->primary; ShowWindow(wfi->hwnd, SW_SHOWNORMAL); UpdateWindow(wfi->hwnd); if (wfi->sw_gdi) { instance->update->BeginPaint = wf_sw_begin_paint; instance->update->EndPaint = wf_sw_end_paint; } else { instance->update->BeginPaint = wf_hw_begin_paint; instance->update->EndPaint = wf_hw_end_paint; } pointer_cache_register_callbacks(instance->update); if (wfi->sw_gdi != true) { brush_cache_register_callbacks(instance->update); bitmap_cache_register_callbacks(instance->update); offscreen_cache_register_callbacks(instance->update); } wf_register_graphics(instance->context->graphics); freerdp_channels_post_connect(instance->context->channels, instance); return true; }