Beispiel #1
0
static RD_HCURSOR
l_ui_create_cursor(struct rdp_inst * inst, uint32 x, uint32 y,
	int width, int height, uint8 * andmask, uint8 * xormask, int bpp)
{
	wfInfo * wfi;
	HCURSOR cursor;
	ICONINFO iconinfo;
	uint8 * cdata;

	wfi = GET_WFI(inst);
	if (bpp == 1)
	{
		cursor = CreateCursor(g_hInstance, x, y, width, height, andmask, xormask);
	}
	else
	{
		iconinfo.fIcon = FALSE;
		iconinfo.xHotspot = x;
		iconinfo.yHotspot = y;
		cdata = wf_cursor_mask_convert(wfi, width, height, andmask);
		iconinfo.hbmMask = CreateBitmap(width, height, 1, 1, cdata);
		iconinfo.hbmColor = wf_create_dib(wfi, width, height, bpp, 0, xormask);
		cursor = CreateIconIndirect(&iconinfo);
		DeleteObject(iconinfo.hbmMask);
		DeleteObject(iconinfo.hbmColor);
		free(cdata);
	}
	return (RD_HCURSOR)cursor;
}
Beispiel #2
0
static void
l_ui_line(struct rdp_inst * inst, uint8 opcode, int startx, int starty, int endx,
	int endy, RD_PEN * pen)
{
	wfInfo * wfi;
	HPEN hpen;
	HPEN org_hpen;
	int color;
	int org_rop2;

	wfi = GET_WFI(inst);
	//printf("ui_line opcode %d startx %d starty %d endx %d endy %d\n", opcode, startx, starty, endx, endy);
	color = wf_color_convert(wfi, pen->color, inst->settings->server_depth);
	hpen = CreatePen(pen->style, pen->width, color);
	org_rop2 = SetROP2(wfi->drw->hdc, opcode + 1);
	org_hpen = (HPEN)SelectObject(wfi->drw->hdc, hpen);
	MoveToEx(wfi->drw->hdc, startx, starty, NULL);
	LineTo(wfi->drw->hdc, endx, endy);
	SelectObject(wfi->drw->hdc, org_hpen);
	SetROP2 (wfi->drw->hdc, org_rop2);
	DeleteObject(hpen);
	if (wfi->drw == wfi->backstore)
	{
		wf_invalidate_region(wfi, min(startx, endx), min(starty, endy), max(startx, endx), max(starty, endy));
	}
}
Beispiel #3
0
static void
l_ui_reset_clip(struct rdp_inst * inst)
{
	wfInfo * wfi = GET_WFI(inst);
	/* printf("ui_reset_clip\n"); */
	SelectClipRgn(wfi->drw->hdc, NULL);
}
Beispiel #4
0
static void
l_ui_set_cursor(struct rdp_inst * inst, RD_HCURSOR cursor)
{
	wfInfo * wfi = GET_WFI(inst);
	wfi->cursor = (HCURSOR)cursor;
	PostMessage(wfi->hwnd, WM_SETCURSOR, 0, 0);
}
Beispiel #5
0
static void
l_ui_patblt(struct rdp_inst * inst, uint8 opcode, int x, int y, int cx, int cy,
	RD_BRUSH * brush, int bgcolor, int fgcolor)
{
	wfInfo * wfi;
	HBRUSH br;
	HBRUSH org_br;
	int org_bkmode;
	COLORREF org_bkcolor;
	COLORREF org_textcolor;

	wfi = GET_WFI(inst);
	//printf("ui_patblt: style %d x %d y %d cx %d cy %d\n", brush->style, x, y, cx, cy);
	bgcolor = wf_color_convert(wfi, bgcolor, inst->settings->server_depth);
	fgcolor = wf_color_convert(wfi, fgcolor, inst->settings->server_depth);

	br = wf_create_brush(wfi, brush, fgcolor, inst->settings->server_depth);
	org_bkmode = SetBkMode(wfi->drw->hdc, OPAQUE);
	org_bkcolor = SetBkColor(wfi->drw->hdc, bgcolor);
	org_textcolor = SetTextColor(wfi->drw->hdc, fgcolor);
	org_br = (HBRUSH)SelectObject(wfi->drw->hdc, br);
	PatBlt(wfi->drw->hdc, x, y, cx, cy, rop3_code_table[opcode]);
	SelectObject(wfi->drw->hdc, org_br);
	DeleteObject(br);
	SetBkMode(wfi->drw->hdc, org_bkmode);
	SetBkColor(wfi->drw->hdc, org_bkcolor);
	SetTextColor(wfi->drw->hdc, org_textcolor);
	if (wfi->drw == wfi->backstore)
	{
		wf_invalidate_region(wfi, x, y, x + cx, y + cy);
	}
}
Beispiel #6
0
int
wf_post_connect(rdpInst * inst)
{
	wfInfo * wfi;
	int width;
	int height;
	RECT rc_client, rc_wnd;
	POINT diff;

	wfi = GET_WFI(inst);
	width = inst->settings->width;
	height = inst->settings->height;

	wfi->backstore = wf_bitmap_new(wfi, width, height, 0, 0, NULL);
	BitBlt(wfi->backstore->hdc, 0, 0, width, height, NULL, 0, 0, BLACKNESS);
	wfi->drw = wfi->backstore;

	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;
	MoveWindow(wfi->hwnd, rc_wnd.left, rc_wnd.top, width + diff.x, height + diff.y, FALSE);
	ShowWindow(wfi->hwnd, SW_SHOWNORMAL);
	UpdateWindow(wfi->hwnd);

	return 0;
}
Beispiel #7
0
static void
l_ui_move_pointer(struct rdp_inst * inst, int x, int y)
{
	wfInfo * wfi;

	wfi = GET_WFI(inst);
	//TODO
}
Beispiel #8
0
static void
l_ui_set_colormap(struct rdp_inst * inst, RD_HPALETTE map)
{
	wfInfo * wfi;

	wfi = GET_WFI(inst);
	wf_set_colormap(wfi, map);
}
Beispiel #9
0
static RD_HPALETTE
l_ui_create_colormap(struct rdp_inst * inst, RD_PALETTE * colors)
{
	wfInfo * wfi;

	wfi = GET_WFI(inst);
	return wf_create_colormap(wfi, colors);
}
Beispiel #10
0
static void
l_ui_triblt(struct rdp_inst * inst, uint8 opcode, int x, int y, int cx, int cy,
	RD_HBITMAP src, int srcx, int srcy, RD_BRUSH * brush, uint32 bgcolor, uint32 fgcolor)
{
	wfInfo * wfi = GET_WFI(inst);
	printf("ui_triblt\n");
	/* TODO */
}
Beispiel #11
0
static void
l_ui_start_draw_glyphs(struct rdp_inst * inst, int bgcolor, int fgcolor)
{
	wfInfo * wfi;

	wfi = GET_WFI(inst);
	wfi->brush = CreateSolidBrush(wf_color_convert(wfi, fgcolor, inst->settings->server_depth));
	wfi->org_brush = (HBRUSH)SelectObject(wfi->drw->hdc, wfi->brush);
}
Beispiel #12
0
static void
l_ui_end_draw_glyphs(struct rdp_inst * inst, int x, int y, int cx, int cy)
{
	wfInfo * wfi = GET_WFI(inst);
	SelectObject(wfi->drw->hdc, wfi->org_brush);
	DeleteObject(wfi->brush);
	wfi->brush = NULL;
	wfi->org_brush = NULL;
}
Beispiel #13
0
static void
l_ui_set_default_cursor(struct rdp_inst * inst)
{
	wfInfo * wfi;

	wfi = GET_WFI(inst);
	wfi->cursor = g_default_cursor;
	PostMessage(wfi->hwnd, WM_SETCURSOR, 0, 0);
}
Beispiel #14
0
static void
l_ui_start_draw_glyphs(struct rdp_inst * inst, uint32 bgcolor, uint32 fgcolor)
{
	wfInfo * wfi = GET_WFI(inst);

	fgcolor = gdi_color_convert(fgcolor, inst->settings->server_depth, 24, wfi->clrconv);
	wfi->brush = CreateSolidBrush(fgcolor);
	wfi->org_brush = (HBRUSH)SelectObject(wfi->drw->hdc, wfi->brush);
}
Beispiel #15
0
static void
l_ui_set_palette(struct rdp_inst * inst, RD_HPALETTE palette)
{
	wfInfo * wfi = GET_WFI(inst);

	if (wfi->palette != NULL)
		free(wfi->palette);

	wfi->palette = (RD_PALETTE*) palette;
}
Beispiel #16
0
static RD_HBITMAP
l_ui_create_bitmap(struct rdp_inst * inst, int width, int height, uint8 * data)
{
	wfInfo * wfi;
	struct wf_bitmap * bm;

	wfi = GET_WFI(inst);
	bm = wf_bitmap_new(wfi, width, height, inst->settings->server_depth, 1, data);
	return (RD_HBITMAP) bm;
}
Beispiel #17
0
static void
l_ui_destblt(struct rdp_inst * inst, uint8 opcode, int x, int y, int cx, int cy)
{
	wfInfo * wfi = GET_WFI(inst);

	BitBlt(wfi->drw->hdc, x, y, cx, cy, NULL, 0, 0, rop3_code_table[opcode]);
	if (wfi->drw == wfi->backstore)
	{
		wf_invalidate_region(wfi, x, y, x + cx, y + cy);
	}
}
Beispiel #18
0
static void
l_ui_set_clip(struct rdp_inst * inst, int x, int y, int cx, int cy)
{
	wfInfo * wfi;
	HRGN hrgn;

	wfi = GET_WFI(inst);
	//printf("ui_set_clip %i %i %i %i\n", x, y, cx, cy);
	hrgn = CreateRectRgn(x, y, x + cx, y + cy);
	SelectClipRgn(wfi->drw->hdc, hrgn);
	DeleteObject(hrgn);
}
Beispiel #19
0
static void
l_ui_screenblt(struct rdp_inst * inst, uint8 opcode, int x, int y, int cx, int cy, int srcx, int srcy)
{
	wfInfo * wfi = GET_WFI(inst);
	//printf("ui_screenblt: opcode %d x %d y %d cx %d cy %d srcx %d srcy %d \n", opcode, x, y, cx, cy, srcx, srcy);
	BitBlt(wfi->drw->hdc, x, y, cx, cy, wfi->backstore->hdc, srcx, srcy, rop3_code_table[opcode]); /* The source surface is always the primary drawing surface */

	if (wfi->drw == wfi->backstore)
	{
		wf_invalidate_region(wfi, x, y, x + cx, y + cy);
	}
}
Beispiel #20
0
static void
l_ui_destroy_cursor(struct rdp_inst * inst, RD_HCURSOR cursor)
{
	wfInfo * wfi = GET_WFI(inst);

	if (wfi->cursor == (HCURSOR)cursor)
	{
		wfi->cursor = g_default_cursor;
		PostMessage(wfi->hwnd, WM_SETCURSOR, 0, 0);
	}
	DestroyCursor((HCURSOR)cursor);
}
Beispiel #21
0
int
wf_update_window(rdpInst * inst)
{
	wfInfo * wfi;

	wfi = GET_WFI(inst);
	if (wfi->update_pending)
	{
		InvalidateRect(wfi->hwnd, &wfi->update_rect, FALSE);
		wfi->update_pending = 0;
		return 1;
	}
	return 0;
}
Beispiel #22
0
static void
l_ui_paint_bitmap(struct rdp_inst * inst, int x, int y, int cx, int cy, int width,
	int height, uint8 * data)
{
	wfInfo * wfi;
	struct wf_bitmap * bm;

	wfi = GET_WFI(inst);
	//printf("ui_paint_bitmap x %d y %d cx %d cy %d width %d height %d\n", x, y, cx, cy, width, height);
	bm = (struct wf_bitmap *) l_ui_create_bitmap(inst, width, height, data);
	BitBlt(wfi->backstore->hdc, x, y, cx, cy, bm->hdc, 0, 0, SRCCOPY);
	wf_bitmap_free(bm);
	wf_invalidate_region(wfi, x, y, x + cx, y + cy);
}
Beispiel #23
0
static void
l_ui_draw_glyph(struct rdp_inst * inst, int x, int y, int cx, int cy, RD_HGLYPH glyph)
{
	wfInfo * wfi;
	struct wf_bitmap * bm;

	wfi = GET_WFI(inst);
	bm = (struct wf_bitmap *) glyph;
	BitBlt(wfi->drw->hdc, x, y, cx, cy, bm->hdc, 0, 0, 0x00E20746); /* DSPDxax */

	if (wfi->drw == wfi->backstore)
	{
		wf_invalidate_region(wfi, x, y, x + cx, y + cy);
	}
}
Beispiel #24
0
static void
l_ui_set_surface(struct rdp_inst * inst, RD_HBITMAP surface)
{
	wfInfo * wfi;

	wfi = GET_WFI(inst);
	if (surface != 0)
	{
		wfi->drw = (struct wf_bitmap *) surface;
	}
	else
	{
		wfi->drw = wfi->backstore;
	}
}
Beispiel #25
0
static void
l_ui_destroy_surface(struct rdp_inst * inst, RD_HBITMAP surface)
{
	wfInfo * wfi = GET_WFI(inst);

	if (wfi->drw == surface)
	{
		l_ui_warning(inst, "ui_destroy_surface: freeing active surface!\n");
		wfi->drw = wfi->backstore;
	}
	if (surface != 0)
	{
		wf_bitmap_free((struct wf_bitmap *)surface);
	}
}
Beispiel #26
0
void
wf_uninit(rdpInst * inst)
{
	wfInfo * wfi;

	wfi = GET_WFI(inst);
	/* Inform the main thread to destroy the window */
	SetWindowLongPtr(wfi->hwnd, GWLP_USERDATA, -1);
	CloseWindow(wfi->hwnd);
	wf_bitmap_free(wfi->backstore);
	if (wfi->colormap != 0)
	{
		free(wfi->colormap);
	}
	free(wfi);
}
Beispiel #27
0
static void
l_ui_memblt(struct rdp_inst * inst, uint8 opcode, int x, int y, int cx, int cy,
	RD_HBITMAP src, int srcx, int srcy)
{
	wfInfo * wfi;
	struct wf_bitmap * bm;

	wfi = GET_WFI(inst);
	bm = (struct wf_bitmap *) src;
	//printf("ui_memblt %i %i %i %i %i %i %i\n", x, y, cx, cy, srcx, srcy, opcode);
	BitBlt(wfi->drw->hdc, x, y, cx, cy, bm->hdc, srcx, srcy, rop3_code_table[opcode]);
	if (wfi->drw == wfi->backstore)
	{
		wf_invalidate_region(wfi, x, y, x + cx, y + cy);
	}
}
Beispiel #28
0
static void
l_ui_polyline(struct rdp_inst * inst, uint8 opcode, RD_POINT * points, int npoints,
	RD_PEN * pen)
{
	wfInfo * wfi;
	HPEN hpen;
	HPEN org_hpen;
	int color;
	int org_rop2;
	int i;
	POINT * ps;

	wfi = GET_WFI(inst);
	//printf("ui_polyline opcode %d npoints %d\n", opcode, npoints);
	color = wf_color_convert(wfi, pen->color, inst->settings->server_depth);
	hpen = CreatePen(pen->style, pen->width, color);
	org_rop2 = SetROP2(wfi->drw->hdc, opcode + 1);
	org_hpen = (HPEN)SelectObject(wfi->drw->hdc, hpen);
	if (npoints > 0)
	{
		ps = (POINT *) malloc(sizeof(POINT) * npoints);
		for (i = 0; i < npoints; i++)
		{
			//printf("ui_polyline point %d %d %d\n", i, points[i].x, points[i].y);
			if (i == 0)
			{
				ps[i].x = points[i].x;
				ps[i].y = points[i].y;
			}
			else
			{
				ps[i].x = ps[i - 1].x + points[i].x;
				ps[i].y = ps[i - 1].y + points[i].y;
			}
			if (wfi->drw == wfi->backstore)
			{
				wf_invalidate_region(wfi, ps[i].x, ps[i].y, ps[i].x + 1, ps[i].y + 1);
			}
		}
		Polyline(wfi->drw->hdc, ps, npoints);
	}
	SelectObject(wfi->drw->hdc, org_hpen);
	SetROP2 (wfi->drw->hdc, org_rop2);
	DeleteObject(hpen);
}
Beispiel #29
0
static RD_HGLYPH
l_ui_create_glyph(struct rdp_inst * inst, int width, int height, uint8 * data)
{
	wfInfo * wfi;
	uint8 * cdata;
	HDC hdc;
	struct wf_bitmap * bm;

	wfi = GET_WFI(inst);
	hdc = GetDC(NULL);
	bm = (struct wf_bitmap *) malloc(sizeof(struct wf_bitmap));
	bm->hdc = CreateCompatibleDC(hdc);
	cdata = wf_glyph_convert(wfi, width, height, data);
	bm->bitmap = CreateBitmap(width, height, 1, 1, cdata);
	bm->org_bitmap = (HBITMAP)SelectObject(bm->hdc, bm->bitmap);
	free(cdata);
	ReleaseDC(NULL, hdc);
	return (RD_HGLYPH)bm;
}
Beispiel #30
0
static RD_HBITMAP
l_ui_create_surface(struct rdp_inst * inst, int width, int height, RD_HBITMAP old_surface)
{
	wfInfo * wfi;
	struct wf_bitmap * bm;
	struct wf_bitmap * old_bm;

	wfi = GET_WFI(inst);
	bm = wf_bitmap_new(wfi, width, height, 0, 0, NULL);
	old_bm = (struct wf_bitmap *) old_surface;
	if (old_bm != 0)
	{
		BitBlt(bm->hdc, 0, 0, width, height, old_bm->hdc, 0, 0, SRCCOPY);
		wf_bitmap_free(old_bm);
	}
	if (wfi->drw == old_bm)
	{
		wfi->drw = bm;
	}
	return (RD_HBITMAP)bm;
}