void xf_gdi_opaque_rect(rdpContext* context, OPAQUE_RECT_ORDER* opaque_rect) { UINT32 color; xfContext* xfc = (xfContext*) context; xf_lock_x11(xfc, FALSE); color = freerdp_convert_gdi_order_color(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); XFillRectangle(xfc->display, xfc->drawing, xfc->gc, opaque_rect->nLeftRect, opaque_rect->nTopRect, opaque_rect->nWidth, opaque_rect->nHeight); if (xfc->drawing == xfc->primary) { if (!xfc->remote_app) { XFillRectangle(xfc->display, xfc->drawable, xfc->gc, opaque_rect->nLeftRect, opaque_rect->nTopRect, opaque_rect->nWidth, opaque_rect->nHeight); } gdi_InvalidateRegion(xfc->hdc, opaque_rect->nLeftRect, opaque_rect->nTopRect, opaque_rect->nWidth, opaque_rect->nHeight); } xf_unlock_x11(xfc, FALSE); }
void xf_gdi_dstblt(rdpContext* context, DSTBLT_ORDER* dstblt) { xfContext* xfc = (xfContext*) context; xf_lock_x11(xfc, FALSE); xf_set_rop3(xfc, gdi_rop3_code(dstblt->bRop)); XSetFillStyle(xfc->display, xfc->gc, FillSolid); XFillRectangle(xfc->display, xfc->drawing, xfc->gc, dstblt->nLeftRect, dstblt->nTopRect, dstblt->nWidth, dstblt->nHeight); if (xfc->drawing == xfc->primary) { if (!xfc->remote_app) { XFillRectangle(xfc->display, xfc->drawable, xfc->gc, dstblt->nLeftRect, dstblt->nTopRect, dstblt->nWidth, dstblt->nHeight); } gdi_InvalidateRegion(xfc->hdc, dstblt->nLeftRect, dstblt->nTopRect, dstblt->nWidth, dstblt->nHeight); } XSetFunction(xfc->display, xfc->gc, GXcopy); xf_unlock_x11(xfc, FALSE); }
void xf_gdi_scrblt(rdpContext* context, SCRBLT_ORDER* scrblt) { xfContext* xfc = (xfContext*) context; xf_lock_x11(xfc, FALSE); xf_set_rop3(xfc, gdi_rop3_code(scrblt->bRop)); XCopyArea(xfc->display, xfc->primary, xfc->drawing, xfc->gc, scrblt->nXSrc, scrblt->nYSrc, scrblt->nWidth, scrblt->nHeight, scrblt->nLeftRect, scrblt->nTopRect); if (xfc->drawing == xfc->primary) { if (!xfc->remote_app) { if (xfc->unobscured) { XCopyArea(xfc->display, xfc->drawable, xfc->drawable, xfc->gc, scrblt->nXSrc, scrblt->nYSrc, scrblt->nWidth, scrblt->nHeight, scrblt->nLeftRect, scrblt->nTopRect); } } else { XSetFunction(xfc->display, xfc->gc, GXcopy); XCopyArea(xfc->display, xfc->primary, xfc->drawable, xfc->gc, scrblt->nLeftRect, scrblt->nTopRect, scrblt->nWidth, scrblt->nHeight, scrblt->nLeftRect, scrblt->nTopRect); } gdi_InvalidateRegion(xfc->hdc, scrblt->nLeftRect, scrblt->nTopRect, scrblt->nWidth, scrblt->nHeight); } XSetFunction(xfc->display, xfc->gc, GXcopy); xf_unlock_x11(xfc, FALSE); }
void xf_Glyph_BeginDraw(rdpContext* context, int x, int y, int width, int height, UINT32 bgcolor, UINT32 fgcolor, BOOL fOpRedundant) { 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); XSetFunction(xfc->display, xfc->gc, GXcopy); if (width && height) { 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, fOpRedundant ? FillOpaqueStippled : FillStippled); xf_unlock_x11(xfc, FALSE); }
void xf_gdi_surface_frame_marker(rdpContext* context, SURFACE_FRAME_MARKER* surface_frame_marker) { rdpSettings* settings; xfContext* xfc = (xfContext*) context; settings = xfc->instance->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)) { 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->instance->update->SurfaceFrameAcknowledge, context, surface_frame_marker->frameId); } break; } xf_unlock_x11(xfc, FALSE); }
void xf_sw_desktop_resize(rdpContext* context) { xfInfo* xfi; rdpSettings* settings; xfi = ((xfContext*) context)->xfi; settings = xfi->instance->settings; xf_lock_x11(xfi, TRUE); if (xfi->fullscreen != TRUE) { rdpGdi* gdi = context->gdi; gdi_resize(gdi, xfi->width, xfi->height); if (xfi->image) { xfi->image->data = NULL; XDestroyImage(xfi->image); xfi->image = XCreateImage(xfi->display, xfi->visual, xfi->depth, ZPixmap, 0, (char*) gdi->primary_buffer, gdi->width, gdi->height, xfi->scanline_pad, 0); } } xf_unlock_x11(xfi, TRUE); }
void xf_gdi_multi_opaque_rect(rdpContext* context, MULTI_OPAQUE_RECT_ORDER* multi_opaque_rect) { int i; UINT32 color; DELTA_RECT* rectangle; xfContext* context_ = (xfContext*) context; xfInfo* xfi = context_->xfi; xf_lock_x11(xfi, FALSE); color = freerdp_color_convert_var(multi_opaque_rect->color, context_->settings->ColorDepth, xfi->bpp, xfi->clrconv); XSetFunction(xfi->display, xfi->gc, GXcopy); XSetFillStyle(xfi->display, xfi->gc, FillSolid); XSetForeground(xfi->display, xfi->gc, color); for (i = 1; i < multi_opaque_rect->numRectangles + 1; i++) { rectangle = &multi_opaque_rect->rectangles[i]; XFillRectangle(xfi->display, xfi->drawing, xfi->gc, rectangle->left, rectangle->top, rectangle->width, rectangle->height); if (xfi->drawing == xfi->primary) { gdi_InvalidateRegion(xfi->hdc, rectangle->left, rectangle->top, rectangle->width, rectangle->height); } } xf_unlock_x11(xfi, FALSE); }
void xf_gdi_opaque_rect(rdpContext* context, OPAQUE_RECT_ORDER* opaque_rect) { UINT32 color; xfContext* context_ = (xfContext*) context; xfInfo* xfi = context_->xfi; xf_lock_x11(xfi, FALSE); color = freerdp_color_convert_var(opaque_rect->color, context_->settings->ColorDepth, xfi->bpp, xfi->clrconv); XSetFunction(xfi->display, xfi->gc, GXcopy); XSetFillStyle(xfi->display, xfi->gc, FillSolid); XSetForeground(xfi->display, xfi->gc, color); XFillRectangle(xfi->display, xfi->drawing, xfi->gc, opaque_rect->nLeftRect, opaque_rect->nTopRect, opaque_rect->nWidth, opaque_rect->nHeight); if (xfi->drawing == xfi->primary) { gdi_InvalidateRegion(xfi->hdc, opaque_rect->nLeftRect, opaque_rect->nTopRect, opaque_rect->nWidth, opaque_rect->nHeight); } xf_unlock_x11(xfi, FALSE); }
void xf_gdi_memblt(rdpContext* context, MEMBLT_ORDER* memblt) { xfBitmap* bitmap; xfContext* xfc = (xfContext*) context; xf_lock_x11(xfc, FALSE); bitmap = (xfBitmap*) memblt->bitmap; xf_set_rop3(xfc, gdi_rop3_code(memblt->bRop)); XCopyArea(xfc->display, bitmap->pixmap, xfc->drawing, xfc->gc, memblt->nXSrc, memblt->nYSrc, memblt->nWidth, memblt->nHeight, memblt->nLeftRect, memblt->nTopRect); if (xfc->drawing == xfc->primary) { if (!xfc->remote_app) { XCopyArea(xfc->display, bitmap->pixmap, xfc->drawable, xfc->gc, memblt->nXSrc, memblt->nYSrc, memblt->nWidth, memblt->nHeight, memblt->nLeftRect, memblt->nTopRect); } gdi_InvalidateRegion(xfc->hdc, memblt->nLeftRect, memblt->nTopRect, memblt->nWidth, memblt->nHeight); } XSetFunction(xfc->display, xfc->gc, GXcopy); xf_unlock_x11(xfc, FALSE); }
BOOL xf_Glyph_BeginDraw(rdpContext* context, int x, int y, int width, int height, UINT32 bgcolor, UINT32 fgcolor, BOOL fOpRedundant) { xfContext* xfc = (xfContext*) context; bgcolor = xf_convert_rdp_order_color(xfc, bgcolor); fgcolor = xf_convert_rdp_order_color(xfc, fgcolor); xf_lock_x11(xfc, FALSE); XSetFunction(xfc->display, xfc->gc, GXcopy); if (width && height) { 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, fOpRedundant ? FillOpaqueStippled : FillStippled); xf_unlock_x11(xfc, FALSE); return TRUE; }
static BOOL xf_Pointer_SetNull(rdpContext* context) { #ifdef WITH_XCURSOR xfContext* xfc = (xfContext*) context; static Cursor nullcursor = None; xf_lock_x11(xfc, FALSE); if (nullcursor == None) { XcursorImage ci; XcursorPixel xp = 0; ZeroMemory(&ci, sizeof(ci)); ci.version = XCURSOR_IMAGE_VERSION; ci.size = sizeof(ci); ci.width = ci.height = 1; ci.xhot = ci.yhot = 0; ci.pixels = &xp; nullcursor = XcursorImageLoadCursor(xfc->display, &ci); } xfc->pointer = NULL; if ((xfc->window) && (nullcursor != None)) XDefineCursor(xfc->display, xfc->window->handle, nullcursor); xf_unlock_x11(xfc, FALSE); #endif return TRUE; }
BOOL xf_Pointer_SetPosition(rdpContext* context, UINT32 x, UINT32 y) { xfContext* xfc = (xfContext*) context; XWindowAttributes current; XSetWindowAttributes tmp; BOOL ret = FALSE; if (!xfc->focused || !xfc->window) return TRUE; xf_lock_x11(xfc, FALSE); if (XGetWindowAttributes(xfc->display, xfc->window->handle, ¤t) == 0) goto out; tmp.event_mask = (current.your_event_mask & ~(PointerMotionMask)); if (XChangeWindowAttributes(xfc->display, xfc->window->handle, CWEventMask, &tmp) == 0) goto out; XWarpPointer(xfc->display, None, xfc->window->handle, 0, 0, 0, 0, x, y); tmp.event_mask = current.your_event_mask; XChangeWindowAttributes(xfc->display, xfc->window->handle, CWEventMask, &tmp); ret = TRUE; out: xf_unlock_x11(xfc, FALSE); return ret; }
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); }
static BOOL xf_gdi_multi_opaque_rect(rdpContext* context, const MULTI_OPAQUE_RECT_ORDER* multi_opaque_rect) { UINT32 i; xfContext* xfc = (xfContext*) context; BOOL ret = TRUE; XColor color; if (!xf_decode_color(xfc, multi_opaque_rect->color, &color)) return FALSE; xf_lock_x11(xfc, FALSE); XSetFunction(xfc->display, xfc->gc, GXcopy); XSetFillStyle(xfc->display, xfc->gc, FillSolid); XSetForeground(xfc->display, xfc->gc, color.pixel); for (i = 0; i < multi_opaque_rect->numRectangles; i++) { const DELTA_RECT* 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 (!(ret = gdi_InvalidateRegion(xfc->hdc, rectangle->left, rectangle->top, rectangle->width, rectangle->height))) break; } } xf_unlock_x11(xfc, FALSE); return ret; }
void xf_UpdateWindowArea(xfContext* xfc, xfAppWindow* appWindow, int x, int y, int width, int height) { int ax, ay; if (appWindow == NULL) return; ax = x + appWindow->windowOffsetX; ay = y + appWindow->windowOffsetY; if (ax + width > appWindow->windowOffsetX + appWindow->width) width = (appWindow->windowOffsetX + appWindow->width - 1) - ax; if (ay + height > appWindow->windowOffsetY + appWindow->height) height = (appWindow->windowOffsetY + appWindow->height - 1) - ay; xf_lock_x11(xfc, TRUE); if (xfc->context.settings->SoftwareGdi) { XPutImage(xfc->display, xfc->primary, appWindow->gc, xfc->image, ax, ay, ax, ay, width, height); } XCopyArea(xfc->display, xfc->primary, appWindow->handle, appWindow->gc, ax, ay, width, height, x, y); XFlush(xfc->display); xf_unlock_x11(xfc, TRUE); }
void xf_Glyph_BeginDraw(rdpContext* context, int x, int y, int width, int height, UINT32 bgcolor, UINT32 fgcolor) { xfContext* context_ = (xfContext*) context; xfContext* xfc = (xfContext*) context; bgcolor = (xfc->clrconv->invert)? freerdp_color_convert_var_bgr(bgcolor, context_->settings->ColorDepth, xfc->bpp, xfc->clrconv): freerdp_color_convert_var_rgb(bgcolor, context_->settings->ColorDepth, xfc->bpp, xfc->clrconv); fgcolor = (xfc->clrconv->invert)? freerdp_color_convert_var_bgr(fgcolor, context_->settings->ColorDepth, xfc->bpp, xfc->clrconv): freerdp_color_convert_var_rgb(fgcolor, context_->settings->ColorDepth, xfc->bpp, xfc->clrconv); xf_lock_x11(xfc, FALSE); 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); }
void xf_Bitmap_Paint(rdpContext* context, rdpBitmap* bitmap) { XImage* image; int width, height; xfContext* xfc = (xfContext*) context; 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); gdi_InvalidateRegion(xfc->hdc, bitmap->left, bitmap->top, width, height); xf_unlock_x11(xfc, FALSE); }
void xf_Glyph_New(rdpContext* context, 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); }
static BOOL xf_gdi_memblt(rdpContext* context, MEMBLT_ORDER* memblt) { xfBitmap* bitmap; xfContext* xfc; BOOL ret = TRUE; if (!context || !memblt) return FALSE; bitmap = (xfBitmap*) memblt->bitmap; xfc = (xfContext*) context; if (!bitmap || !xfc || !xfc->display || !xfc->drawing) return FALSE; xf_lock_x11(xfc, FALSE); if (xf_set_rop3(xfc, gdi_rop3_code(memblt->bRop))) { XCopyArea(xfc->display, bitmap->pixmap, xfc->drawing, xfc->gc, memblt->nXSrc, memblt->nYSrc, memblt->nWidth, memblt->nHeight, memblt->nLeftRect, memblt->nTopRect); if (xfc->drawing == xfc->primary) ret = gdi_InvalidateRegion(xfc->hdc, memblt->nLeftRect, memblt->nTopRect, memblt->nWidth, memblt->nHeight); } XSetFunction(xfc->display, xfc->gc, GXcopy); xf_unlock_x11(xfc, FALSE); return ret; }
void 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; ci.pixels = (XcursorPixel*) calloc(1, ci.width * ci.height * 4); if (!ci.pixels) return; if ((pointer->andMaskData != 0) && (pointer->xorMaskData != 0)) { freerdp_alpha_cursor_convert((BYTE*) (ci.pixels), pointer->xorMaskData, pointer->andMaskData, pointer->width, pointer->height, pointer->xorBpp, xfc->clrconv); } ((xfPointer*) pointer)->cursor = XcursorImageLoadCursor(xfc->display, &ci); free(ci.pixels); xf_unlock_x11(xfc, FALSE); #endif }
void xf_hw_desktop_resize(rdpContext *context) { BOOL same; rdpSettings *settings; xfContext *xfc = (xfContext *) context; settings = xfc->instance->settings; xf_lock_x11(xfc, TRUE); if(!xfc->fullscreen) { xfc->width = settings->DesktopWidth; xfc->height = settings->DesktopHeight; if(xfc->window) xf_ResizeDesktopWindow(xfc, xfc->window, settings->DesktopWidth, settings->DesktopHeight); if(xfc->primary) { same = (xfc->primary == xfc->drawing) ? TRUE : FALSE; XFreePixmap(xfc->display, xfc->primary); xfc->primary = XCreatePixmap(xfc->display, xfc->drawable, xfc->width, xfc->height, xfc->depth); if(same) xfc->drawing = xfc->primary; } } else { XSetFunction(xfc->display, xfc->gc, GXcopy); XSetFillStyle(xfc->display, xfc->gc, FillSolid); XSetForeground(xfc->display, xfc->gc, 0); XFillRectangle(xfc->display, xfc->drawable, xfc->gc, 0, 0, xfc->width, xfc->height); } xf_unlock_x11(xfc, TRUE); }
static BOOL xf_gdi_line_to(rdpContext* context, const LINE_TO_ORDER* line_to) { XColor color; xfContext* xfc = (xfContext*) context; BOOL ret = TRUE; if (!xf_decode_color(xfc, line_to->penColor, &color)) return FALSE; xf_lock_x11(xfc, FALSE); xf_set_rop2(xfc, line_to->bRop2); XSetFillStyle(xfc->display, xfc->gc, FillSolid); XSetForeground(xfc->display, xfc->gc, color.pixel); XDrawLine(xfc->display, xfc->drawing, xfc->gc, line_to->nXStart, line_to->nYStart, line_to->nXEnd, line_to->nYEnd); if (xfc->drawing == xfc->primary) { int x, y, w, h; x = MIN(line_to->nXStart, line_to->nXEnd); y = MIN(line_to->nYStart, line_to->nYEnd); w = abs(line_to->nXEnd - line_to->nXStart) + 1; h = abs(line_to->nYEnd - line_to->nYStart) + 1; ret = gdi_InvalidateRegion(xfc->hdc, x, y, w, h); } XSetFunction(xfc->display, xfc->gc, GXcopy); xf_unlock_x11(xfc, FALSE); return ret; }
static BOOL xf_gdi_opaque_rect(rdpContext* context, const OPAQUE_RECT_ORDER* opaque_rect) { XColor color; xfContext* xfc = (xfContext*) context; BOOL ret = TRUE; if (!xf_decode_color(xfc, opaque_rect->color, &color)) return FALSE; xf_lock_x11(xfc, FALSE); XSetFunction(xfc->display, xfc->gc, GXcopy); XSetFillStyle(xfc->display, xfc->gc, FillSolid); XSetForeground(xfc->display, xfc->gc, color.pixel); XFillRectangle(xfc->display, xfc->drawing, xfc->gc, opaque_rect->nLeftRect, opaque_rect->nTopRect, opaque_rect->nWidth, opaque_rect->nHeight); if (xfc->drawing == xfc->primary) ret = gdi_InvalidateRegion(xfc->hdc, opaque_rect->nLeftRect, opaque_rect->nTopRect, opaque_rect->nWidth, opaque_rect->nHeight); xf_unlock_x11(xfc, FALSE); return ret; }
static BOOL xf_gdi_scrblt(rdpContext* context, const SCRBLT_ORDER* scrblt) { xfContext* xfc = (xfContext*) context; BOOL ret = FALSE; if (!xfc->display || !xfc->drawing) return FALSE; xf_lock_x11(xfc, FALSE); if (!xf_set_rop3(xfc, gdi_rop3_code(scrblt->bRop))) goto fail; XCopyArea(xfc->display, xfc->primary, xfc->drawing, xfc->gc, scrblt->nXSrc, scrblt->nYSrc, scrblt->nWidth, scrblt->nHeight, scrblt->nLeftRect, scrblt->nTopRect); ret = TRUE; if (xfc->drawing == xfc->primary) ret = gdi_InvalidateRegion(xfc->hdc, scrblt->nLeftRect, scrblt->nTopRect, scrblt->nWidth, scrblt->nHeight); XSetFunction(xfc->display, xfc->gc, GXcopy); fail: xf_unlock_x11(xfc, FALSE); return ret; }
BOOL xf_process_x_events(freerdp* instance) { BOOL status; XEvent xevent; int pending_status; xfContext* xfc = (xfContext*) instance->context; status = TRUE; pending_status = TRUE; while (pending_status) { xf_lock_x11(xfc, FALSE); pending_status = XPending(xfc->display); xf_unlock_x11(xfc, FALSE); if (pending_status) { ZeroMemory(&xevent, sizeof(xevent)); XNextEvent(xfc->display, &xevent); status = xf_event_process(instance, &xevent); if (!status) return status; } } return status; }
BOOL xf_sw_desktop_resize(rdpContext* context) { rdpGdi* gdi = context->gdi; xfContext* xfc = (xfContext*) context; BOOL ret = FALSE; xf_lock_x11(xfc, TRUE); xfc->sessionWidth = context->settings->DesktopWidth; xfc->sessionHeight = context->settings->DesktopHeight; if (!gdi_resize(gdi, xfc->sessionWidth, xfc->sessionHeight)) goto out; if (xfc->image) { xfc->image->data = NULL; XDestroyImage(xfc->image); if (!(xfc->image = XCreateImage(xfc->display, xfc->visual, xfc->depth, ZPixmap, 0, (char*) gdi->primary_buffer, gdi->width, gdi->height, xfc->scanline_pad, 0))) { goto out; } } ret = xf_desktop_resize(context); out: xf_unlock_x11(xfc, TRUE); return ret; }
void xf_gdi_polygon_sc(rdpContext* context, POLYGON_SC_ORDER* polygon_sc) { int i, npoints; XPoint* points; UINT32 brush_color; xfContext* xfc = (xfContext*) context; xf_lock_x11(xfc, FALSE); xf_set_rop2(xfc, polygon_sc->bRop2); brush_color = freerdp_convert_gdi_order_color(polygon_sc->brushColor, context->settings->ColorDepth, xfc->format, xfc->palette); brush_color = xf_gdi_get_color(xfc, brush_color); npoints = polygon_sc->numPoints + 1; points = malloc(sizeof(XPoint) * npoints); points[0].x = polygon_sc->xStart; points[0].y = polygon_sc->yStart; for (i = 0; i < polygon_sc->numPoints; i++) { points[i + 1].x = polygon_sc->points[i].x; points[i + 1].y = polygon_sc->points[i].y; } switch (polygon_sc->fillMode) { case 1: /* alternate */ XSetFillRule(xfc->display, xfc->gc, EvenOddRule); break; case 2: /* winding */ XSetFillRule(xfc->display, xfc->gc, WindingRule); break; default: WLog_ERR(TAG, "PolygonSC unknown fillMode: %d", polygon_sc->fillMode); break; } XSetFillStyle(xfc->display, xfc->gc, FillSolid); XSetForeground(xfc->display, xfc->gc, brush_color); XFillPolygon(xfc->display, xfc->drawing, xfc->gc, points, npoints, Complex, CoordModePrevious); if (xfc->drawing == xfc->primary) { XFillPolygon(xfc->display, xfc->drawable, xfc->gc, points, npoints, Complex, CoordModePrevious); } XSetFunction(xfc->display, xfc->gc, GXcopy); free(points); xf_unlock_x11(xfc, FALSE); }
static void xf_Bitmap_Free(rdpContext* context, rdpBitmap* bitmap) { xfContext* xfc = (xfContext*) context; xf_lock_x11(xfc, FALSE); if (((xfBitmap*) bitmap)->pixmap != 0) XFreePixmap(xfc->display, ((xfBitmap*) bitmap)->pixmap); xf_unlock_x11(xfc, FALSE); }
void xf_gdi_palette_update(rdpContext* context, PALETTE_UPDATE* palette) { xfInfo* xfi = ((xfContext*) context)->xfi; xf_lock_x11(xfi, FALSE); CopyMemory(xfi->clrconv->palette, palette, sizeof(rdpPalette)); xf_unlock_x11(xfi, FALSE); }
void xf_Glyph_Free(rdpContext* context, rdpGlyph* glyph) { xfContext* xfc = (xfContext*) context; xf_lock_x11(xfc, FALSE); if (((xfGlyph*) glyph)->pixmap != 0) XFreePixmap(xfc->display, ((xfGlyph*) glyph)->pixmap); xf_unlock_x11(xfc, FALSE); }