diff options
-rw-r--r-- | xorg/server/module/rdpClientCon.c | 277 | ||||
-rw-r--r-- | xorg/server/module/rdpClientCon.h | 21 | ||||
-rw-r--r-- | xorg/server/module/rdpCopyArea.c | 72 | ||||
-rw-r--r-- | xorg/server/module/rdpDraw.c | 99 | ||||
-rw-r--r-- | xorg/server/module/rdpDraw.h | 3 | ||||
-rw-r--r-- | xorg/server/module/rdpImageText16.c | 71 | ||||
-rw-r--r-- | xorg/server/module/rdpImageText8.c | 4 | ||||
-rw-r--r-- | xorg/server/module/rdpMisc.c | 28 | ||||
-rw-r--r-- | xorg/server/module/rdpMisc.h | 2 | ||||
-rw-r--r-- | xorg/server/module/rdpPolyFillRect.c | 3 | ||||
-rw-r--r-- | xorg/server/module/rdpPolyText16.c | 2 | ||||
-rw-r--r-- | xorg/server/module/rdpPolyText8.c | 2 | ||||
-rw-r--r-- | xorg/server/module/rdpPutImage.c | 73 | ||||
-rw-r--r-- | xorg/server/xrdpmouse/rdpMouse.c | 15 |
14 files changed, 616 insertions, 56 deletions
diff --git a/xorg/server/module/rdpClientCon.c b/xorg/server/module/rdpClientCon.c index 73b08500..64fdcfda 100644 --- a/xorg/server/module/rdpClientCon.c +++ b/xorg/server/module/rdpClientCon.c @@ -115,6 +115,7 @@ rdpClientConGotConnection(ScreenPtr pScreen, rdpPtr dev) LLOGLN(0, ("rdpClientConGotConnection:")); clientCon = (rdpClientCon *) g_malloc(sizeof(rdpClientCon), 1); + clientCon->dev = dev; make_stream(clientCon->in_s); init_stream(clientCon->in_s, 8192); make_stream(clientCon->out_s); @@ -154,6 +155,7 @@ rdpClientConGotConnection(ScreenPtr pScreen, rdpPtr dev) } clientCon->dirtyRegion = rdpRegionCreate(NullBox, 0); + clientCon->shmRegion = rdpRegionCreate(NullBox, 0); return 0; } @@ -266,6 +268,7 @@ rdpClientConDisconnect(rdpPtr dev, rdpClientCon *clientCon) pcli = pcli->next; } rdpRegionDestroy(clientCon->dirtyRegion); + rdpRegionDestroy(clientCon->shmRegion); g_free(clientCon); return 0; } @@ -568,46 +571,36 @@ rdpClientConProcessScreenSizeMsg(rdpPtr dev, rdpClientCon *clientCon, clientCon->rdp_Bpp_mask = 0xffffff; } -// todo -#if 0 - if (g_use_shmem) + if (clientCon->shmemptr != 0) { - if (g_shmemptr != 0) - { - shmdt(g_shmemptr); - } - bytes = g_rdpScreen.rdp_width * g_rdpScreen.rdp_height * - g_rdpScreen.rdp_Bpp; - g_shmemid = shmget(IPC_PRIVATE, bytes, IPC_CREAT | 0777); - g_shmemptr = shmat(g_shmemid, 0, 0); - shmctl(g_shmemid, IPC_RMID, NULL); - LLOGLN(0, ("rdpClientConProcessScreenSizeMsg: g_shmemid %d g_shmemptr %p", - g_shmemid, g_shmemptr)); - g_shmem_lineBytes = g_rdpScreen.rdp_Bpp * g_rdpScreen.rdp_width; - - if (g_shm_reg != 0) - { - RegionDestroy(g_shm_reg); - } - g_shm_reg = RegionCreate(NullBox, 0); + shmdt(clientCon->shmemptr); } -#endif + bytes = clientCon->rdp_width * clientCon->rdp_height * + clientCon->rdp_Bpp; + clientCon->shmemid = shmget(IPC_PRIVATE, bytes, IPC_CREAT | 0777); + clientCon->shmemptr = shmat(clientCon->shmemid, 0, 0); + shmctl(clientCon->shmemid, IPC_RMID, NULL); + LLOGLN(0, ("rdpClientConProcessScreenSizeMsg: shmemid %d shmemptr %p", + clientCon->shmemid, clientCon->shmemptr)); + clientCon->shmem_lineBytes = clientCon->rdp_Bpp * clientCon->rdp_width; + + if (clientCon->shmRegion != 0) + { + rdpRegionDestroy(clientCon->shmRegion); + } + clientCon->shmRegion = rdpRegionCreate(NullBox, 0); mmwidth = PixelToMM(width); mmheight = PixelToMM(height); -// todo -#if 0 - pSize = RRRegisterSize(g_pScreen, width, height, mmwidth, mmheight); - RRSetCurrentConfig(g_pScreen, RR_Rotate_0, 0, pSize); + pSize = RRRegisterSize(dev->pScreen, width, height, mmwidth, mmheight); + RRSetCurrentConfig(dev->pScreen, RR_Rotate_0, 0, pSize); - if ((g_rdpScreen.width != width) || (g_rdpScreen.height != height)) + if ((dev->width != width) || (dev->height != height)) { - LLOGLN(0, (" calling RRScreenSizeSet")); - ok = RRScreenSizeSet(g_pScreen, width, height, mmwidth, mmheight); - LLOGLN(0, (" RRScreenSizeSet ok=[%d]", ok)); + ok = RRScreenSizeSet(dev->pScreen, width, height, mmwidth, mmheight); + LLOGLN(0, ("rdpClientConProcessScreenSizeMsg: RRScreenSizeSet ok=[%d]", ok)); } -#endif return 0; } @@ -622,6 +615,10 @@ rdpClientConProcessMsgClientInput(rdpPtr dev, rdpClientCon *clientCon) int param2; int param3; int param4; + int x; + int y; + int cx; + int cy; s = clientCon->in_s; in_uint32_le(s, msg); @@ -643,10 +640,13 @@ rdpClientConProcessMsgClientInput(rdpPtr dev, rdpClientCon *clientCon) } else if (msg == 200) /* invalidate */ { - rdpClientConBeginUpdate(dev, clientCon); - rdpClientConSetFgcolor(dev, clientCon, 0x00ff0000); - rdpClientConFillRect(dev, clientCon, 0, 0, dev->width, dev->height); - rdpClientConEndUpdate(dev, clientCon); + x = (param1 >> 16) & 0xffff; + y = param1 & 0xffff; + cx = (param2 >> 16) & 0xffff; + cy = param2 & 0xffff; + LLOGLN(0, ("rdpClientConProcessMsgClientInput: invalidate x %d y %d " + "cx %d cy %d", x, y, cx, cy)); + rdpClientConAddDirtyScreen(dev, clientCon, x, y, cx, cy); } else if (msg == 300) /* resize desktop */ { @@ -761,10 +761,39 @@ static int rdpClientConProcessMsgClientRegion(rdpPtr dev, rdpClientCon *clientCon) { struct stream *s; + int flags; + int x; + int y; + int cx; + int cy; + RegionRec reg; + BoxRec box; LLOGLN(0, ("rdpClientConProcessMsgClientRegion:")); s = clientCon->in_s; - g_hexdump(s->p, s->end - s->p); + + in_uint32_le(s, flags); + in_uint32_le(s, clientCon->rect_id_ack); + in_uint32_le(s, x); + in_uint32_le(s, y); + in_uint32_le(s, cx); + in_uint32_le(s, cy); + LLOGLN(0, ("rdpClientConProcessMsgClientRegion: %d %d %d %d flags 0x%8.8x", + x, y, cx, cy, flags)); + LLOGLN(0, ("rdpClientConProcessMsgClientRegion: rect_id %d rect_id_ack %d", + clientCon->rect_id, clientCon->rect_id_ack)); + + box.x1 = x; + box.y1 = y; + box.x2 = box.x1 + cx; + box.y2 = box.y1 + cy; + + rdpRegionInit(®, &box, 0); + LLOGLN(0, ("rdpClientConProcessMsgClientRegion: %d %d %d %d", + box.x1, box.y1, box.x2, box.y2)); + rdpRegionSubtract(clientCon->shmRegion, clientCon->shmRegion, ®); + rdpRegionUninit(®); + return 0; } @@ -1820,11 +1849,82 @@ rdpClientConCheckDirtyScreen(rdpPtr dev, rdpClientCon *clientCon) } /******************************************************************************/ +static CARD32 +rdpDeferredUpdateCallback(OsTimerPtr timer, CARD32 now, pointer arg) +{ + rdpClientCon *clientCon; + int num_rects; + int index; + BoxRec box; + + LLOGLN(0, ("rdpDeferredUpdateCallback:")); + clientCon = (rdpClientCon *) arg; + + if (clientCon->rect_id != clientCon->rect_id_ack) + { + LLOGLN(0, ("rdpDeferredUpdateCallback: reschedual")); + clientCon->updateTimer = TimerSet(clientCon->updateTimer, 0, 40, + rdpDeferredUpdateCallback, clientCon); + return 0; + } + + clientCon->updateSchedualed = FALSE; + rdpClientConBeginUpdate(clientCon->dev, clientCon); + num_rects = REGION_NUM_RECTS(clientCon->dirtyRegion); + for (index = 0; index < num_rects; index++) + { + box = REGION_RECTS(clientCon->dirtyRegion)[index]; + LLOGLN(0, (" x1 %d y1 %d x2 %d y2 %d cx %d cy %d", box.x1, box.y1, + box.x2, box.y2, box.x2 - box.x1, box.y2 - box.y1)); + rdpClientConSendArea(clientCon->dev, clientCon, NULL, box.x1, box.y1, + box.x2 - box.x1, box.y2 - box.y1); + } + rdpClientConEndUpdate(clientCon->dev, clientCon); + rdpRegionDestroy(clientCon->dirtyRegion); + clientCon->dirtyRegion = RegionCreate(NullBox, 0); + return 0; +} + +/******************************************************************************/ int rdpClientConAddDirtyScreenReg(rdpPtr dev, rdpClientCon *clientCon, RegionPtr reg) { rdpRegionUnion(clientCon->dirtyRegion, clientCon->dirtyRegion, reg); + if (clientCon->updateSchedualed == FALSE) + { + clientCon->updateTimer = TimerSet(clientCon->updateTimer, 0, 40, + rdpDeferredUpdateCallback, clientCon); + clientCon->updateSchedualed = TRUE; + } + return 0; +} + +/******************************************************************************/ +int +rdpClientConAddDirtyScreenBox(rdpPtr dev, rdpClientCon *clientCon, + BoxPtr box) +{ + RegionPtr reg; + + reg = rdpRegionCreate(box, 0); + rdpClientConAddDirtyScreenReg(dev, clientCon, reg); + rdpRegionDestroy(reg); + return 0; +} + +/******************************************************************************/ +int +rdpClientConAddDirtyScreen(rdpPtr dev, rdpClientCon *clientCon, + int x, int y, int cx, int cy) +{ + BoxRec box; + + box.x1 = x; + box.y1 = y; + box.x2 = box.x1 + cx; + box.y2 = box.y1 + cy; + rdpClientConAddDirtyScreenBox(dev, clientCon, &box); return 0; } @@ -1839,10 +1939,10 @@ rdpClientConGetScreenImageRect(rdpPtr dev, rdpClientCon *clientCon, id->Bpp = clientCon->rdp_Bpp; id->lineBytes = dev->paddedWidthInBytes; id->pixels = dev->pfbMemory; - id->shmem_pixels = g_shmemptr; - id->shmem_id = g_shmemid; + id->shmem_pixels = clientCon->shmemptr; + id->shmem_id = clientCon->shmemid; id->shmem_offset = 0; - id->shmem_lineBytes = g_shmem_lineBytes; + id->shmem_lineBytes = clientCon->shmem_lineBytes; } /******************************************************************************/ @@ -1852,8 +1952,8 @@ rdpClientConGetPixmapImageRect(rdpPtr dev, rdpClientCon *clientCon, { id->width = pPixmap->drawable.width; id->height = pPixmap->drawable.height; - id->bpp = g_rdpScreen.rdp_bpp; - id->Bpp = g_rdpScreen.rdp_Bpp; + id->bpp = clientCon->rdp_bpp; + id->Bpp = clientCon->rdp_Bpp; id->lineBytes = pPixmap->devKind; id->pixels = (char *)(pPixmap->devPrivate.ptr); id->shmem_pixels = 0; @@ -1864,15 +1964,23 @@ rdpClientConGetPixmapImageRect(rdpPtr dev, rdpClientCon *clientCon, /******************************************************************************/ void -rdpClientConSendArea(struct image_data *id, int x, int y, int w, int h) +rdpClientConSendArea(rdpPtr dev, rdpClientCon *clientCon, + struct image_data *id, int x, int y, int w, int h) { struct image_data lid; + BoxRec box; + RegionRec reg; + int ly; + int size; + char *src; + char *dst; + struct stream *s; LLOGLN(10, ("rdpClientConSendArea: id %p x %d y %d w %d h %d", id, x, y, w, h)); - if (id == 0) + if (id == NULL) { - rdpup_get_screen_image_rect(&lid); + rdpClientConGetScreenImageRect(dev, clientCon, &lid); id = &lid; } @@ -1886,4 +1994,85 @@ rdpClientConSendArea(struct image_data *id, int x, int y, int w, int h) return; } + if (x < 0) + { + w += x; + x = 0; + } + + if (y < 0) + { + h += y; + y = 0; + } + + if (w <= 0) + { + return; + } + + if (h <= 0) + { + return; + } + + if (x + w > id->width) + { + w = id->width - x; + } + + if (y + h > id->height) + { + h = id->height - y; + } + + if (clientCon->connected && clientCon->begin) + { + if (id->shmem_pixels != 0) + { + LLOGLN(0, ("rdpClientConSendArea: using shmem")); + box.x1 = x; + box.y1 = y; + box.x2 = box.x1 + w; + box.y2 = box.y1 + h; + src = id->pixels; + src += y * id->lineBytes; + src += x * dev->Bpp; + dst = id->shmem_pixels + id->shmem_offset; + dst += y * id->shmem_lineBytes; + dst += x * clientCon->rdp_Bpp; + ly = y; + while (ly < y + h) + { + rdpClientConConvertPixels(dev, clientCon, src, dst, w); + src += id->lineBytes; + dst += id->shmem_lineBytes; + ly += 1; + } + size = 36; + rdpClientConPreCheck(dev, clientCon, size); + s = clientCon->out_s; + out_uint16_le(s, 60); + out_uint16_le(s, size); + clientCon->count++; + LLOGLN(0, ("rdpClientConSendArea: 2 x %d y %d w %d h %d", x, y, w, h)); + out_uint16_le(s, x); + out_uint16_le(s, y); + out_uint16_le(s, w); + out_uint16_le(s, h); + out_uint32_le(s, 0); + clientCon->rect_id++; + out_uint32_le(s, clientCon->rect_id); + out_uint32_le(s, id->shmem_id); + out_uint32_le(s, id->shmem_offset); + out_uint16_le(s, id->width); + out_uint16_le(s, id->height); + out_uint16_le(s, x); + out_uint16_le(s, y); + rdpRegionInit(®, &box, 0); + rdpRegionUnion(clientCon->shmRegion, clientCon->shmRegion, ®); + rdpRegionUninit(®); + return; + } + } } diff --git a/xorg/server/module/rdpClientCon.h b/xorg/server/module/rdpClientCon.h index 2551a4ed..23f51378 100644 --- a/xorg/server/module/rdpClientCon.h +++ b/xorg/server/module/rdpClientCon.h @@ -50,6 +50,8 @@ struct rdpup_os_bitmap /* one of these for each client */ struct _rdpClientCon { + rdpPtr dev; + int sck; int sckControlListener; int sckControl; @@ -90,6 +92,16 @@ struct _rdpClientCon struct xrdp_client_info client_info; + char *shmemptr; + int shmemid; + int shmem_lineBytes; + RegionPtr shmRegion; + int rect_id; + int rect_id_ack; + + OsTimerPtr updateTimer; + int updateSchedualed; /* boolean */ + struct _rdpClientCon *next; }; @@ -99,6 +111,9 @@ int rdpClientConEndUpdate(rdpPtr dev, rdpClientCon *clientCon); int rdpClientConSetFgcolor(rdpPtr dev, rdpClientCon *clientCon, int fgcolor); +void +rdpClientConSendArea(rdpPtr dev, rdpClientCon *clientCon, + struct image_data *id, int x, int y, int w, int h); int rdpClientConFillRect(rdpPtr dev, rdpClientCon *clientCon, short x, short y, int cx, int cy); @@ -122,6 +137,12 @@ rdpClientConCheckDirtyScreen(rdpPtr dev, rdpClientCon *clientCon); int rdpClientConAddDirtyScreenReg(rdpPtr dev, rdpClientCon *clientCon, RegionPtr reg); +int +rdpClientConAddDirtyScreenBox(rdpPtr dev, rdpClientCon *clientCon, + BoxPtr box); +int +rdpClientConAddDirtyScreen(rdpPtr dev, rdpClientCon *clientCon, + int x, int y, int cx, int cy); #endif diff --git a/xorg/server/module/rdpCopyArea.c b/xorg/server/module/rdpCopyArea.c index 77ad43ad..cc98ab31 100644 --- a/xorg/server/module/rdpCopyArea.c +++ b/xorg/server/module/rdpCopyArea.c @@ -32,12 +32,23 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "rdp.h" #include "rdpDraw.h" +#include "rdpClientCon.h" +#include "rdpReg.h" #define LOG_LEVEL 1 #define LLOGLN(_level, _args) \ do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0) /******************************************************************************/ +static void +rdpCopyAreaPre(rdpPtr dev, rdpClientCon *clientCon, + int cd, RegionPtr clip_reg, + DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC, + int srcx, int srcy, int w, int h, int dstx, int dsty) +{ +} + +/******************************************************************************/ static RegionPtr rdpCopyAreaOrg(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC, int srcx, int srcy, int w, int h, int dstx, int dsty) @@ -52,14 +63,75 @@ rdpCopyAreaOrg(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC, } /******************************************************************************/ +static void +rdpCopyAreaPost(rdpPtr dev, rdpClientCon *clientCon, + int cd, RegionPtr clip_reg, + DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC, + int srcx, int srcy, int w, int h, int dstx, int dsty) +{ + WindowPtr pDstWnd; + BoxRec box; + RegionRec reg; + + if (cd == 0) + { + return; + } + if (pDst->type != DRAWABLE_WINDOW) + { + return; + } + pDstWnd = (WindowPtr) pDst; + if (pDstWnd->viewable == FALSE) + { + return; + } + box.x1 = dstx + pDst->x; + box.y1 = dsty + pDst->y; + box.x2 = box.x1 + w; + box.y2 = box.y1 + h; + rdpRegionInit(®, &box, 0); + if (cd == 2) + { + rdpRegionIntersect(®, clip_reg, ®); + } + rdpClientConAddDirtyScreenReg(dev, clientCon, ®); + RegionUninit(®); +} + +/******************************************************************************/ RegionPtr rdpCopyArea(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC, int srcx, int srcy, int w, int h, int dstx, int dsty) { + rdpPtr dev; + rdpClientCon *clientCon; RegionPtr rv; + RegionRec clip_reg; + int cd; + LLOGLN(10, ("rdpCopyArea:")); + dev = rdpGetDevFromScreen(pGC->pScreen); + rdpRegionInit(&clip_reg, NullBox, 0); + cd = rdpDrawGetClip(dev, &clip_reg, pDst, pGC); + LLOGLN(10, ("rdpCopyArea: cd %d", cd)); + clientCon = dev->clientConHead; + while (clientCon != NULL) + { + rdpCopyAreaPre(dev, clientCon, cd, &clip_reg, pSrc, pDst, pGC, + srcx, srcy, w, h, dstx, dsty); + clientCon = clientCon->next; + } /* do original call */ rv = rdpCopyAreaOrg(pSrc, pDst, pGC, srcx, srcy, w, h, dstx, dsty); + clientCon = dev->clientConHead; + while (clientCon != NULL) + { + rdpCopyAreaPost(dev, clientCon, cd, &clip_reg, pSrc, pDst, pGC, + srcx, srcy, w, h, dstx, dsty); + clientCon = clientCon->next; + } + RegionUninit(&clip_reg); return rv; } diff --git a/xorg/server/module/rdpDraw.c b/xorg/server/module/rdpDraw.c index a731ee98..f4eac7af 100644 --- a/xorg/server/module/rdpDraw.c +++ b/xorg/server/module/rdpDraw.c @@ -36,6 +36,7 @@ misc draw calls #include <fb.h> #include <micmap.h> #include <mi.h> +#include <dixfontstr.h> #include "rdp.h" #include "rdpDraw.h" @@ -149,6 +150,54 @@ rdpDrawGetClip(rdpPtr dev, RegionPtr pRegion, DrawablePtr pDrawable, GCPtr pGC) } /******************************************************************************/ +void +GetTextBoundingBox(DrawablePtr pDrawable, FontPtr font, int x, int y, + int n, BoxPtr pbox) +{ + int maxAscent; + int maxDescent; + int maxCharWidth; + + if (FONTASCENT(font) > FONTMAXBOUNDS(font, ascent)) + { + maxAscent = FONTASCENT(font); + } + else + { + maxAscent = FONTMAXBOUNDS(font, ascent); + } + + if (FONTDESCENT(font) > FONTMAXBOUNDS(font, descent)) + { + maxDescent = FONTDESCENT(font); + } + else + { + maxDescent = FONTMAXBOUNDS(font, descent); + } + + if (FONTMAXBOUNDS(font, rightSideBearing) > + FONTMAXBOUNDS(font, characterWidth)) + { + maxCharWidth = FONTMAXBOUNDS(font, rightSideBearing); + } + else + { + maxCharWidth = FONTMAXBOUNDS(font, characterWidth); + } + + pbox->x1 = pDrawable->x + x; + pbox->y1 = pDrawable->y + y - maxAscent; + pbox->x2 = pbox->x1 + maxCharWidth * n; + pbox->y2 = pbox->y1 + maxAscent + maxDescent; + + if (FONTMINBOUNDS(font, leftSideBearing) < 0) + { + pbox->x1 += FONTMINBOUNDS(font, leftSideBearing); + } +} + +/******************************************************************************/ int rdpDrawItemAdd(rdpPtr dev, rdpPixmapRec *priv, struct rdp_draw_item *di) { @@ -239,12 +288,62 @@ rdpCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr pOldRegion) { ScreenPtr pScreen; rdpPtr dev; + rdpClientCon *clientCon; + RegionRec reg; + RegionRec clip; + int dx; + int dy; + int num_clip_rects; + int num_reg_rects; + BoxPtr box; pScreen = pWin->drawable.pScreen; dev = rdpGetDevFromScreen(pScreen); + + rdpRegionInit(®, NullBox, 0); + rdpRegionCopy(®, pOldRegion); + rdpRegionInit(&clip, NullBox, 0); + rdpRegionCopy(&clip, &pWin->borderClip); + dx = pWin->drawable.x - ptOldOrg.x; + dy = pWin->drawable.y - ptOldOrg.y; + dev->pScreen->CopyWindow = dev->CopyWindow; dev->pScreen->CopyWindow(pWin, ptOldOrg, pOldRegion); dev->pScreen->CopyWindow = rdpCopyWindow; + + num_clip_rects = REGION_NUM_RECTS(&clip); + num_reg_rects = REGION_NUM_RECTS(®); + + if ((num_clip_rects == 0) || (num_reg_rects == 0)) + { + rdpRegionUninit(®); + rdpRegionUninit(&clip); + return; + } + + if ((num_clip_rects > 16) && (num_reg_rects > 16)) + { + box = rdpRegionExtents(®); + clientCon = dev->clientConHead; + while (clientCon != NULL) + { + rdpClientConAddDirtyScreenBox(dev, clientCon, box); + clientCon = clientCon->next; + } + } + else + { + rdpRegionTranslate(®, dx, dy); + rdpRegionIntersect(®, ®, &clip); + clientCon = dev->clientConHead; + while (clientCon != NULL) + { + rdpClientConAddDirtyScreenReg(dev, clientCon, ®); + clientCon = clientCon->next; + } + } + rdpRegionUninit(®); + rdpRegionUninit(&clip); } /*****************************************************************************/ diff --git a/xorg/server/module/rdpDraw.h b/xorg/server/module/rdpDraw.h index eaebddb2..c06f59d7 100644 --- a/xorg/server/module/rdpDraw.h +++ b/xorg/server/module/rdpDraw.h @@ -52,6 +52,9 @@ extern GCOps g_rdpGCOps; /* in rdpGC.c */ int rdpDrawGetClip(rdpPtr dev, RegionPtr pRegion, DrawablePtr pDrawable, GCPtr pGC); +void +GetTextBoundingBox(DrawablePtr pDrawable, FontPtr font, int x, int y, + int n, BoxPtr pbox); int rdpDrawItemAdd(rdpPtr dev, rdpPixmapRec *priv, struct rdp_draw_item *di); int diff --git a/xorg/server/module/rdpImageText16.c b/xorg/server/module/rdpImageText16.c index 984b7759..a4604433 100644 --- a/xorg/server/module/rdpImageText16.c +++ b/xorg/server/module/rdpImageText16.c @@ -32,6 +32,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "rdp.h" #include "rdpDraw.h" +#include "rdpClientCon.h" +#include "rdpReg.h" #define LOG_LEVEL 1 #define LLOGLN(_level, _args) \ @@ -39,6 +41,16 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. /******************************************************************************/ void +rdpImageText16Pre(rdpPtr dev, rdpClientCon *clientCon, + int cd, RegionPtr clip_reg, + DrawablePtr pDrawable, GCPtr pGC, + int x, int y, int count, unsigned short *chars, + BoxPtr box) +{ +} + +/******************************************************************************/ +void rdpImageText16Org(DrawablePtr pDrawable, GCPtr pGC, int x, int y, int count, unsigned short *chars) { @@ -51,10 +63,69 @@ rdpImageText16Org(DrawablePtr pDrawable, GCPtr pGC, /******************************************************************************/ void +rdpImageText16Post(rdpPtr dev, rdpClientCon *clientCon, + int cd, RegionPtr clip_reg, + DrawablePtr pDrawable, GCPtr pGC, + int x, int y, int count, unsigned short *chars, + BoxPtr box) +{ + WindowPtr pDstWnd; + RegionRec reg; + + if (cd == 0) + { + return; + } + if (pDrawable->type != DRAWABLE_WINDOW) + { + return; + } + pDstWnd = (WindowPtr) pDrawable; + if (pDstWnd->viewable == FALSE) + { + return; + } + rdpRegionInit(®, box, 0); + if (cd == 2) + { + rdpRegionIntersect(®, clip_reg, ®); + } + rdpClientConAddDirtyScreenReg(dev, clientCon, ®); + RegionUninit(®); +} + +/******************************************************************************/ +void rdpImageText16(DrawablePtr pDrawable, GCPtr pGC, int x, int y, int count, unsigned short *chars) { + rdpPtr dev; + rdpClientCon *clientCon; + RegionRec clip_reg; + int cd; + BoxRec box; + LLOGLN(10, ("rdpImageText16:")); + dev = rdpGetDevFromScreen(pGC->pScreen); + GetTextBoundingBox(pDrawable, pGC->font, x, y, count, &box); + rdpRegionInit(&clip_reg, NullBox, 0); + cd = rdpDrawGetClip(dev, &clip_reg, pDrawable, pGC); + LLOGLN(10, ("rdpImageText16: cd %d", cd)); + clientCon = dev->clientConHead; + while (clientCon != NULL) + { + rdpImageText16Pre(dev, clientCon, cd, &clip_reg, pDrawable, pGC, + x, y, count, chars, &box); + clientCon = clientCon->next; + } /* do original call */ rdpImageText16Org(pDrawable, pGC, x, y, count, chars); + clientCon = dev->clientConHead; + while (clientCon != NULL) + { + rdpImageText16Post(dev, clientCon, cd, &clip_reg, pDrawable, pGC, + x, y, count, chars, &box); + clientCon = clientCon->next; + } + RegionUninit(&clip_reg); } diff --git a/xorg/server/module/rdpImageText8.c b/xorg/server/module/rdpImageText8.c index f4d62977..42fb42d5 100644 --- a/xorg/server/module/rdpImageText8.c +++ b/xorg/server/module/rdpImageText8.c @@ -32,6 +32,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "rdp.h" #include "rdpDraw.h" +#include "rdpClientCon.h" +#include "rdpReg.h" #define LOG_LEVEL 1 #define LLOGLN(_level, _args) \ @@ -54,7 +56,7 @@ void rdpImageText8(DrawablePtr pDrawable, GCPtr pGC, int x, int y, int count, char *chars) { - LLOGLN(10, ("rdpImageText8:")); + LLOGLN(0, ("rdpImageText8:")); /* do original call */ rdpImageText8Org(pDrawable, pGC, x, y, count, chars); return; diff --git a/xorg/server/module/rdpMisc.c b/xorg/server/module/rdpMisc.c index 1f0c4c51..653342fe 100644 --- a/xorg/server/module/rdpMisc.c +++ b/xorg/server/module/rdpMisc.c @@ -66,6 +66,34 @@ rdpBitsPerPixel(int depth) /* the g_ functions from os_calls.c */ /*****************************************************************************/ +/* wait 'millis' milliseconds for the socket to be able to receive */ +/* returns boolean */ +int +g_sck_can_recv(int sck, int millis) +{ + fd_set rfds; + struct timeval time; + int rv; + + time.tv_sec = millis / 1000; + time.tv_usec = (millis * 1000) % 1000000; + FD_ZERO(&rfds); + + if (sck > 0) + { + FD_SET(((unsigned int)sck), &rfds); + rv = select(sck + 1, &rfds, 0, 0, &time); + + if (rv > 0) + { + return 1; + } + } + + return 0; +} + +/*****************************************************************************/ int g_sck_recv(int sck, void *ptr, int len, int flags) { diff --git a/xorg/server/module/rdpMisc.h b/xorg/server/module/rdpMisc.h index 976f26c8..58f6bd31 100644 --- a/xorg/server/module/rdpMisc.h +++ b/xorg/server/module/rdpMisc.h @@ -29,6 +29,8 @@ the rest int rdpBitsPerPixel(int depth); int +g_sck_can_recv(int sck, int millis); +int g_sck_recv(int sck, void *ptr, int len, int flags); void g_sck_close(int sck); diff --git a/xorg/server/module/rdpPolyFillRect.c b/xorg/server/module/rdpPolyFillRect.c index afcdf3cc..3f05896a 100644 --- a/xorg/server/module/rdpPolyFillRect.c +++ b/xorg/server/module/rdpPolyFillRect.c @@ -65,7 +65,6 @@ rdpPolyFillRectPost(rdpPtr dev, rdpClientCon *clientCon, int cd, RegionPtr clip_reg, DrawablePtr pDrawable, GCPtr pGC, RegionPtr fill_reg) { - BoxRec box; WindowPtr pDstWnd; if (cd == 0) @@ -108,7 +107,7 @@ rdpPolyFillRect(DrawablePtr pDrawable, GCPtr pGC, int nrectFill, rdpRegionInit(&clip_reg, NullBox, 0); cd = rdpDrawGetClip(dev, &clip_reg, pDrawable, pGC); - LLOGLN(0, ("rdpPolyFillRect: cd %d", cd)); + LLOGLN(10, ("rdpPolyFillRect: cd %d", cd)); clientCon = dev->clientConHead; while (clientCon != NULL) { diff --git a/xorg/server/module/rdpPolyText16.c b/xorg/server/module/rdpPolyText16.c index 7617bef8..2c690978 100644 --- a/xorg/server/module/rdpPolyText16.c +++ b/xorg/server/module/rdpPolyText16.c @@ -58,7 +58,7 @@ rdpPolyText16(DrawablePtr pDrawable, GCPtr pGC, { int rv; - LLOGLN(10, ("rdpPolyText16:")); + LLOGLN(0, ("rdpPolyText16:")); /* do original call */ rv = rdpPolyText16Org(pDrawable, pGC, x, y, count, chars); return rv; diff --git a/xorg/server/module/rdpPolyText8.c b/xorg/server/module/rdpPolyText8.c index 6592e811..37748517 100644 --- a/xorg/server/module/rdpPolyText8.c +++ b/xorg/server/module/rdpPolyText8.c @@ -58,7 +58,7 @@ rdpPolyText8(DrawablePtr pDrawable, GCPtr pGC, { int rv; - LLOGLN(10, ("rdpPolyText8:")); + LLOGLN(0, ("rdpPolyText8:")); /* do original call */ rv = rdpPolyText8Org(pDrawable, pGC, x, y, count, chars); return rv; diff --git a/xorg/server/module/rdpPutImage.c b/xorg/server/module/rdpPutImage.c index 9a7d49b2..45849c6e 100644 --- a/xorg/server/module/rdpPutImage.c +++ b/xorg/server/module/rdpPutImage.c @@ -32,12 +32,23 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "rdp.h" #include "rdpDraw.h" +#include "rdpClientCon.h" +#include "rdpReg.h" #define LOG_LEVEL 1 #define LLOGLN(_level, _args) \ do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0) /******************************************************************************/ +void +rdpPutImagePre(rdpPtr dev, rdpClientCon *clientCon, + int cd, RegionPtr clip_reg, + DrawablePtr pDst, GCPtr pGC, int depth, int x, int y, + int w, int h, int leftPad, int format, char *pBits) +{ +} + +/******************************************************************************/ static void rdpPutImageOrg(DrawablePtr pDst, GCPtr pGC, int depth, int x, int y, int w, int h, int leftPad, int format, char *pBits) @@ -52,10 +63,72 @@ rdpPutImageOrg(DrawablePtr pDst, GCPtr pGC, int depth, int x, int y, /******************************************************************************/ void +rdpPutImagePost(rdpPtr dev, rdpClientCon *clientCon, + int cd, RegionPtr clip_reg, + DrawablePtr pDst, GCPtr pGC, int depth, int x, int y, + int w, int h, int leftPad, int format, char *pBits) +{ + WindowPtr pDstWnd; + BoxRec box; + RegionRec reg; + + if (cd == 0) + { + return; + } + if (pDst->type != DRAWABLE_WINDOW) + { + return; + } + pDstWnd = (WindowPtr) pDst; + if (pDstWnd->viewable == FALSE) + { + return; + } + box.x1 = x + pDst->x; + box.y1 = y + pDst->y; + box.x2 = box.x1 + w; + box.y2 = box.y1 + h; + rdpRegionInit(®, &box, 0); + if (cd == 2) + { + rdpRegionIntersect(®, clip_reg, ®); + } + rdpClientConAddDirtyScreenReg(dev, clientCon, ®); + RegionUninit(®); +} + +/******************************************************************************/ +void rdpPutImage(DrawablePtr pDst, GCPtr pGC, int depth, int x, int y, int w, int h, int leftPad, int format, char *pBits) { + rdpPtr dev; + rdpClientCon *clientCon; + RegionRec clip_reg; + int cd; + LLOGLN(10, ("rdpPutImage:")); + dev = rdpGetDevFromScreen(pGC->pScreen); + rdpRegionInit(&clip_reg, NullBox, 0); + cd = rdpDrawGetClip(dev, &clip_reg, pDst, pGC); + LLOGLN(10, ("rdpPutImage: cd %d", cd)); + clientCon = dev->clientConHead; + while (clientCon != NULL) + { + rdpPutImagePre(dev, clientCon, cd, &clip_reg, pDst, pGC, depth, x, y, + w, h, leftPad, format, pBits); + clientCon = clientCon->next; + } + /* do original call */ rdpPutImageOrg(pDst, pGC, depth, x, y, w, h, leftPad, format, pBits); + clientCon = dev->clientConHead; + while (clientCon != NULL) + { + rdpPutImagePost(dev, clientCon, cd, &clip_reg, pDst, pGC, depth, x, y, + w, h, leftPad, format, pBits); + clientCon = clientCon->next; + } + RegionUninit(&clip_reg); } diff --git a/xorg/server/xrdpmouse/rdpMouse.c b/xorg/server/xrdpmouse/rdpMouse.c index a2092d46..2d8213cd 100644 --- a/xorg/server/xrdpmouse/rdpMouse.c +++ b/xorg/server/xrdpmouse/rdpMouse.c @@ -98,18 +98,16 @@ l_bound_by(int val, int low, int high) static void rdpEnqueueMotion(DeviceIntPtr device, int x, int y) { - int valuators[2]; - - valuators[0] = x; - valuators[1] = y; - xf86PostMotionEvent(device, TRUE, 0, 2, valuators); + LLOGLN(10, ("rdpEnqueueMotion:")); + xf86PostMotionEvent(device, TRUE, 0, 2, x, y); } /******************************************************************************/ static void rdpEnqueueButton(DeviceIntPtr device, int type, int buttons) { - xf86PostButtonEvent(device, FALSE, buttons, type, 0, 0); + LLOGLN(10, ("rdpEnqueueButton:")); + xf86PostButtonEvent(device, FALSE, buttons, type == ButtonPress, 0, 0); } /******************************************************************************/ @@ -122,6 +120,8 @@ PtrAddEvent(rdpPointer *pointer) rdpEnqueueMotion(pointer->device, pointer->cursor_x, pointer->cursor_y); + LLOGLN(10, ("PtrAddEvent: x %d y %d", pointer->cursor_x, pointer->cursor_y)); + for (i = 0; i < 5; i++) { if ((pointer->button_mask ^ pointer->old_button_mask) & (1 << i)) @@ -152,7 +152,8 @@ rdpInputMouse(rdpPtr dev, int msg, { rdpPointer *pointer; - LLOGLN(10, ("rdpInputMouse:")); + LLOGLN(10, ("rdpInputMouse: msg %d param1 %ld param2 %ld param3 %ld param4 %ld", + msg, param1, param2, param3, param4)); pointer = &(dev->pointer); switch (msg) { |