xorg: work on xorg driver

ulab-next
Jay Sorg 11 years ago
parent 147ace7382
commit 055c577f54

@ -115,6 +115,7 @@ rdpClientConGotConnection(ScreenPtr pScreen, rdpPtr dev)
LLOGLN(0, ("rdpClientConGotConnection:")); LLOGLN(0, ("rdpClientConGotConnection:"));
clientCon = (rdpClientCon *) g_malloc(sizeof(rdpClientCon), 1); clientCon = (rdpClientCon *) g_malloc(sizeof(rdpClientCon), 1);
clientCon->dev = dev;
make_stream(clientCon->in_s); make_stream(clientCon->in_s);
init_stream(clientCon->in_s, 8192); init_stream(clientCon->in_s, 8192);
make_stream(clientCon->out_s); make_stream(clientCon->out_s);
@ -154,6 +155,7 @@ rdpClientConGotConnection(ScreenPtr pScreen, rdpPtr dev)
} }
clientCon->dirtyRegion = rdpRegionCreate(NullBox, 0); clientCon->dirtyRegion = rdpRegionCreate(NullBox, 0);
clientCon->shmRegion = rdpRegionCreate(NullBox, 0);
return 0; return 0;
} }
@ -266,6 +268,7 @@ rdpClientConDisconnect(rdpPtr dev, rdpClientCon *clientCon)
pcli = pcli->next; pcli = pcli->next;
} }
rdpRegionDestroy(clientCon->dirtyRegion); rdpRegionDestroy(clientCon->dirtyRegion);
rdpRegionDestroy(clientCon->shmRegion);
g_free(clientCon); g_free(clientCon);
return 0; return 0;
} }
@ -568,46 +571,36 @@ rdpClientConProcessScreenSizeMsg(rdpPtr dev, rdpClientCon *clientCon,
clientCon->rdp_Bpp_mask = 0xffffff; clientCon->rdp_Bpp_mask = 0xffffff;
} }
// todo if (clientCon->shmemptr != 0)
#if 0
if (g_use_shmem)
{
if (g_shmemptr != 0)
{ {
shmdt(g_shmemptr); shmdt(clientCon->shmemptr);
} }
bytes = g_rdpScreen.rdp_width * g_rdpScreen.rdp_height * bytes = clientCon->rdp_width * clientCon->rdp_height *
g_rdpScreen.rdp_Bpp; clientCon->rdp_Bpp;
g_shmemid = shmget(IPC_PRIVATE, bytes, IPC_CREAT | 0777); clientCon->shmemid = shmget(IPC_PRIVATE, bytes, IPC_CREAT | 0777);
g_shmemptr = shmat(g_shmemid, 0, 0); clientCon->shmemptr = shmat(clientCon->shmemid, 0, 0);
shmctl(g_shmemid, IPC_RMID, NULL); shmctl(clientCon->shmemid, IPC_RMID, NULL);
LLOGLN(0, ("rdpClientConProcessScreenSizeMsg: g_shmemid %d g_shmemptr %p", LLOGLN(0, ("rdpClientConProcessScreenSizeMsg: shmemid %d shmemptr %p",
g_shmemid, g_shmemptr)); clientCon->shmemid, clientCon->shmemptr));
g_shmem_lineBytes = g_rdpScreen.rdp_Bpp * g_rdpScreen.rdp_width; clientCon->shmem_lineBytes = clientCon->rdp_Bpp * clientCon->rdp_width;
if (g_shm_reg != 0) if (clientCon->shmRegion != 0)
{ {
RegionDestroy(g_shm_reg); rdpRegionDestroy(clientCon->shmRegion);
}
g_shm_reg = RegionCreate(NullBox, 0);
} }
#endif clientCon->shmRegion = rdpRegionCreate(NullBox, 0);
mmwidth = PixelToMM(width); mmwidth = PixelToMM(width);
mmheight = PixelToMM(height); mmheight = PixelToMM(height);
// todo pSize = RRRegisterSize(dev->pScreen, width, height, mmwidth, mmheight);
#if 0 RRSetCurrentConfig(dev->pScreen, RR_Rotate_0, 0, pSize);
pSize = RRRegisterSize(g_pScreen, width, height, mmwidth, mmheight);
RRSetCurrentConfig(g_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(dev->pScreen, width, height, mmwidth, mmheight);
ok = RRScreenSizeSet(g_pScreen, width, height, mmwidth, mmheight); LLOGLN(0, ("rdpClientConProcessScreenSizeMsg: RRScreenSizeSet ok=[%d]", ok));
LLOGLN(0, (" RRScreenSizeSet ok=[%d]", ok));
} }
#endif
return 0; return 0;
} }
@ -622,6 +615,10 @@ rdpClientConProcessMsgClientInput(rdpPtr dev, rdpClientCon *clientCon)
int param2; int param2;
int param3; int param3;
int param4; int param4;
int x;
int y;
int cx;
int cy;
s = clientCon->in_s; s = clientCon->in_s;
in_uint32_le(s, msg); in_uint32_le(s, msg);
@ -643,10 +640,13 @@ rdpClientConProcessMsgClientInput(rdpPtr dev, rdpClientCon *clientCon)
} }
else if (msg == 200) /* invalidate */ else if (msg == 200) /* invalidate */
{ {
rdpClientConBeginUpdate(dev, clientCon); x = (param1 >> 16) & 0xffff;
rdpClientConSetFgcolor(dev, clientCon, 0x00ff0000); y = param1 & 0xffff;
rdpClientConFillRect(dev, clientCon, 0, 0, dev->width, dev->height); cx = (param2 >> 16) & 0xffff;
rdpClientConEndUpdate(dev, clientCon); 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 */ else if (msg == 300) /* resize desktop */
{ {
@ -761,10 +761,39 @@ static int
rdpClientConProcessMsgClientRegion(rdpPtr dev, rdpClientCon *clientCon) rdpClientConProcessMsgClientRegion(rdpPtr dev, rdpClientCon *clientCon)
{ {
struct stream *s; struct stream *s;
int flags;
int x;
int y;
int cx;
int cy;
RegionRec reg;
BoxRec box;
LLOGLN(0, ("rdpClientConProcessMsgClientRegion:")); LLOGLN(0, ("rdpClientConProcessMsgClientRegion:"));
s = clientCon->in_s; 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(&reg, &box, 0);
LLOGLN(0, ("rdpClientConProcessMsgClientRegion: %d %d %d %d",
box.x1, box.y1, box.x2, box.y2));
rdpRegionSubtract(clientCon->shmRegion, clientCon->shmRegion, &reg);
rdpRegionUninit(&reg);
return 0; return 0;
} }
@ -1819,12 +1848,83 @@ rdpClientConCheckDirtyScreen(rdpPtr dev, rdpClientCon *clientCon)
return 0; return 0;
} }
/******************************************************************************/
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 int
rdpClientConAddDirtyScreenReg(rdpPtr dev, rdpClientCon *clientCon, rdpClientConAddDirtyScreenReg(rdpPtr dev, rdpClientCon *clientCon,
RegionPtr reg) RegionPtr reg)
{ {
rdpRegionUnion(clientCon->dirtyRegion, clientCon->dirtyRegion, 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; return 0;
} }
@ -1839,10 +1939,10 @@ rdpClientConGetScreenImageRect(rdpPtr dev, rdpClientCon *clientCon,
id->Bpp = clientCon->rdp_Bpp; id->Bpp = clientCon->rdp_Bpp;
id->lineBytes = dev->paddedWidthInBytes; id->lineBytes = dev->paddedWidthInBytes;
id->pixels = dev->pfbMemory; id->pixels = dev->pfbMemory;
id->shmem_pixels = g_shmemptr; id->shmem_pixels = clientCon->shmemptr;
id->shmem_id = g_shmemid; id->shmem_id = clientCon->shmemid;
id->shmem_offset = 0; 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->width = pPixmap->drawable.width;
id->height = pPixmap->drawable.height; id->height = pPixmap->drawable.height;
id->bpp = g_rdpScreen.rdp_bpp; id->bpp = clientCon->rdp_bpp;
id->Bpp = g_rdpScreen.rdp_Bpp; id->Bpp = clientCon->rdp_Bpp;
id->lineBytes = pPixmap->devKind; id->lineBytes = pPixmap->devKind;
id->pixels = (char *)(pPixmap->devPrivate.ptr); id->pixels = (char *)(pPixmap->devPrivate.ptr);
id->shmem_pixels = 0; id->shmem_pixels = 0;
@ -1864,15 +1964,23 @@ rdpClientConGetPixmapImageRect(rdpPtr dev, rdpClientCon *clientCon,
/******************************************************************************/ /******************************************************************************/
void 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; 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)); 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; id = &lid;
} }
@ -1886,4 +1994,85 @@ rdpClientConSendArea(struct image_data *id, int x, int y, int w, int h)
return; 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(&reg, &box, 0);
rdpRegionUnion(clientCon->shmRegion, clientCon->shmRegion, &reg);
rdpRegionUninit(&reg);
return;
}
}
} }

@ -50,6 +50,8 @@ struct rdpup_os_bitmap
/* one of these for each client */ /* one of these for each client */
struct _rdpClientCon struct _rdpClientCon
{ {
rdpPtr dev;
int sck; int sck;
int sckControlListener; int sckControlListener;
int sckControl; int sckControl;
@ -90,6 +92,16 @@ struct _rdpClientCon
struct xrdp_client_info client_info; 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; struct _rdpClientCon *next;
}; };
@ -99,6 +111,9 @@ int
rdpClientConEndUpdate(rdpPtr dev, rdpClientCon *clientCon); rdpClientConEndUpdate(rdpPtr dev, rdpClientCon *clientCon);
int int
rdpClientConSetFgcolor(rdpPtr dev, rdpClientCon *clientCon, int fgcolor); 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 int
rdpClientConFillRect(rdpPtr dev, rdpClientCon *clientCon, rdpClientConFillRect(rdpPtr dev, rdpClientCon *clientCon,
short x, short y, int cx, int cy); short x, short y, int cx, int cy);
@ -122,6 +137,12 @@ rdpClientConCheckDirtyScreen(rdpPtr dev, rdpClientCon *clientCon);
int int
rdpClientConAddDirtyScreenReg(rdpPtr dev, rdpClientCon *clientCon, rdpClientConAddDirtyScreenReg(rdpPtr dev, rdpClientCon *clientCon,
RegionPtr reg); 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 #endif

@ -32,11 +32,22 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "rdp.h" #include "rdp.h"
#include "rdpDraw.h" #include "rdpDraw.h"
#include "rdpClientCon.h"
#include "rdpReg.h"
#define LOG_LEVEL 1 #define LOG_LEVEL 1
#define LLOGLN(_level, _args) \ #define LLOGLN(_level, _args) \
do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0) 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 static RegionPtr
rdpCopyAreaOrg(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC, rdpCopyAreaOrg(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC,
@ -51,15 +62,76 @@ rdpCopyAreaOrg(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC,
return rv; return rv;
} }
/******************************************************************************/
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(&reg, &box, 0);
if (cd == 2)
{
rdpRegionIntersect(&reg, clip_reg, &reg);
}
rdpClientConAddDirtyScreenReg(dev, clientCon, &reg);
RegionUninit(&reg);
}
/******************************************************************************/ /******************************************************************************/
RegionPtr RegionPtr
rdpCopyArea(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC, rdpCopyArea(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC,
int srcx, int srcy, int w, int h, int dstx, int dsty) int srcx, int srcy, int w, int h, int dstx, int dsty)
{ {
rdpPtr dev;
rdpClientCon *clientCon;
RegionPtr rv; RegionPtr rv;
RegionRec clip_reg;
int cd;
LLOGLN(10, ("rdpCopyArea:")); 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 */ /* do original call */
rv = rdpCopyAreaOrg(pSrc, pDst, pGC, srcx, srcy, w, h, dstx, dsty); 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; return rv;
} }

@ -36,6 +36,7 @@ misc draw calls
#include <fb.h> #include <fb.h>
#include <micmap.h> #include <micmap.h>
#include <mi.h> #include <mi.h>
#include <dixfontstr.h>
#include "rdp.h" #include "rdp.h"
#include "rdpDraw.h" #include "rdpDraw.h"
@ -148,6 +149,54 @@ rdpDrawGetClip(rdpPtr dev, RegionPtr pRegion, DrawablePtr pDrawable, GCPtr pGC)
return rv; return rv;
} }
/******************************************************************************/
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 int
rdpDrawItemAdd(rdpPtr dev, rdpPixmapRec *priv, struct rdp_draw_item *di) rdpDrawItemAdd(rdpPtr dev, rdpPixmapRec *priv, struct rdp_draw_item *di)
@ -239,12 +288,62 @@ rdpCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr pOldRegion)
{ {
ScreenPtr pScreen; ScreenPtr pScreen;
rdpPtr dev; 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; pScreen = pWin->drawable.pScreen;
dev = rdpGetDevFromScreen(pScreen); dev = rdpGetDevFromScreen(pScreen);
rdpRegionInit(&reg, NullBox, 0);
rdpRegionCopy(&reg, 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 = dev->CopyWindow;
dev->pScreen->CopyWindow(pWin, ptOldOrg, pOldRegion); dev->pScreen->CopyWindow(pWin, ptOldOrg, pOldRegion);
dev->pScreen->CopyWindow = rdpCopyWindow; dev->pScreen->CopyWindow = rdpCopyWindow;
num_clip_rects = REGION_NUM_RECTS(&clip);
num_reg_rects = REGION_NUM_RECTS(&reg);
if ((num_clip_rects == 0) || (num_reg_rects == 0))
{
rdpRegionUninit(&reg);
rdpRegionUninit(&clip);
return;
}
if ((num_clip_rects > 16) && (num_reg_rects > 16))
{
box = rdpRegionExtents(&reg);
clientCon = dev->clientConHead;
while (clientCon != NULL)
{
rdpClientConAddDirtyScreenBox(dev, clientCon, box);
clientCon = clientCon->next;
}
}
else
{
rdpRegionTranslate(&reg, dx, dy);
rdpRegionIntersect(&reg, &reg, &clip);
clientCon = dev->clientConHead;
while (clientCon != NULL)
{
rdpClientConAddDirtyScreenReg(dev, clientCon, &reg);
clientCon = clientCon->next;
}
}
rdpRegionUninit(&reg);
rdpRegionUninit(&clip);
} }
/*****************************************************************************/ /*****************************************************************************/

@ -52,6 +52,9 @@ extern GCOps g_rdpGCOps; /* in rdpGC.c */
int int
rdpDrawGetClip(rdpPtr dev, RegionPtr pRegion, DrawablePtr pDrawable, GCPtr pGC); rdpDrawGetClip(rdpPtr dev, RegionPtr pRegion, DrawablePtr pDrawable, GCPtr pGC);
void
GetTextBoundingBox(DrawablePtr pDrawable, FontPtr font, int x, int y,
int n, BoxPtr pbox);
int int
rdpDrawItemAdd(rdpPtr dev, rdpPixmapRec *priv, struct rdp_draw_item *di); rdpDrawItemAdd(rdpPtr dev, rdpPixmapRec *priv, struct rdp_draw_item *di);
int int

@ -32,11 +32,23 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "rdp.h" #include "rdp.h"
#include "rdpDraw.h" #include "rdpDraw.h"
#include "rdpClientCon.h"
#include "rdpReg.h"
#define LOG_LEVEL 1 #define LOG_LEVEL 1
#define LLOGLN(_level, _args) \ #define LLOGLN(_level, _args) \
do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0) do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
/******************************************************************************/
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 void
rdpImageText16Org(DrawablePtr pDrawable, GCPtr pGC, rdpImageText16Org(DrawablePtr pDrawable, GCPtr pGC,
@ -49,12 +61,71 @@ rdpImageText16Org(DrawablePtr pDrawable, GCPtr pGC,
GC_OP_EPILOGUE(pGC); GC_OP_EPILOGUE(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(&reg, box, 0);
if (cd == 2)
{
rdpRegionIntersect(&reg, clip_reg, &reg);
}
rdpClientConAddDirtyScreenReg(dev, clientCon, &reg);
RegionUninit(&reg);
}
/******************************************************************************/ /******************************************************************************/
void void
rdpImageText16(DrawablePtr pDrawable, GCPtr pGC, rdpImageText16(DrawablePtr pDrawable, GCPtr pGC,
int x, int y, int count, unsigned short *chars) int x, int y, int count, unsigned short *chars)
{ {
rdpPtr dev;
rdpClientCon *clientCon;
RegionRec clip_reg;
int cd;
BoxRec box;
LLOGLN(10, ("rdpImageText16:")); 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 */ /* do original call */
rdpImageText16Org(pDrawable, pGC, x, y, count, chars); 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);
} }

@ -32,6 +32,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "rdp.h" #include "rdp.h"
#include "rdpDraw.h" #include "rdpDraw.h"
#include "rdpClientCon.h"
#include "rdpReg.h"
#define LOG_LEVEL 1 #define LOG_LEVEL 1
#define LLOGLN(_level, _args) \ #define LLOGLN(_level, _args) \
@ -54,7 +56,7 @@ void
rdpImageText8(DrawablePtr pDrawable, GCPtr pGC, rdpImageText8(DrawablePtr pDrawable, GCPtr pGC,
int x, int y, int count, char *chars) int x, int y, int count, char *chars)
{ {
LLOGLN(10, ("rdpImageText8:")); LLOGLN(0, ("rdpImageText8:"));
/* do original call */ /* do original call */
rdpImageText8Org(pDrawable, pGC, x, y, count, chars); rdpImageText8Org(pDrawable, pGC, x, y, count, chars);
return; return;

@ -65,6 +65,34 @@ rdpBitsPerPixel(int depth)
/* the g_ functions from os_calls.c */ /* 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 int
g_sck_recv(int sck, void *ptr, int len, int flags) g_sck_recv(int sck, void *ptr, int len, int flags)

@ -29,6 +29,8 @@ the rest
int int
rdpBitsPerPixel(int depth); rdpBitsPerPixel(int depth);
int int
g_sck_can_recv(int sck, int millis);
int
g_sck_recv(int sck, void *ptr, int len, int flags); g_sck_recv(int sck, void *ptr, int len, int flags);
void void
g_sck_close(int sck); g_sck_close(int sck);

@ -65,7 +65,6 @@ rdpPolyFillRectPost(rdpPtr dev, rdpClientCon *clientCon,
int cd, RegionPtr clip_reg, int cd, RegionPtr clip_reg,
DrawablePtr pDrawable, GCPtr pGC, RegionPtr fill_reg) DrawablePtr pDrawable, GCPtr pGC, RegionPtr fill_reg)
{ {
BoxRec box;
WindowPtr pDstWnd; WindowPtr pDstWnd;
if (cd == 0) if (cd == 0)
@ -108,7 +107,7 @@ rdpPolyFillRect(DrawablePtr pDrawable, GCPtr pGC, int nrectFill,
rdpRegionInit(&clip_reg, NullBox, 0); rdpRegionInit(&clip_reg, NullBox, 0);
cd = rdpDrawGetClip(dev, &clip_reg, pDrawable, pGC); cd = rdpDrawGetClip(dev, &clip_reg, pDrawable, pGC);
LLOGLN(0, ("rdpPolyFillRect: cd %d", cd)); LLOGLN(10, ("rdpPolyFillRect: cd %d", cd));
clientCon = dev->clientConHead; clientCon = dev->clientConHead;
while (clientCon != NULL) while (clientCon != NULL)
{ {

@ -58,7 +58,7 @@ rdpPolyText16(DrawablePtr pDrawable, GCPtr pGC,
{ {
int rv; int rv;
LLOGLN(10, ("rdpPolyText16:")); LLOGLN(0, ("rdpPolyText16:"));
/* do original call */ /* do original call */
rv = rdpPolyText16Org(pDrawable, pGC, x, y, count, chars); rv = rdpPolyText16Org(pDrawable, pGC, x, y, count, chars);
return rv; return rv;

@ -58,7 +58,7 @@ rdpPolyText8(DrawablePtr pDrawable, GCPtr pGC,
{ {
int rv; int rv;
LLOGLN(10, ("rdpPolyText8:")); LLOGLN(0, ("rdpPolyText8:"));
/* do original call */ /* do original call */
rv = rdpPolyText8Org(pDrawable, pGC, x, y, count, chars); rv = rdpPolyText8Org(pDrawable, pGC, x, y, count, chars);
return rv; return rv;

@ -32,11 +32,22 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "rdp.h" #include "rdp.h"
#include "rdpDraw.h" #include "rdpDraw.h"
#include "rdpClientCon.h"
#include "rdpReg.h"
#define LOG_LEVEL 1 #define LOG_LEVEL 1
#define LLOGLN(_level, _args) \ #define LLOGLN(_level, _args) \
do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0) 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 static void
rdpPutImageOrg(DrawablePtr pDst, GCPtr pGC, int depth, int x, int y, rdpPutImageOrg(DrawablePtr pDst, GCPtr pGC, int depth, int x, int y,
@ -50,12 +61,74 @@ rdpPutImageOrg(DrawablePtr pDst, GCPtr pGC, int depth, int x, int y,
GC_OP_EPILOGUE(pGC); GC_OP_EPILOGUE(pGC);
} }
/******************************************************************************/
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(&reg, &box, 0);
if (cd == 2)
{
rdpRegionIntersect(&reg, clip_reg, &reg);
}
rdpClientConAddDirtyScreenReg(dev, clientCon, &reg);
RegionUninit(&reg);
}
/******************************************************************************/ /******************************************************************************/
void void
rdpPutImage(DrawablePtr pDst, GCPtr pGC, int depth, int x, int y, rdpPutImage(DrawablePtr pDst, GCPtr pGC, int depth, int x, int y,
int w, int h, int leftPad, int format, char *pBits) int w, int h, int leftPad, int format, char *pBits)
{ {
rdpPtr dev;
rdpClientCon *clientCon;
RegionRec clip_reg;
int cd;
LLOGLN(10, ("rdpPutImage:")); 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 */ /* do original call */
rdpPutImageOrg(pDst, pGC, depth, x, y, w, h, leftPad, format, pBits); 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);
} }

@ -98,18 +98,16 @@ l_bound_by(int val, int low, int high)
static void static void
rdpEnqueueMotion(DeviceIntPtr device, int x, int y) rdpEnqueueMotion(DeviceIntPtr device, int x, int y)
{ {
int valuators[2]; LLOGLN(10, ("rdpEnqueueMotion:"));
xf86PostMotionEvent(device, TRUE, 0, 2, x, y);
valuators[0] = x;
valuators[1] = y;
xf86PostMotionEvent(device, TRUE, 0, 2, valuators);
} }
/******************************************************************************/ /******************************************************************************/
static void static void
rdpEnqueueButton(DeviceIntPtr device, int type, int buttons) 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); 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++) for (i = 0; i < 5; i++)
{ {
if ((pointer->button_mask ^ pointer->old_button_mask) & (1 << i)) if ((pointer->button_mask ^ pointer->old_button_mask) & (1 << i))
@ -152,7 +152,8 @@ rdpInputMouse(rdpPtr dev, int msg,
{ {
rdpPointer *pointer; 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); pointer = &(dev->pointer);
switch (msg) switch (msg)
{ {

Loading…
Cancel
Save