Exemplo n.º 1
0
static BOOL wl_post_connect(freerdp* instance)
{
	rdpGdi* gdi;
	UwacWindow* window;
	wlfContext* context;

	if (!gdi_init(instance, PIXEL_FORMAT_BGRA32))
		return FALSE;

	gdi = instance->context->gdi;

	if (!gdi)
		return FALSE;

	context = (wlfContext*) instance->context;
	context->window = window = UwacCreateWindowShm(context->display, gdi->width,
	                           gdi->height, WL_SHM_FORMAT_XRGB8888);

	if (!window)
		return FALSE;

	UwacWindowSetFullscreenState(window, NULL, instance->context->settings->Fullscreen);
	UwacWindowSetTitle(window, "FreeRDP");
	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);
}
Exemplo n.º 2
0
static BOOL android_post_connect(freerdp* instance)
{
	rdpSettings* settings;
	rdpUpdate* update;

	if (!instance || !instance->settings || !instance->context || !instance->update)
		return FALSE;

	update = instance->update;
	settings = instance->settings;

	if (!gdi_init(instance, PIXEL_FORMAT_RGBA32))
		return FALSE;

	if (!android_register_pointer(instance->context->graphics))
		return FALSE;

	instance->update->BeginPaint = android_begin_paint;
	instance->update->EndPaint = android_end_paint;
	instance->update->DesktopResize = android_desktop_resize;
	pointer_cache_register_callbacks(update);
	freerdp_callback("OnSettingsChanged", "(IIII)V", instance,
	                 settings->DesktopWidth, settings->DesktopHeight,
	                 settings->ColorDepth);
	freerdp_callback("OnConnectionSuccess", "(I)V", instance);
	return TRUE;
}
Exemplo n.º 3
0
static BOOL android_post_connect(freerdp* instance)
{
	UINT32 gdi_flags;
	rdpSettings *settings = instance->settings;

	DEBUG_ANDROID("android_post_connect");

	assert(instance);
	assert(settings);

	freerdp_callback("OnSettingsChanged", "(IIII)V", instance,
			settings->DesktopWidth, settings->DesktopHeight,
			settings->ColorDepth);

	instance->context->cache = cache_new(settings);

	if (instance->settings->ColorDepth > 16)
		gdi_flags = CLRBUF_32BPP | CLRCONV_ALPHA | CLRCONV_INVERT;
	else
		gdi_flags = CLRBUF_16BPP;

	gdi_init(instance, gdi_flags, NULL);

	instance->update->BeginPaint = android_begin_paint;
	instance->update->EndPaint = android_end_paint;
	instance->update->DesktopResize = android_desktop_resize;

	freerdp_channels_post_connect(instance->context->channels, instance);

	freerdp_callback("OnConnectionSuccess", "(I)V", instance);

	return TRUE;
}
Exemplo n.º 4
0
static BOOL wl_post_connect(freerdp* instance)
{
	rdpGdi* gdi;
	UwacWindow* window;
	wlfContext* context;

	if (!gdi_init(instance, CLRCONV_ALPHA | CLRBUF_32BPP, NULL))
		return FALSE;

	gdi = instance->context->gdi;
	if (!gdi)
		return FALSE;

	context = (wlfContext*) instance->context;
	context->window = window = UwacCreateWindowShm(context->display, gdi->width, gdi->height, WL_SHM_FORMAT_XRGB8888);
	if (!window)
		return FALSE;

	UwacWindowSetTitle(window, "FreeRDP");

	instance->update->BeginPaint = wl_begin_paint;
	instance->update->EndPaint = wl_end_paint;

	if (freerdp_channels_post_connect(instance->context->channels, instance) < 0)
		return FALSE;


	memcpy(UwacWindowGetDrawingBuffer(context->window), gdi->primary_buffer, gdi->width * gdi->height * 4);
	UwacWindowAddDamage(context->window, 0, 0, gdi->width, gdi->height);
	context->haveDamage = TRUE;
	return wl_update_content(context);
}
Exemplo n.º 5
0
Arquivo: rdp.c Projeto: mstorsjo/vlc
static bool postConnectHandler( freerdp *p_instance )
{
    vlcrdp_context_t * p_vlccontext = (vlcrdp_context_t *) p_instance->context;

    msg_Dbg( p_vlccontext->p_demux, "connected to desktop %dx%d (%d bpp)",
#if defined(FREERDP_VERSION_MAJOR) && (FREERDP_VERSION_MAJOR > 1 || (FREERDP_VERSION_MAJOR == 1 && FREERDP_VERSION_MINOR >= 1))
             p_instance->settings->DesktopWidth,
             p_instance->settings->DesktopHeight,
             p_instance->settings->ColorDepth
#else
             p_instance->settings->width,
             p_instance->settings->height,
             p_instance->settings->color_depth
#endif
             );

    p_instance->update->DesktopResize = desktopResizeHandler;
    p_instance->update->BeginPaint = beginPaintHandler;
    p_instance->update->EndPaint = endPaintHandler;

    gdi_init( p_instance,
                CLRBUF_16BPP |
#if defined(FREERDP_VERSION_MAJOR) && defined(FREERDP_VERSION_MINOR) && \
    !(FREERDP_VERSION_MAJOR > 1 || (FREERDP_VERSION_MAJOR == 1 && FREERDP_VERSION_MINOR >= 2))
                CLRBUF_24BPP |
#endif
                CLRBUF_32BPP, NULL );

    desktopResizeHandler( p_instance->context );
    return true;
}
Exemplo n.º 6
0
BOOL android_post_connect(freerdp* instance)
{
	DEBUG_ANDROID("android_post_connect");

	freerdp_callback("OnSettingsChanged", "(IIII)V", instance,
			instance->settings->DesktopWidth, instance->settings->DesktopHeight,
			instance->settings->ColorDepth);

	instance->context->cache = cache_new(instance->settings);

	gdi_init(instance, CLRCONV_ALPHA | ((instance->settings->ColorDepth > 16) ? CLRBUF_32BPP : CLRBUF_16BPP), NULL);

	instance->update->BeginPaint = android_begin_paint;
	instance->update->EndPaint = android_end_paint;
	instance->update->DesktopResize = android_desktop_resize;

	android_cliprdr_init(instance);

	freerdp_channels_post_connect(instance->context->channels, instance);

	// send notifications 
	freerdp_callback("OnConnectionSuccess", "(I)V", instance);

	return TRUE;
}
Exemplo n.º 7
0
int
dfb_post_connect(rdpInst * inst)
{
	GDI *gdi;
	dfbInfo *dfbi = GET_DFBI(inst);

	gdi_init(inst);
	gdi = GET_GDI(inst);
	
	dfbi->err = DirectFBCreate(&(dfbi->dfb));

	dfbi->dsc.flags = DSDESC_CAPS;
	dfbi->dsc.caps = DSCAPS_PRIMARY;
	dfbi->err = dfbi->dfb->CreateSurface(dfbi->dfb, &(dfbi->dsc), &(dfbi->primary));
	dfbi->err = dfbi->primary->GetSize(dfbi->primary, &(gdi->width), &(gdi->height));
	dfbi->dfb->SetVideoMode(dfbi->dfb, gdi->width, gdi->height, gdi->dstBpp);
	dfbi->dfb->CreateInputEventBuffer(dfbi->dfb, DICAPS_ALL, DFB_TRUE, &(dfbi->event_buffer));
	dfbi->event_buffer->CreateFileDescriptor(dfbi->event_buffer, &(dfbi->read_fds));
	
	dfbi->dfb->GetDisplayLayer(dfbi->dfb, 0, &(dfbi->layer));
	dfbi->layer->EnableCursor(dfbi->layer, 1);
	
	dfbi->dsc.flags = DSDESC_CAPS | DSDESC_WIDTH | DSDESC_HEIGHT | DSDESC_PREALLOCATED | DSDESC_PIXELFORMAT;
	dfbi->dsc.caps = DSCAPS_SYSTEMONLY;
	dfbi->dsc.width = gdi->width;
	dfbi->dsc.height = gdi->height;
	dfbi->dsc.pixelformat = DSPF_AiRGB;
	dfbi->dsc.preallocated[0].data = gdi->primary_buffer;
	dfbi->dsc.preallocated[0].pitch = gdi->width * 4;
	dfbi->dfb->CreateSurface(dfbi->dfb, &(dfbi->dsc), &(dfbi->surface));

	return 0;
}
Exemplo n.º 8
0
BOOL wf_sw_desktop_resize(wfContext* wfc)
{
	rdpGdi* gdi;
	rdpContext* context;
	rdpSettings* settings;
	freerdp* instance = wfc->instance;

	context = (rdpContext*) wfc;
	settings = wfc->instance->settings;
	gdi = context->gdi;

	wfc->width = settings->DesktopWidth;
	wfc->height = settings->DesktopHeight;

	gdi->primary->bitmap->data = NULL;
	gdi_free(instance);

	if (wfc->primary)
	{
		wf_image_free(wfc->primary);
		wfc->primary = wf_image_new(wfc, wfc->width, wfc->height, wfc->dstBpp, NULL);
	}

	if (!gdi_init(instance, CLRCONV_ALPHA | CLRBUF_32BPP, wfc->primary->pdata))
		return FALSE;

	gdi = instance->context->gdi;
	wfc->hdc = gdi->primary->hdc;

	return TRUE;
}
Exemplo n.º 9
0
static BOOL tf_post_connect(freerdp* instance)
{
	if (!gdi_init(instance, PIXEL_FORMAT_XRGB32))
		return FALSE;

	instance->update->BeginPaint = tf_begin_paint;
	instance->update->EndPaint = tf_end_paint;
	return TRUE;
}
Exemplo n.º 10
0
BOOL df_post_connect(freerdp* instance)
{
    rdpGdi* gdi;
    dfInfo* dfi;
    dfContext* context;

    context = ((dfContext*) instance->context);
    dfi = context->dfi;

    gdi_init(instance, CLRCONV_ALPHA | CLRCONV_INVERT | CLRBUF_16BPP | CLRBUF_32BPP, NULL);
    gdi = instance->context->gdi;

    dfi->err = DirectFBCreate(&(dfi->dfb));

    dfi->dsc.flags = DSDESC_CAPS;
    dfi->dsc.caps = DSCAPS_PRIMARY;
    dfi->err = dfi->dfb->CreateSurface(dfi->dfb, &(dfi->dsc), &(dfi->primary));
    dfi->err = dfi->primary->GetSize(dfi->primary, &(gdi->width), &(gdi->height));
    dfi->dfb->SetVideoMode(dfi->dfb, gdi->width, gdi->height, gdi->dstBpp);
    dfi->dfb->CreateInputEventBuffer(dfi->dfb, DICAPS_ALL, DFB_TRUE, &(dfi->event_buffer));
    dfi->event_buffer->CreateFileDescriptor(dfi->event_buffer, &(dfi->read_fds));

    dfi->dfb->GetDisplayLayer(dfi->dfb, 0, &(dfi->layer));
    dfi->layer->EnableCursor(dfi->layer, 1);

    dfi->dsc.flags = DSDESC_CAPS | DSDESC_WIDTH | DSDESC_HEIGHT | DSDESC_PREALLOCATED | DSDESC_PIXELFORMAT;
    dfi->dsc.caps = DSCAPS_SYSTEMONLY;
    dfi->dsc.width = gdi->width;
    dfi->dsc.height = gdi->height;

    if (gdi->dstBpp == 32 || gdi->dstBpp == 24)
        dfi->dsc.pixelformat = DSPF_AiRGB;
    else if (gdi->dstBpp == 16 || gdi->dstBpp == 15)
        dfi->dsc.pixelformat = DSPF_RGB16;
    else if (gdi->dstBpp == 8)
        dfi->dsc.pixelformat = DSPF_RGB332;
    else
        dfi->dsc.pixelformat = DSPF_AiRGB;

    dfi->dsc.preallocated[0].data = gdi->primary_buffer;
    dfi->dsc.preallocated[0].pitch = gdi->width * gdi->bytesPerPixel;
    dfi->dfb->CreateSurface(dfi->dfb, &(dfi->dsc), &(dfi->surface));

    instance->update->BeginPaint = df_begin_paint;
    instance->update->EndPaint = df_end_paint;

    df_keyboard_init();

    pointer_cache_register_callbacks(instance->update);
    df_register_graphics(instance->context->graphics);

    freerdp_channels_post_connect(instance->context->channels, instance);

    return TRUE;
}
Exemplo n.º 11
0
void test_gdi_init(void)
{
	CU_ASSERT(gdi_init(inst) == 0);

	gdi = GET_GDI(inst);
	CU_ASSERT(gdi != NULL);

	CU_ASSERT(gdi->width == test_width);
	CU_ASSERT(gdi->height == test_height);
	CU_ASSERT(gdi->srcBpp == test_depth);
}
Exemplo n.º 12
0
boolean tf_post_connect(freerdp* instance)
{
	rdpGdi* gdi;

	gdi_init(instance, CLRCONV_ALPHA | CLRCONV_INVERT | CLRBUF_16BPP | CLRBUF_32BPP, NULL);
	gdi = instance->context->gdi;

	instance->update->BeginPaint = tf_begin_paint;
	instance->update->EndPaint = tf_end_paint;

	freerdp_channels_post_connect(instance->context->channels, instance);

	return true;
}
Exemplo n.º 13
0
int main(int argc, char* argv[])
{
	int fuse_stat;
	struct gd_state gd_data;

	int ret = gdi_init(&gd_data.gdi_data);
	if(ret != 0)
		return ret;

	// Start fuse
	fuse_stat = fuse_main(argc, argv, &gd_oper, &gd_data);
	/*  When we get here, fuse has finished.
	 *  Do any necessary cleanups.
	 */
	gdi_destroy(&gd_data.gdi_data);

	return fuse_stat;
}
Exemplo n.º 14
0
boolean tf_post_connect(freerdp* instance)
{
	GDI* gdi;
	tfInfo* tfi;

	tfi = GET_TFI(instance);
	SET_TFI(instance->update, tfi);

	gdi_init(instance, CLRCONV_ALPHA | CLRBUF_16BPP | CLRBUF_32BPP);
	gdi = GET_GDI(instance->update);

	instance->update->BeginPaint = tf_begin_paint;
	instance->update->EndPaint = tf_end_paint;

	freerdp_chanman_post_connect(GET_CHANMAN(instance), instance);

	return True;
}
Exemplo n.º 15
0
static BOOL shw_post_connect(freerdp* instance)
{
	rdpGdi* gdi;
	shwContext* shw;
	rdpSettings* settings;
	shw = (shwContext*) instance->context;
	settings = instance->settings;

	if (!gdi_init(instance, PIXEL_FORMAT_BGRX32))
		return FALSE;

	gdi = instance->context->gdi;
	instance->update->BeginPaint = shw_begin_paint;
	instance->update->EndPaint = shw_end_paint;
	instance->update->DesktopResize = shw_desktop_resize;
	instance->update->SurfaceFrameMarker = shw_surface_frame_marker;
	return TRUE;
}
Exemplo n.º 16
0
BOOL wl_post_connect(freerdp* instance)
{
	struct window* window;
	struct wl_context* context;

	context = (struct wl_context*) instance->context;

	window = malloc(sizeof(*window));
	window->width = instance->settings->DesktopWidth;
	window->height = instance->settings->DesktopHeight;
	window->buffers[0].busy = 0;
	window->buffers[1].busy = 0;
	window->callback = NULL;
	window->display = context->display;
	window->surface = wl_compositor_create_surface(window->display->compositor);
	window->shell_surface = wl_shell_get_shell_surface(window->display->shell, window->surface);

	wl_shell_surface_add_listener(window->shell_surface, &wl_shell_surface_listener, NULL);
	wl_shell_surface_set_title(window->shell_surface, "FreeRDP");
	wl_shell_surface_set_toplevel(window->shell_surface);
	wl_surface_damage(window->surface, 0, 0, window->width, window->height);

	 /* GC/GDI logic here */
	rdpGdi* gdi;

	gdi_init(instance, CLRCONV_ALPHA | CLRCONV_INVERT | CLRBUF_32BPP, NULL);
	gdi = instance->context->gdi;

	 /* fill buffer with first image here */
	window->data = malloc (gdi->width * gdi->height *4);
	memcpy(window->data, (void*) gdi->primary_buffer, gdi->width * gdi->height * 4);
	instance->update->BeginPaint = wl_begin_paint;
	instance->update->EndPaint = wl_end_paint;

	 /* put Wayland data in the context here */
	context->window = window;

	freerdp_channels_post_connect(instance->context->channels, instance);

	window_redraw(window, NULL, 0);

	return TRUE;
}
Exemplo n.º 17
0
BOOL shw_post_connect(freerdp* instance)
{
	rdpGdi* gdi;
	shwContext* shw;
	rdpSettings* settings;

	shw = (shwContext*) instance->context;
	settings = instance->settings;

	if (!gdi_init(instance, CLRBUF_32BPP, NULL))
		return FALSE;

	gdi = instance->context->gdi;

	instance->update->BeginPaint = shw_begin_paint;
	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) ;
}
Exemplo n.º 18
0
static BOOL wl_post_connect(freerdp* instance)
{
	rdpGdi* gdi;
	wlfWindow* window;
	wlfContext* context;

	if (!gdi_init(instance, CLRCONV_ALPHA | CLRBUF_32BPP, NULL))
		return FALSE;

	gdi = instance->context->gdi;
	if (!gdi)
		return FALSE;

	context = (wlfContext*) instance->context;
	window = wlf_CreateDesktopWindow(context, "FreeRDP", gdi->width, gdi->height, FALSE);
	if (!window)
		return FALSE;

	 /* fill buffer with first image here */
	window->data = malloc (gdi->width * gdi->height *4);
	if (!window->data)
		return FALSE;

	memcpy(window->data, (void*) gdi->primary_buffer, gdi->width * gdi->height * 4);
	instance->update->BeginPaint = wl_begin_paint;
	instance->update->EndPaint = wl_end_paint;

	 /* put Wayland data in the context here */
	context->window = window;

	if (freerdp_channels_post_connect(instance->context->channels, instance) < 0)
		return FALSE;

	wlf_UpdateWindowArea(context, window, 0, 0, gdi->width, gdi->height);

	return TRUE;
}
Exemplo n.º 19
0
/*
 * Initialize printing to a GDI printer.
 */
gdi_status_t
gdi_print_start(const char *printer_name, unsigned opts)
{
    const char *fail = "";

    if (!uparm.done) {
	/* Set the defaults. */
	uparm.orientation = 0;
	uparm.hmargin = 0.5;
	uparm.vmargin = 0.5;
	uparm.font_name = NULL;
	uparm.font_size = 0; /* auto */
	uparm.spp = 1;

	/* Gather up the parameters. */
	gdi_get_params(&uparm);

	/* Don't do this again. */
	uparm.done = true;
    }

    /* Initialize the printer and pop up the dialog. */
    switch (gdi_init(printer_name, opts, &fail)) {
    case GDI_STATUS_SUCCESS:
	vtrace("[gdi] initialized\n");
	break;
    case GDI_STATUS_ERROR:
	popup_an_error("Printer initialization error: %s", fail);
	return GDI_STATUS_ERROR;
    case GDI_STATUS_CANCEL:
	vtrace("[gdi] canceled\n");
	return GDI_STATUS_CANCEL;
    }

    return GDI_STATUS_SUCCESS;
}
Exemplo n.º 20
0
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;
}
Exemplo n.º 21
0
static BOOL remmina_rdp_post_connect(freerdp* instance)
{
    rfContext* rfi;
    RemminaProtocolWidget* gp;
    RemminaPluginRdpUiObject* ui;
    rdpGdi* gdi;
    UINT32 flags;

    rfi = (rfContext*) instance->context;
    gp = rfi->protocol_widget;

    rfi->width = rfi->settings->DesktopWidth;
    rfi->height = rfi->settings->DesktopHeight;
    rfi->srcBpp = rfi->settings->ColorDepth;

    if (rfi->settings->RemoteFxCodec == FALSE)
        rfi->sw_gdi = TRUE;

    rf_register_graphics(instance->context->graphics);

    flags = CLRCONV_ALPHA;

    if (rfi->bpp == 32)
    {
        flags |= CLRBUF_32BPP;
        rfi->cairo_format = CAIRO_FORMAT_ARGB32;
    }
    else if (rfi->bpp == 24)
    {
        flags |= CLRBUF_24BPP;
        rfi->cairo_format = CAIRO_FORMAT_RGB24;
    }
    else
    {
        flags |= CLRBUF_16BPP;
        rfi->cairo_format = CAIRO_FORMAT_RGB16_565;
    }

    gdi_init(instance, flags, NULL);
    gdi = instance->context->gdi;
    rfi->primary_buffer = gdi->primary_buffer;

    rfi->hdc = gdi_GetDC();
    rfi->hdc->bitsPerPixel = rfi->bpp;
    rfi->hdc->bytesPerPixel = rfi->bpp / 8;

    rfi->hdc->hwnd = (HGDI_WND) malloc(sizeof(GDI_WND));
    rfi->hdc->hwnd->invalid = gdi_CreateRectRgn(0, 0, 0, 0);
    rfi->hdc->hwnd->invalid->null = 1;

    rfi->hdc->hwnd->count = 32;
    rfi->hdc->hwnd->cinvalid = (HGDI_RGN) malloc(sizeof(GDI_RGN) * rfi->hdc->hwnd->count);
    rfi->hdc->hwnd->ninvalid = 0;

    pointer_cache_register_callbacks(instance->update);

    /*
    	if (rfi->sw_gdi != true)
    	{
    		glyph_cache_register_callbacks(instance->update);
    		brush_cache_register_callbacks(instance->update);
    		bitmap_cache_register_callbacks(instance->update);
    		offscreen_cache_register_callbacks(instance->update);
    		palette_cache_register_callbacks(instance->update);
    	}
    */

    instance->update->BeginPaint = rf_begin_paint;
    instance->update->EndPaint = rf_end_paint;
    instance->update->DesktopResize = rf_desktop_resize;

    freerdp_channels_post_connect(rfi->channels, instance);

    remmina_plugin_service->protocol_plugin_emit_signal(gp, "connect");

    ui = g_new0(RemminaPluginRdpUiObject, 1);
    ui->type = REMMINA_RDP_UI_CONNECTED;
    rf_queue_ui(gp, ui);

    return True;
}
Exemplo n.º 22
0
static RET_CODE mmi_init(void)
{
  rsc_palette_t hdr_pal;
  palette_t pal;
  u8 *bits;
  u32 p_addr;
  BOOL ret = FALSE;
  handle_t rsc_handle = 0;
  paint_param_t paint_param = {0};
  
  gdi_config_t info =
  {
    /* color format */
#ifdef WIN32
     COLORFORMAT_RGB4BIT,
#else
     COLORFORMAT_RGB8BIT,
#endif
    /* screen rectangle */
    {SCREEN_POS_PAL_L, SCREEN_POS_PAL_T,
     SCREEN_POS_PAL_L + SCREEN_WIDTH,
     SCREEN_POS_PAL_T + SCREEN_HEIGHT},
    /* palette */
    &pal,
    /* default color */
    //C_TRANS,
    C_BLACK,
    /* color key */
    C_KEY,
    /* osd odd vmem */
    NULL,
    /* odd vmem size + ctrlword + palette */
    150 * KBYTES + 2 * KBYTES,
    /* osd even vmem */
    NULL,
    /* even vmem size*/
    150 * KBYTES,
    /* virtual buffer addr */
    0,
    /* virtual surface size */
    0 * KBYTES,
    /* surface cnt */
    MAX_SURFACE_CNT,
    /* cliprect cnt */
    MAX_CLIPRECT_CNT,
    /* dc cnt */
    MAX_DC_CNT,
  };

  // init osd frame buffer
  p_addr = mem_mgr_require_block(
    BLOCK_OSD0_8BIT_BUFFER,
    SYS_MODULE_GDI);
  MT_ASSERT(p_addr != 0);

  mem_mgr_release_block(BLOCK_OSD0_8BIT_BUFFER);

  info.p_odd_addr = (u32 *)p_addr;
  info.p_even_addr = (u32 *)(p_addr + info.odd_size);
  
  mmi_init_heap(GUI_PARTITION_SIZE);

  g_rsc_config.rsc_data_addr = (u32)ota_rsc_data;

  rsc_handle = rsc_init(&g_rsc_config);
  
 if(sys_static_read_ota_language() == 0)
  {
    rsc_set_curn_language(rsc_handle,LANGUAGE_CHINESE);
  }
 else
  {
    rsc_set_curn_language(rsc_handle,LANGUAGE_ENGLISH);
  }

  ret = rsc_get_palette(rsc_handle,1, &hdr_pal, (u8**)&bits);
  pal.cnt = hdr_pal.color_num;
  pal.p_entry = (color_t *)bits;
  pal.p_entry[C_TRANS].a = 0;
  rsc_set_curn_palette(rsc_handle,1);

#ifndef WIN32
  gdi_init_v2(&info);
#else
  gdi_init(&info);
#endif

  gdi_set_global_alpha_montage(255);

  ctrl_init_lib(MAX_CLASS_CNT, MAX_OBJ_CNT);
  ctrl_str_init(MAX_CTRL_STRING_BUF_SIZE);

  cont_register_class(MAX_OBJECT_NUMBER_CNT);
  cbox_register_class(MAX_OBJECT_NUMBER_CBB);
  text_register_class(MAX_OBJECT_NUMBER_TXT);
  pbar_register_class(MAX_OBJECT_NUMBER_PGB);
  nbox_register_class(MAX_OBJECT_NUMBER_NUM);

  paint_param.max_str_len = MAX_PAINT_STRING_LENGTH;
  paint_param.max_str_lines = MAX_PAINT_STRING_LINES;
  paint_param.rsc_handle = rsc_handle;
  gui_paint_init(&paint_param);

  return SUCCESS;
}
Exemplo n.º 23
0
BOOL wf_post_connect(freerdp* instance)
{
	rdpGdi* gdi;
	DWORD dwStyle;
	rdpCache* cache;
	wfContext* wfc;
	rdpContext* context;
	WCHAR lpWindowName[64];
	rdpSettings* settings;
	EmbedWindowEventArgs e;

	settings = instance->settings;
	context = instance->context;
	wfc = (wfContext*) instance->context;
	cache = instance->context->cache;

	wfc->dstBpp = 32;
	wfc->width = settings->DesktopWidth;
	wfc->height = settings->DesktopHeight;

	if (settings->SoftwareGdi)
	{
		wfc->primary = wf_image_new(wfc, wfc->width, wfc->height, wfc->dstBpp, NULL);

		if (!gdi_init(instance, CLRCONV_ALPHA | CLRBUF_32BPP, wfc->primary->pdata))
			return FALSE;

		gdi = instance->context->gdi;
		wfc->hdc = gdi->primary->hdc;
	}
	else
	{
		wf_gdi_register_update_callbacks(instance->update);
		wfc->srcBpp = instance->settings->ColorDepth;
		wfc->primary = wf_image_new(wfc, wfc->width, wfc->height, wfc->dstBpp, NULL);

		if (!(wfc->hdc = gdi_GetDC()))
			return FALSE;

		wfc->hdc->bitsPerPixel = wfc->dstBpp;
		wfc->hdc->bytesPerPixel = wfc->dstBpp / 8;

		wfc->hdc->alpha = wfc->clrconv->alpha;
		wfc->hdc->invert = wfc->clrconv->invert;

		wfc->hdc->hwnd = (HGDI_WND) malloc(sizeof(GDI_WND));
		wfc->hdc->hwnd->invalid = gdi_CreateRectRgn(0, 0, 0, 0);
		wfc->hdc->hwnd->invalid->null = 1;

		wfc->hdc->hwnd->count = 32;
		wfc->hdc->hwnd->cinvalid = (HGDI_RGN) malloc(sizeof(GDI_RGN) * wfc->hdc->hwnd->count);
		wfc->hdc->hwnd->ninvalid = 0;

		if (settings->RemoteFxCodec)
		{
			wfc->tile = wf_image_new(wfc, 64, 64, 32, NULL);
		}
	}

	if (settings->WindowTitle != NULL)
		_snwprintf(lpWindowName, ARRAYSIZE(lpWindowName), L"%S", settings->WindowTitle);
	else if (settings->ServerPort == 3389)
		_snwprintf(lpWindowName, ARRAYSIZE(lpWindowName), L"FreeRDP: %S", settings->ServerHostname);
	else
		_snwprintf(lpWindowName, ARRAYSIZE(lpWindowName), L"FreeRDP: %S:%d", settings->ServerHostname, settings->ServerPort);

	if (settings->EmbeddedWindow)
		settings->Decorations = FALSE;

	if (wfc->fullscreen)
		dwStyle = WS_POPUP;
	else if (!settings->Decorations)
		dwStyle = WS_CHILD | WS_BORDER;
	else
		dwStyle = WS_CAPTION | WS_OVERLAPPED | WS_SYSMENU | WS_MINIMIZEBOX | WS_SIZEBOX | WS_MAXIMIZEBOX;

	if (!wfc->hwnd)
	{
		wfc->hwnd = CreateWindowEx((DWORD) NULL, wfc->wndClassName, lpWindowName, dwStyle,
			0, 0, 0, 0, wfc->hWndParent, NULL, wfc->hInstance, NULL);

		SetWindowLongPtr(wfc->hwnd, GWLP_USERDATA, (LONG_PTR) wfc);
	}

	wf_resize_window(wfc);

	wf_add_system_menu(wfc);

	BitBlt(wfc->primary->hdc, 0, 0, wfc->width, wfc->height, NULL, 0, 0, BLACKNESS);
	wfc->drawing = wfc->primary;

	EventArgsInit(&e, "wfreerdp");
	e.embed = FALSE;
	e.handle = (void*) wfc->hwnd;
	PubSub_OnEmbedWindow(context->pubSub, context, &e);

	ShowWindow(wfc->hwnd, SW_SHOWNORMAL);
	UpdateWindow(wfc->hwnd);

	if (settings->SoftwareGdi)
	{
		instance->update->BeginPaint = (pBeginPaint) wf_sw_begin_paint;
		instance->update->EndPaint = (pEndPaint) wf_sw_end_paint;
		instance->update->DesktopResize = (pDesktopResize) wf_sw_desktop_resize;
	}
	else
	{
		instance->update->BeginPaint = (pBeginPaint) wf_hw_begin_paint;
		instance->update->EndPaint = (pEndPaint) wf_hw_end_paint;
		instance->update->DesktopResize = (pDesktopResize) wf_hw_desktop_resize;
	}

	pointer_cache_register_callbacks(instance->update);
	wf_register_pointer(context->graphics);

	if (!settings->SoftwareGdi)
	{
		brush_cache_register_callbacks(instance->update);
		bitmap_cache_register_callbacks(instance->update);
		offscreen_cache_register_callbacks(instance->update);
		wf_register_graphics(context->graphics);
		instance->update->BitmapUpdate = wf_gdi_bitmap_update;
	}

	freerdp_channels_post_connect(context->channels, instance);

	if (wfc->fullscreen)
		floatbar_window_create(wfc);

	return TRUE;
}
Exemplo n.º 24
0
BOOL wf_post_connect(freerdp* instance)
{
	rdpGdi* gdi;
	wfInfo* wfi;
	rdpCache* cache;
	wfContext* context;
	WCHAR lpWindowName[64];
	rdpSettings* settings;

	settings = instance->settings;
	context = (wfContext*) instance->context;
	cache = instance->context->cache;
	wfi = context->wfi;

	wfi->dstBpp = 32;
	wfi->width = settings->DesktopWidth;
	wfi->height = settings->DesktopHeight;

	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, wfi->width, wfi->height, wfi->dstBpp, gdi->primary_buffer);
	}
	else
	{
		wf_gdi_register_update_callbacks(instance->update);
		wfi->srcBpp = instance->settings->ColorDepth;
		wfi->primary = wf_image_new(wfi, wfi->width, wfi->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) malloc(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) malloc(sizeof(GDI_RGN) * wfi->hdc->hwnd->count);
		wfi->hdc->hwnd->ninvalid = 0;

		if (settings->RemoteFxCodec)
		{
			wfi->tile = wf_image_new(wfi, 64, 64, 32, NULL);
			wfi->rfx_context = rfx_context_new();
		}

		if (settings->NSCodec)
		{
			wfi->nsc_context = nsc_context_new();
		}
	}

	if (settings->WindowTitle != NULL)
		_snwprintf(lpWindowName, ARRAYSIZE(lpWindowName), L"%S", settings->WindowTitle);
	else if (settings->ServerPort == 3389)
		_snwprintf(lpWindowName, ARRAYSIZE(lpWindowName), L"FreeRDP: %S", settings->ServerHostname);
	else
		_snwprintf(lpWindowName, ARRAYSIZE(lpWindowName), L"FreeRDP: %S:%d", settings->ServerHostname, settings->ServerPort);

	if (!wfi->hwnd)
	{
		wfi->hwnd = CreateWindowEx((DWORD) NULL, wfi->wndClassName, lpWindowName,
			0, 0, 0, 0, 0, wfi->hWndParent, NULL, wfi->hInstance, NULL);

		SetWindowLongPtr(wfi->hwnd, GWLP_USERDATA, (LONG_PTR) wfi);
	}

	wf_resize_window(wfi);

	BitBlt(wfi->primary->hdc, 0, 0, wfi->width, wfi->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;
		instance->update->DesktopResize = wf_sw_desktop_resize;
	}
	else
	{
		instance->update->BeginPaint = wf_hw_begin_paint;
		instance->update->EndPaint = wf_hw_end_paint;
		instance->update->DesktopResize = wf_hw_desktop_resize;
	}

	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);

	wf_cliprdr_init(wfi, instance->context->channels);

	return TRUE;
}