Example #1
0
void xf_Bitmap_SetSurface(rdpContext* context, rdpBitmap* bitmap, BOOL primary)
{
	xfContext* xfc = (xfContext*) context;

	xf_lock_x11(xfc, FALSE);

	if (primary)
		xfc->drawing = xfc->primary;
	else
		xfc->drawing = ((xfBitmap*) bitmap)->pixmap;

	xf_unlock_x11(xfc, FALSE);
}
Example #2
0
/* Pointer Class */
static BOOL xf_Pointer_New(rdpContext* context, rdpPointer* pointer)
{
#ifdef WITH_XCURSOR
	UINT32 CursorFormat;
	size_t size;
	XcursorImage ci;
	xfContext* xfc = (xfContext*) context;
	xfPointer* xpointer = (xfPointer*)pointer;

	if (!context || !pointer || !context->gdi)
		return FALSE;

	if (!xfc->invert)
		CursorFormat = (!xfc->big_endian) ? PIXEL_FORMAT_RGBA32 : PIXEL_FORMAT_ABGR32;
	else
		CursorFormat = (!xfc->big_endian) ? PIXEL_FORMAT_BGRA32 : PIXEL_FORMAT_ARGB32;

	xf_lock_x11(xfc, FALSE);
	ZeroMemory(&ci, sizeof(ci));
	ci.version = XCURSOR_IMAGE_VERSION;
	ci.size = sizeof(ci);
	ci.width = pointer->width;
	ci.height = pointer->height;
	ci.xhot = pointer->xPos;
	ci.yhot = pointer->yPos;
	size = ci.height * ci.width * GetBytesPerPixel(CursorFormat);

	if (!(ci.pixels = (XcursorPixel*) _aligned_malloc(size, 16)))
	{
		xf_unlock_x11(xfc, FALSE);
		return FALSE;
	}

	if (!freerdp_image_copy_from_pointer_data(
	        (BYTE*) ci.pixels, CursorFormat,
	        0, 0, 0, pointer->width, pointer->height,
	        pointer->xorMaskData, pointer->lengthXorMask,
	        pointer->andMaskData, pointer->lengthAndMask,
	        pointer->xorBpp, &context->gdi->palette))
	{
		_aligned_free(ci.pixels);
		xf_unlock_x11(xfc, FALSE);
		return FALSE;
	}

	xpointer->cursor = XcursorImageLoadCursor(xfc->display, &ci);
	_aligned_free(ci.pixels);
	xf_unlock_x11(xfc, FALSE);
#endif
	return TRUE;
}
Example #3
0
/* Bitmap Class */
static BOOL xf_Bitmap_New(rdpContext* context, rdpBitmap* bitmap)
{
	int depth;
	BYTE* data;
	Pixmap pixmap;
	XImage* image;
	UINT32 SrcFormat;
	rdpGdi* gdi;
	xfContext* xfc = (xfContext*) context;
	gdi = context->gdi;
	xf_lock_x11(xfc, FALSE);
	data = bitmap->data;
	depth = GetBitsPerPixel(bitmap->format);
	pixmap = XCreatePixmap(xfc->display, xfc->drawable, bitmap->width,
	                       bitmap->height, xfc->depth);

	if (bitmap->data)
	{
		XSetFunction(xfc->display, xfc->gc, GXcopy);

		if (depth != xfc->depth)
		{
			if (!(data = _aligned_malloc(bitmap->width * bitmap->height * 4, 16)))
			{
				xf_unlock_x11(xfc, FALSE);
				return FALSE;
			}

			SrcFormat = bitmap->format;
			freerdp_image_copy(data, gdi->dstFormat, 0, 0, 0,
			                   bitmap->width, bitmap->height,
			                   bitmap->data, SrcFormat,
			                   0, 0, 0, &context->gdi->palette, FREERDP_FLIP_NONE);
			_aligned_free(bitmap->data);
			bitmap->data = data;
			bitmap->format = gdi->dstFormat;
		}

		image = XCreateImage(xfc->display, xfc->visual, xfc->depth,
		                     ZPixmap, 0, (char*) bitmap->data, bitmap->width, bitmap->height,
		                     xfc->scanline_pad, 0);
		XPutImage(xfc->display, pixmap, xfc->gc, image, 0, 0, 0, 0, bitmap->width,
		          bitmap->height);
		XFree(image);
	}

	((xfBitmap*) bitmap)->pixmap = pixmap;
	xf_unlock_x11(xfc, FALSE);
	return TRUE;
}
Example #4
0
static BOOL xf_Pointer_SetDefault(rdpContext* context)
{
#ifdef WITH_XCURSOR
	xfContext* xfc = (xfContext*) context;
	xf_lock_x11(xfc, FALSE);
	xfc->pointer = NULL;

	if (xfc->window)
		XUndefineCursor(xfc->display, xfc->window->handle);

	xf_unlock_x11(xfc, FALSE);
#endif
	return TRUE;
}
Example #5
0
void xf_Bitmap_New(rdpContext* context, rdpBitmap* bitmap)
{
	int depth;
	BYTE* data;
	Pixmap pixmap;
	XImage* image;
	UINT32 SrcFormat;
	xfContext* xfc = (xfContext*) context;

	xf_lock_x11(xfc, FALSE);

	data = bitmap->data;
	depth = (bitmap->bpp >= 24) ? 24 : bitmap->bpp;

	pixmap = XCreatePixmap(xfc->display, xfc->drawable, bitmap->width, bitmap->height, xfc->depth);

	if (bitmap->data)
	{
		XSetFunction(xfc->display, xfc->gc, GXcopy);

		if (depth != xfc->depth)
		{
			data = _aligned_malloc(bitmap->width * bitmap->height * 4, 16);

			if (!data)
				return;

			SrcFormat = gdi_get_pixel_format(bitmap->bpp, TRUE);

			freerdp_image_copy(data, xfc->format, -1, 0, 0,
				bitmap->width, bitmap->height, bitmap->data, SrcFormat, -1, 0, 0, xfc->palette);

			_aligned_free(bitmap->data);
			bitmap->data = data;

			bitmap->bpp = (xfc->depth >= 24) ? 32 : xfc->depth;
		}

		image = XCreateImage(xfc->display, xfc->visual, xfc->depth,
			ZPixmap, 0, (char*) bitmap->data, bitmap->width, bitmap->height, xfc->scanline_pad, 0);

		XPutImage(xfc->display, pixmap, xfc->gc, image, 0, 0, 0, 0, bitmap->width, bitmap->height);

		XFree(image);
	}

	((xfBitmap*) bitmap)->pixmap = pixmap;

	xf_unlock_x11(xfc, FALSE);
}
Example #6
0
void xf_hw_desktop_resize(rdpContext* context)
{
	xfContext* xfc = (xfContext*) context;
	rdpSettings* settings = xfc->settings;

	xf_lock_x11(xfc, TRUE);

	xfc->sessionWidth = settings->DesktopWidth;
	xfc->sessionHeight = settings->DesktopHeight;

	xf_desktop_resize(context);

	xf_unlock_x11(xfc, TRUE);
}
Example #7
0
static BOOL xf_gdi_polyline(rdpContext* context,
                            const POLYLINE_ORDER* polyline)
{
	int i;
	int npoints;
	XColor color;
	XPoint* points;
	xfContext* xfc = (xfContext*) context;
	BOOL ret = TRUE;

	if (!xf_decode_color(xfc, polyline->penColor, &color))
		return FALSE;

	xf_lock_x11(xfc, FALSE);
	xf_set_rop2(xfc, polyline->bRop2);
	XSetFillStyle(xfc->display, xfc->gc, FillSolid);
	XSetForeground(xfc->display, xfc->gc, color.pixel);
	npoints = polyline->numDeltaEntries + 1;
	points = malloc(sizeof(XPoint) * npoints);

	if (!points)
	{
		xf_unlock_x11(xfc, FALSE);
		return FALSE;
	}

	points[0].x = polyline->xStart;
	points[0].y = polyline->yStart;

	for (i = 0; i < polyline->numDeltaEntries; i++)
	{
		points[i + 1].x = polyline->points[i].x;
		points[i + 1].y = polyline->points[i].y;
	}

	XDrawLines(xfc->display, xfc->drawing, xfc->gc, points, npoints,
	           CoordModePrevious);

	if (xfc->drawing == xfc->primary)
	{
		if (!xf_gdi_invalidate_poly_region(xfc, points, npoints))
			ret = FALSE;
	}

	XSetFunction(xfc->display, xfc->gc, GXcopy);
	free(points);
	xf_unlock_x11(xfc, FALSE);
	return ret;
}
Example #8
0
void xf_Glyph_Draw(rdpContext* context, rdpGlyph* glyph, int x, int y)
{
	xfGlyph* xf_glyph;
	xfContext* xfc = (xfContext*) context;

	xf_glyph = (xfGlyph*) glyph;

	xf_lock_x11(xfc, FALSE);

	XSetStipple(xfc->display, xfc->gc, xf_glyph->pixmap);
	XSetTSOrigin(xfc->display, xfc->gc, x, y);
	XFillRectangle(xfc->display, xfc->drawing, xfc->gc, x, y, glyph->cx, glyph->cy);
	XSetStipple(xfc->display, xfc->gc, xfc->bitmap_mono);

	xf_unlock_x11(xfc, FALSE);
}
Example #9
0
void xf_toggle_fullscreen(xfContext* xfc)
{
	Pixmap contents = 0;
	WindowStateChangeEventArgs e;
	xf_lock_x11(xfc, TRUE);
	contents = XCreatePixmap(xfc->display, xfc->window->handle, xfc->width, xfc->height, xfc->depth);
	XCopyArea(xfc->display, xfc->primary, contents, xfc->gc, 0, 0, xfc->width, xfc->height, 0, 0);
	XDestroyWindow(xfc->display, xfc->window->handle);
	xfc->fullscreen = (xfc->fullscreen) ? FALSE : TRUE;
	xf_create_window(xfc);
	XCopyArea(xfc->display, contents, xfc->primary, xfc->gc, 0, 0, xfc->width, xfc->height, 0, 0);
	XFreePixmap(xfc->display, contents);
	xf_unlock_x11(xfc, TRUE);
	EventArgsInit(&e, "xfreerdp");
	e.state = xfc->fullscreen ? FREERDP_WINDOW_STATE_FULLSCREEN : 0;
	PubSub_OnWindowStateChange(((rdpContext *) xfc)->pubSub, xfc, &e);
}
Example #10
0
static BOOL xf_Pointer_Set(rdpContext* context,
                           const rdpPointer* pointer)
{
#ifdef WITH_XCURSOR
	xfContext* xfc = (xfContext*) context;
	xf_lock_x11(xfc, FALSE);
	xfc->pointer = (xfPointer*) pointer;

	/* in RemoteApp mode, window can be null if none has had focus */

	if (xfc->window)
		XDefineCursor(xfc->display, xfc->window->handle, xfc->pointer->cursor);

	xf_unlock_x11(xfc, FALSE);
#endif
	return TRUE;
}
Example #11
0
static BOOL xf_Bitmap_SetSurface(rdpContext* context, rdpBitmap* bitmap,
                                 BOOL primary)
{
	xfContext* xfc = (xfContext*) context;

	if (!context || (!bitmap && !primary))
		return FALSE;

	xf_lock_x11(xfc, FALSE);

	if (primary)
		xfc->drawing = xfc->primary;
	else
		xfc->drawing = ((xfBitmap*) bitmap)->pixmap;

	xf_unlock_x11(xfc, FALSE);
	return TRUE;
}
Example #12
0
void xf_toggle_fullscreen(xfInfo* xfi)
{
	Pixmap contents = 0;

	xf_lock_x11(xfi, TRUE);

	contents = XCreatePixmap(xfi->display, xfi->window->handle, xfi->width, xfi->height, xfi->depth);
	XCopyArea(xfi->display, xfi->primary, contents, xfi->gc, 0, 0, xfi->width, xfi->height, 0, 0);

	XDestroyWindow(xfi->display, xfi->window->handle);
	xfi->fullscreen = (xfi->fullscreen) ? FALSE : TRUE;
	xf_create_window(xfi);

	XCopyArea(xfi->display, contents, xfi->primary, xfi->gc, 0, 0, xfi->width, xfi->height, 0, 0);
	XFreePixmap(xfi->display, contents);

	xf_unlock_x11(xfi, TRUE);
}
Example #13
0
void xf_gdi_palette_update(rdpContext* context, PALETTE_UPDATE* palette)
{
	int index;
	PALETTE_ENTRY* pe;
	UINT32* palette32;
	xfContext* xfc = (xfContext*) context;

	xf_lock_x11(xfc, FALSE);

	palette32 = (UINT32*) xfc->palette;

	for (index = 0; index < palette->number; index++)
	{
		pe = &(palette->entries[index]);
		palette32[index] = RGB32(pe->red, pe->green, pe->blue);
	}

	xf_unlock_x11(xfc, FALSE);
}
Example #14
0
void xf_gdi_line_to(rdpContext* context, LINE_TO_ORDER* line_to)
{
	UINT32 color;
	xfContext* xfc = (xfContext*) context;

	xf_lock_x11(xfc, FALSE);

	xf_set_rop2(xfc, line_to->bRop2);
	color = freerdp_convert_gdi_order_color(line_to->penColor, context->settings->ColorDepth, xfc->format, xfc->palette);
	color = xf_gdi_get_color(xfc, color);

	XSetFillStyle(xfc->display, xfc->gc, FillSolid);
	XSetForeground(xfc->display, xfc->gc, color);

	XDrawLine(xfc->display, xfc->drawing, xfc->gc,
			line_to->nXStart, line_to->nYStart, line_to->nXEnd, line_to->nYEnd);

	if (xfc->drawing == xfc->primary)
	{
		if (!xfc->remote_app)
		{
			XDrawLine(xfc->display, xfc->drawable, xfc->gc,
					line_to->nXStart, line_to->nYStart, line_to->nXEnd, line_to->nYEnd);
		}
		int width, height;

		width = line_to->nXStart - line_to->nXEnd;
		height = line_to->nYStart - line_to->nYEnd;

		if (width < 0)
			width *= (-1);

		if (height < 0)
			height *= (-1);

		gdi_InvalidateRegion(xfc->hdc, line_to->nXStart, line_to->nYStart, width, height);

	}

	XSetFunction(xfc->display, xfc->gc, GXcopy);

	xf_unlock_x11(xfc, FALSE);
}
Example #15
0
void xf_hw_desktop_resize(rdpContext* context)
{
	xfInfo* xfi;
	BOOL same;
	rdpSettings* settings;

	xfi = ((xfContext*) context)->xfi;
	settings = xfi->instance->settings;

	xf_lock_x11(xfi, TRUE);

	if (xfi->fullscreen != TRUE)
	{
		xfi->width = settings->DesktopWidth;
		xfi->height = settings->DesktopHeight;

		if (xfi->window)
			xf_ResizeDesktopWindow(xfi, xfi->window, settings->DesktopWidth, settings->DesktopHeight);

		if (xfi->primary)
		{
			same = (xfi->primary == xfi->drawing) ? TRUE : FALSE;

			XFreePixmap(xfi->display, xfi->primary);

			xfi->primary = XCreatePixmap(xfi->display, xfi->drawable,
					xfi->width, xfi->height, xfi->depth);

			if (same)
				xfi->drawing = xfi->primary;
		}
	}
	else
	{
		XSetFunction(xfi->display, xfi->gc, GXcopy);
		XSetFillStyle(xfi->display, xfi->gc, FillSolid);
		XSetForeground(xfi->display, xfi->gc, 0);
		XFillRectangle(xfi->display, xfi->drawable, xfi->gc, 0, 0, xfi->width, xfi->height);
	}

	xf_unlock_x11(xfi, TRUE);
}
Example #16
0
void xf_gdi_scrblt(rdpContext* context, SCRBLT_ORDER* scrblt)
{
    xfInfo* xfi = ((xfContext*) context)->xfi;

    xf_lock_x11(xfi, FALSE);

    xf_set_rop3(xfi, gdi_rop3_code(scrblt->bRop));

    XCopyArea(xfi->display, xfi->primary, xfi->drawing, xfi->gc, scrblt->nXSrc, scrblt->nYSrc,
              scrblt->nWidth, scrblt->nHeight, scrblt->nLeftRect, scrblt->nTopRect);

    if (xfi->drawing == xfi->primary)
    {
        gdi_InvalidateRegion(xfi->hdc, scrblt->nLeftRect, scrblt->nTopRect, scrblt->nWidth, scrblt->nHeight);
    }

    XSetFunction(xfi->display, xfi->gc, GXcopy);

    xf_unlock_x11(xfi, FALSE);
}
Example #17
0
static BOOL xf_Bitmap_Paint(rdpContext* context, rdpBitmap* bitmap)
{
	XImage* image;
	int width, height;
	xfContext* xfc = (xfContext*) context;
	BOOL ret = TRUE;
	width = bitmap->right - bitmap->left + 1;
	height = bitmap->bottom - bitmap->top + 1;
	xf_lock_x11(xfc, FALSE);
	XSetFunction(xfc->display, xfc->gc, GXcopy);
	image = XCreateImage(xfc->display, xfc->visual, xfc->depth,
	                     ZPixmap, 0, (char*) bitmap->data, bitmap->width, bitmap->height,
	                     xfc->scanline_pad, 0);
	XPutImage(xfc->display, xfc->primary, xfc->gc,
	          image, 0, 0, bitmap->left, bitmap->top, width, height);
	XFree(image);
	ret = gdi_InvalidateRegion(xfc->hdc, bitmap->left, bitmap->top, width, height);
	xf_unlock_x11(xfc, FALSE);
	return TRUE;
}
Example #18
0
static BOOL xf_Bitmap_Paint(rdpContext* context, rdpBitmap* bitmap)
{
	int width, height;
	xfContext* xfc = (xfContext*) context;
	xfBitmap* xbitmap = (xfBitmap*)bitmap;
	BOOL ret;

	if (!context || !xbitmap)
		return FALSE;

	width = bitmap->right - bitmap->left + 1;
	height = bitmap->bottom - bitmap->top + 1;
	xf_lock_x11(xfc, FALSE);
	XSetFunction(xfc->display, xfc->gc, GXcopy);
	XPutImage(xfc->display, xfc->primary, xfc->gc,
	          xbitmap->image, 0, 0, bitmap->left, bitmap->top, width, height);
	ret = gdi_InvalidateRegion(xfc->hdc, bitmap->left, bitmap->top, width, height);
	xf_unlock_x11(xfc, FALSE);
	return ret;
}
Example #19
0
void xf_sw_desktop_resize(rdpContext *context)
{
	rdpSettings *settings;
	xfContext *xfc = (xfContext *) context;
	settings = xfc->instance->settings;
	xf_lock_x11(xfc, TRUE);
	if(!xfc->fullscreen)
	{
		rdpGdi *gdi = context->gdi;
		gdi_resize(gdi, xfc->width, xfc->height);
		if(xfc->image)
		{
			xfc->image->data = NULL;
			XDestroyImage(xfc->image);
			xfc->image = XCreateImage(xfc->display, xfc->visual, xfc->depth, ZPixmap, 0,
									  (char *) gdi->primary_buffer, gdi->width, gdi->height, xfc->scanline_pad, 0);
		}
	}
	xf_unlock_x11(xfc, TRUE);
}
Example #20
0
void xf_Bitmap_New(rdpContext* context, rdpBitmap* bitmap)
{
	BYTE* data;
	Pixmap pixmap;
	XImage* image;
	xfContext* xfc = (xfContext*) context;

	xf_lock_x11(xfc, FALSE);

	XSetFunction(xfc->display, xfc->gc, GXcopy);
	pixmap = XCreatePixmap(xfc->display, xfc->drawable, bitmap->width, bitmap->height, xfc->depth);

	if (bitmap->data)
	{
		data = freerdp_image_convert(bitmap->data, NULL,
				bitmap->width, bitmap->height, context->settings->ColorDepth, xfc->bpp, xfc->clrconv);

		if (bitmap->ephemeral != TRUE)
		{
			image = XCreateImage(xfc->display, xfc->visual, xfc->depth,
				ZPixmap, 0, (char*) data, bitmap->width, bitmap->height, xfc->scanline_pad, 0);

			XPutImage(xfc->display, pixmap, xfc->gc, image, 0, 0, 0, 0, bitmap->width, bitmap->height);
			XFree(image);

			if (data != bitmap->data)
				_aligned_free(data);
		}
		else
		{
			if (data != bitmap->data)
				_aligned_free(bitmap->data);

			bitmap->data = data;
		}
	}

	((xfBitmap*) bitmap)->pixmap = pixmap;

	xf_unlock_x11(xfc, FALSE);
}
Example #21
0
void xf_toggle_fullscreen(xfInfo* xfi)
{
	Pixmap contents = 0;

	xf_lock_x11(xfi, TRUE);

	contents = XCreatePixmap(xfi->display, xfi->window->handle, xfi->width, xfi->height, xfi->depth);
	XCopyArea(xfi->display, xfi->primary, contents, xfi->gc, 0, 0, xfi->width, xfi->height, 0, 0);

	XDestroyWindow(xfi->display, xfi->window->handle);
	xfi->fullscreen = (xfi->fullscreen) ? FALSE : TRUE;
	xf_create_window(xfi);

	XCopyArea(xfi->display, contents, xfi->primary, xfi->gc, 0, 0, xfi->width, xfi->height, 0, 0);
	XFreePixmap(xfi->display, contents);

	xf_unlock_x11(xfi, TRUE);

	IFCALL(xfi->client->OnWindowStateChange, xfi->instance,
	       xfi->fullscreen ? FREERDP_WINDOW_STATE_FULLSCREEN : 0);
}
Example #22
0
void xf_gdi_set_bounds(rdpContext* context, rdpBounds* bounds)
{
	XRectangle clip;
	xfContext* xfc = (xfContext*) context;

	xf_lock_x11(xfc, FALSE);

	if (bounds)
	{
		clip.x = bounds->left;
		clip.y = bounds->top;
		clip.width = bounds->right - bounds->left + 1;
		clip.height = bounds->bottom - bounds->top + 1;
		XSetClipRectangles(xfc->display, xfc->gc, 0, 0, &clip, 1, YXBanded);
	}
	else
	{
		XSetClipMask(xfc->display, xfc->gc, None);
	}

	xf_unlock_x11(xfc, FALSE);
}
Example #23
0
void xf_gdi_dstblt(rdpContext* context, DSTBLT_ORDER* dstblt)
{
    xfInfo* xfi = ((xfContext*) context)->xfi;

    xf_lock_x11(xfi, FALSE);

    xf_set_rop3(xfi, gdi_rop3_code(dstblt->bRop));

    XSetFillStyle(xfi->display, xfi->gc, FillSolid);
    XFillRectangle(xfi->display, xfi->drawing, xfi->gc,
                   dstblt->nLeftRect, dstblt->nTopRect,
                   dstblt->nWidth, dstblt->nHeight);

    if (xfi->drawing == xfi->primary)
    {
        gdi_InvalidateRegion(xfi->hdc, dstblt->nLeftRect, dstblt->nTopRect, dstblt->nWidth, dstblt->nHeight);
    }

    XSetFunction(xfi->display, xfi->gc, GXcopy);

    xf_unlock_x11(xfi, FALSE);
}
Example #24
0
/* Glyph Class */
static BOOL xf_Glyph_New(rdpContext* context, const rdpGlyph* glyph)
{
	int scanline;
	XImage* image;
	xfGlyph* xf_glyph;
	xf_glyph = (xfGlyph*) glyph;
	xfContext* xfc = (xfContext*) context;
	xf_lock_x11(xfc, FALSE);
	scanline = (glyph->cx + 7) / 8;
	xf_glyph->pixmap = XCreatePixmap(xfc->display, xfc->drawing, glyph->cx,
	                                 glyph->cy, 1);
	image = XCreateImage(xfc->display, xfc->visual, 1,
	                     ZPixmap, 0, (char*) glyph->aj, glyph->cx, glyph->cy, 8, scanline);
	image->byte_order = MSBFirst;
	image->bitmap_bit_order = MSBFirst;
	XInitImage(image);
	XPutImage(xfc->display, xf_glyph->pixmap, xfc->gc_mono, image, 0, 0, 0, 0,
	          glyph->cx, glyph->cy);
	XFree(image);
	xf_unlock_x11(xfc, FALSE);
	return TRUE;
}
Example #25
0
void xf_gdi_multi_opaque_rect(rdpContext* context, MULTI_OPAQUE_RECT_ORDER* multi_opaque_rect)
{
	int i;
	UINT32 color;
	DELTA_RECT* rectangle;
	xfContext* xfc = (xfContext*) context;

	xf_lock_x11(xfc, FALSE);

	color = freerdp_convert_gdi_order_color(multi_opaque_rect->color, context->settings->ColorDepth, xfc->format, xfc->palette);
	color = xf_gdi_get_color(xfc, color);

	XSetFunction(xfc->display, xfc->gc, GXcopy);
	XSetFillStyle(xfc->display, xfc->gc, FillSolid);
	XSetForeground(xfc->display, xfc->gc, color);

	for (i = 1; i < multi_opaque_rect->numRectangles + 1; i++)
	{
		rectangle = &multi_opaque_rect->rectangles[i];

		XFillRectangle(xfc->display, xfc->drawing, xfc->gc,
				rectangle->left, rectangle->top,
				rectangle->width, rectangle->height);

		if (xfc->drawing == xfc->primary)
		{
			if (!xfc->remote_app)
			{
				XFillRectangle(xfc->display, xfc->drawable, xfc->gc,
						rectangle->left, rectangle->top,
						rectangle->width, rectangle->height);
			}
			gdi_InvalidateRegion(xfc->hdc, rectangle->left, rectangle->top, rectangle->width, rectangle->height);
		}
	}

	xf_unlock_x11(xfc, FALSE);
}
Example #26
0
void xf_gdi_line_to(rdpContext* context, LINE_TO_ORDER* line_to)
{
    UINT32 color;
    xfContext* context_ = (xfContext*) context;
    xfInfo* xfi = context_->xfi;

    xf_lock_x11(xfi, FALSE);

    xf_set_rop2(xfi, line_to->bRop2);
    color = freerdp_color_convert_var(line_to->penColor, context_->settings->ColorDepth, xfi->bpp, xfi->clrconv);

    XSetFillStyle(xfi->display, xfi->gc, FillSolid);
    XSetForeground(xfi->display, xfi->gc, color);

    XDrawLine(xfi->display, xfi->drawing, xfi->gc,
              line_to->nXStart, line_to->nYStart, line_to->nXEnd, line_to->nYEnd);

    if (xfi->drawing == xfi->primary)
    {
        int width, height;

        width = line_to->nXStart - line_to->nXEnd;
        height = line_to->nYStart - line_to->nYEnd;

        if (width < 0)
            width *= (-1);

        if (height < 0)
            height *= (-1);

        gdi_InvalidateRegion(xfi->hdc, line_to->nXStart, line_to->nYStart, width, height);

    }

    XSetFunction(xfi->display, xfi->gc, GXcopy);

    xf_unlock_x11(xfi, FALSE);
}
Example #27
0
static BOOL xf_gdi_surface_frame_marker(rdpContext* context,
                                        const SURFACE_FRAME_MARKER* surface_frame_marker)
{
	rdpSettings* settings;
	xfContext* xfc = (xfContext*) context;
	BOOL ret = TRUE;
	settings = xfc->context.settings;
	xf_lock_x11(xfc, FALSE);

	switch (surface_frame_marker->frameAction)
	{
		case SURFACECMD_FRAMEACTION_BEGIN:
			xfc->frame_begin = TRUE;
			xfc->frame_x1 = 0;
			xfc->frame_y1 = 0;
			xfc->frame_x2 = 0;
			xfc->frame_y2 = 0;
			break;

		case SURFACECMD_FRAMEACTION_END:
			xfc->frame_begin = FALSE;

			if ((xfc->frame_x2 > xfc->frame_x1) && (xfc->frame_y2 > xfc->frame_y1))
				ret = gdi_InvalidateRegion(xfc->hdc, xfc->frame_x1, xfc->frame_y1,
				                           xfc->frame_x2 - xfc->frame_x1, xfc->frame_y2 - xfc->frame_y1);

			if (settings->FrameAcknowledge > 0)
			{
				IFCALL(xfc->context.update->SurfaceFrameAcknowledge, context,
				       surface_frame_marker->frameId);
			}

			break;
	}

	xf_unlock_x11(xfc, FALSE);
	return ret;
}
Example #28
0
void xf_Glyph_BeginDraw(rdpContext* context, int x, int y, int width, int height, UINT32 bgcolor, UINT32 fgcolor)
{
	xfContext* xfc = (xfContext*) context;

	bgcolor = freerdp_convert_gdi_order_color(bgcolor, context->settings->ColorDepth, xfc->format, xfc->palette);
	fgcolor = freerdp_convert_gdi_order_color(fgcolor, context->settings->ColorDepth, xfc->format, xfc->palette);

	xf_lock_x11(xfc, FALSE);

	fgcolor = xf_gdi_get_color(xfc, fgcolor);
	bgcolor = xf_gdi_get_color(xfc, bgcolor);

	XSetFunction(xfc->display, xfc->gc, GXcopy);
	XSetFillStyle(xfc->display, xfc->gc, FillSolid);
	XSetForeground(xfc->display, xfc->gc, fgcolor);
	XFillRectangle(xfc->display, xfc->drawing, xfc->gc, x, y, width, height);

	XSetForeground(xfc->display, xfc->gc, bgcolor);
	XSetBackground(xfc->display, xfc->gc, fgcolor);
	XSetFillStyle(xfc->display, xfc->gc, FillStippled);

	xf_unlock_x11(xfc, FALSE);
}
Example #29
0
void xf_gdi_memblt(rdpContext* context, MEMBLT_ORDER* memblt)
{
    xfBitmap* bitmap;
    xfInfo* xfi = ((xfContext*) context)->xfi;

    xf_lock_x11(xfi, FALSE);

    bitmap = (xfBitmap*) memblt->bitmap;
    xf_set_rop3(xfi, gdi_rop3_code(memblt->bRop));

    XCopyArea(xfi->display, bitmap->pixmap, xfi->drawing, xfi->gc,
              memblt->nXSrc, memblt->nYSrc, memblt->nWidth, memblt->nHeight,
              memblt->nLeftRect, memblt->nTopRect);

    if (xfi->drawing == xfi->primary)
    {
        gdi_InvalidateRegion(xfi->hdc, memblt->nLeftRect, memblt->nTopRect, memblt->nWidth, memblt->nHeight);
    }

    XSetFunction(xfi->display, xfi->gc, GXcopy);

    xf_unlock_x11(xfi, FALSE);
}
Example #30
0
BOOL xf_Pointer_New(rdpContext* context, rdpPointer* pointer)
{
#ifdef WITH_XCURSOR
	XcursorImage ci;
	xfContext* xfc = (xfContext*) context;

	xf_lock_x11(xfc, FALSE);

	ZeroMemory(&ci, sizeof(ci));
	ci.version = XCURSOR_IMAGE_VERSION;
	ci.size = sizeof(ci);
	ci.width = pointer->width;
	ci.height = pointer->height;
	ci.xhot = pointer->xPos;
	ci.yhot = pointer->yPos;

	if (!(ci.pixels = (XcursorPixel*) calloc(1, ci.width * ci.height * 4)))
	{
		xf_unlock_x11(xfc, FALSE);
		return FALSE;
	}

	if ((pointer->andMaskData != 0) && (pointer->xorMaskData != 0))
	{
		freerdp_image_copy_from_pointer_data((BYTE*) ci.pixels, PIXEL_FORMAT_ARGB32,
				pointer->width * 4, 0, 0, pointer->width, pointer->height,
				pointer->xorMaskData, pointer->andMaskData, pointer->xorBpp, xfc->palette);
	}

	((xfPointer*) pointer)->cursor = XcursorImageLoadCursor(xfc->display, &ci);

	free(ci.pixels);

	xf_unlock_x11(xfc, FALSE);
#endif
	return TRUE;
}